Skip to content

Commit

Permalink
Include convenience bash script for running rabbit mq locally (#668)
Browse files Browse the repository at this point in the history
fix #615
  • Loading branch information
Relm-Arrowny authored Nov 4, 2024
1 parent a33daa2 commit 5abe34a
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/tutorials/dev-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Ensure you are inside your virtual environment:
source venv/bin/activate
```

You will need to follow the instructions for setting up ActiveMQ as in [run cli instructions](../how-to/run-cli.md).
You will need to follow the instructions for setting up RabbitMQ as in [run cli instructions](../how-to/run-cli.md).

The worker will be available from the command line (`blueapi serve`), but can be started from vscode with additional
debugging capabilities.
Expand Down
20 changes: 12 additions & 8 deletions docs/tutorials/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ 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:

```
docker run -it --rm --net host rmohr/activemq:5.15.9-alpine
```

```
podman run -it --rm --net host rmohr/activemq:5.15.9-alpine
src/script/start_rabbitmq.sh
```

## Start Worker
Expand All @@ -31,6 +27,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
```

## 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 +43,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)
1 change: 1 addition & 0 deletions src/script/rabbitmq_setup/enabled_plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[rabbitmq_management,rabbitmq_prometheus,rabbitmq_stomp].
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 )
RABBITMQ_VERSION="rabbitmq:management"
cmd1='run -it --rm --name rabbitmq -v '\
$SCRIPT_DIR'/rabbitmq_setup/enabled_plugins:/etc/rabbitmq/enabled_plugins'\
' -p 5672:5672 -p 15672:15672 -p 61613:61613 '$RABBITMQ_VERSION

echo "Checking docker/podman installation"
if command -v docker &> /dev/null; then
docker $cmd1
elif command -v podman &> /dev/null; then
podman $cmd1
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"

0 comments on commit 5abe34a

Please sign in to comment.