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

Merged
Show file tree
Hide file tree
Changes from 12 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
22 changes: 19 additions & 3 deletions docs/tutorials/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ Blueapi acts as a worker that can run bluesky plans against devices for a specif
laboratory setup. It can control devices to collect data and export events to tell
downstream services about the data it has collected.

## Start ActiveMQ
## Start RabbitMQ

The worker requires a running instance of ActiveMQ, the simplest
way to start it is to run it via a container:
The worker requires a running instance of RabbitMQ. The easiest way to start it is
to execute the provided script:

```
src/script/start_rabbitmq.sh
Relm-Arrowny marked this conversation as resolved.
Show resolved Hide resolved
```


Alternatively, it is possible to run ActiveMQ via a container:
Relm-Arrowny marked this conversation as resolved.
Show resolved Hide resolved

```
docker run -it --rm --net host rmohr/activemq:5.15.9-alpine
Expand All @@ -17,6 +24,7 @@ way to start it is to run it via a container:
podman run -it --rm --net host rmohr/activemq:5.15.9-alpine
Relm-Arrowny marked this conversation as resolved.
Show resolved Hide resolved
```


## Start Worker

To start the worker:
Expand All @@ -31,6 +39,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
```

Relm-Arrowny marked this conversation as resolved.
Show resolved Hide resolved
## 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 +55,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
Relm-Arrowny marked this conversation as resolved.
Show resolved Hide resolved
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 = guest
default_user = guest
hipe_compile = false
management.listener.port = 15672
management.listener.ssl = false
stomp.listeners.tcp.1 = 61613
stomp.default_user = guest
stomp.default_pass = guest
16 changes: 16 additions & 0 deletions src/script/start_rabbitmq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "$BASH_SOURCE[0]" )" &> /dev/null && pwd )
cmd1='build -t rabbitmq-stomp '$SCRIPT_DIR'/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
auth:
username: "guest"
password: "guest"
Loading