From d32fe8c0778b8a1dc498d5a4d10e88d8631d52b2 Mon Sep 17 00:00:00 2001 From: BlackYps <52536103+BlackYps@users.noreply.github.com> Date: Mon, 8 Nov 2021 12:08:39 +0100 Subject: [PATCH] Fix local setup (#41) --- .github/workflows/test.yml | 2 +- README.md | 2 +- scripts/local_rabbitmq.sh | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 scripts/local_rabbitmq.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d2b8822..695a98a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: MYSQL_PASSWORD: banana faf-rabbitmq: - image: rabbitmq:3-alpine + image: rabbitmq:3.8-management-alpine ports: - 5672:5672 options: >- diff --git a/README.md b/README.md index ddef58a..3cf108c 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ and running `scripts/init-db.sh` should set this up. Additionally, the service needs a running RabbitMQ server, which can be started -via docker by running `ci/init-rabbitmq.sh`. +via docker by running `scripts/local-rabbitmq.sh`. This starts a RabbitMQ server on vhost `/faf-lobby`. ## Setting up for development diff --git a/scripts/local_rabbitmq.sh b/scripts/local_rabbitmq.sh new file mode 100644 index 0000000..323a257 --- /dev/null +++ b/scripts/local_rabbitmq.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +RABBITMQ_PID_FILE=/var/lib/rabbitmq/pid +RABBITMQ_DEFAULT_USER=admin +RABBITMQ_DEFAULT_PASS=banana +RABBITMQ_DEFAULT_VHOST=/ +MAX_WAIT_SECONDS=30 +RABBITMQ_LEAGUE_SERVICE_USER=faf-league-service +RABBITMQ_LEAGUE_SERVICE_PASS=banana +RABBITMQ_LEAGUE_SERVICE_VHOST=/faf-lobby + +docker run -d -p 5672:5672 --restart unless-stopped --name faf-rabbitmq rabbitmq:3.8-management-alpine + +# This doesn't seem to pick up the pid file +docker exec faf-rabbitmq rabbitmqctl wait --timeout ${MAX_WAIT_SECONDS} "${RABBITMQ_PID_FILE}" +# Create RabbitMQ users +docker exec faf-rabbitmq rabbitmqctl add_vhost "${RABBITMQ_LEAGUE_SERVICE_VHOST}" +docker exec faf-rabbitmq rabbitmqctl add_user "${RABBITMQ_LEAGUE_SERVICE_USER}" "${RABBITMQ_LEAGUE_SERVICE_PASS}" +docker exec faf-rabbitmq rabbitmqctl set_permissions -p "${RABBITMQ_LEAGUE_SERVICE_VHOST}" "${RABBITMQ_LEAGUE_SERVICE_USER}" ".*" ".*" ".*" + +