Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include convenience bash script for running rabbit mq locally #668

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/tutorials/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ way to start it is to run it via a container:
podman run -it --rm --net host rmohr/activemq:5.15.9-alpine
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should: Also remove this reference to activemq

Copy link
Author

@Relm-Arrowny Relm-Arrowny Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed activemq reference, a couple of things I notice while doing so which are the side effects of removing the Stomp default:

  1. The cli will forget/reload the env every time so
    blueapi controller run count '{"detectors": ["current_det", "image_det"]}
    in the quickstart guide will not work unless we set the env with add env loading #649 or do
    blueapi -c src/script/stomp_config.yml controller run count '{"detectors": ["current_det", "image_det"]}'
  2. blueapi serve will technically work but there will be half a page of warning ever 10 secs.

```

Alternatively, a script is available:
Relm-Arrowny marked this conversation as resolved.
Show resolved Hide resolved

```
src/script/start_rabbitmq.sh
```

## Start Worker

To start the worker:
Expand All @@ -31,6 +37,12 @@ The worker can also be started using a custom config file:
blueapi --config path/to/file serve
```

An example of a config file that starts STOMP with default values can be found in:

```
src/script/stomp_config.yml
```

Comment on lines +30 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should: As above with ActiveMQ vs RabbitMQ, if we're going to make rabbitMQ the default for new users then maybe this should be the default config?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It used to be, but I changed it. I think it's important for a complete beginner to clone -> build -> run with no extra steps, because once you add 1 extra step it's very easy to get into a "just one more..." mentality. The message bus is an optional feature that adds rich feedback and that we use in production, but configuring it is part 2 of the tutorial.

## Test that the Worker is Running

Blueapi comes with a CLI so that you can query and control the worker from the terminal.
Expand All @@ -41,4 +53,6 @@ Blueapi comes with a CLI so that you can query and control the worker from the t

The above command should display all plans the worker is capable of running.



See also [full cli reference](../reference/cli.md)
3 changes: 3 additions & 0 deletions src/script/rabbitmq_setup/Dockerfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should: If possible, I would like to use an image from dockerhub rather than build our own. Do we know of any that give us what we want (STOMP plugin etc.)?

Paging @DiamondJoseph

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM rabbitmq:3.13.2-management
RUN rabbitmq-plugins enable rabbitmq_stomp
COPY rabbitmq.conf /etc/rabbitmq/rabbitmq.conf
10 changes: 10 additions & 0 deletions src/script/rabbitmq_setup/rabbitmq.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
loopback_users = none
listeners.tcp.default = 5672
default_pass = admin
default_user = admin
hipe_compile = false
management.listener.port = 15672
management.listener.ssl = false
stomp.listeners.tcp.1 = 61613
stomp.default_user = admin
stomp.default_pass = admin
15 changes: 15 additions & 0 deletions src/script/start_rabbitmq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
cmd1='build -t rabbitmq-stomp ./rabbitmq_setup/.'
cmd2='run -p 5672:5672 -p 15672:15672 -p 61613:61613 rabbitmq-stomp'

echo "Checking docker/podman installation"
if command -v docker &> /dev/null; then
docker $cmd1
docker $cmd2
elif command -v podman &> /dev/null; then
podman $cmd1
podman $cmd2
else
echo "Docker/Podman installation not found. Please install docker/podman."
exit 1
fi
7 changes: 7 additions & 0 deletions src/script/stomp_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
stomp:
host: "localhost"
port: "61613"
Relm-Arrowny marked this conversation as resolved.
Show resolved Hide resolved
auth:
username: "admin"
password: "admin"
Loading