Skip to content
Snippets Groups Projects
start.sh 1.05 KiB
Newer Older
Felix Delattre's avatar
Felix Delattre committed
#!/bin/sh

if [ -z "$RABOTNIK_MESSAGE_BUS_PASSWORD" ]; then
  echo "environment variable RABOTNIK_MESSAGE_BUS_PASSWORD not defined"
elif [ -z "$RABOTNIK_MESSAGE_BUS_USER" ]; then
  echo "environment variable RABOTNIK_MESSAGE_BUS_USER not defined"
fi

Felix Delattre's avatar
Felix Delattre committed
# Create a user for rabbitmq
( rabbitmqctl wait --timeout 60 "$RABBITMQ_PID_FILE" ; \
rabbitmqctl add_user "$RABOTNIK_MESSAGE_BUS_USER" "$RABOTNIK_MESSAGE_BUS_PASSWORD" 2>/dev/null ; \
rabbitmqctl set_user_tags "$RABOTNIK_MESSAGE_BUS_USER" administrator ; \
rabbitmqctl set_permissions -p / "$RABOTNIK_MESSAGE_BUS_USER"  ".*" ".*" ".*" ; \
echo "*** User '$RABOTNIK_MESSAGE_BUS_USER' with password '$RABOTNIK_MESSAGE_BUS_PASSWORD' completed. ***" ; \
Felix Delattre's avatar
Felix Delattre committed
echo "*** Log in the WebUI at port 15672 (example: http://localhost:15672) ***") &

rabbitmq-plugins enable rabbitmq_mqtt
# $@ is used to pass arguments to the rabbitmq-server command.
# For example if you use it like this: docker run -d rabbitmq arg1 arg2,
# it will be as you run in the container rabbitmq-server arg1 arg2
# shellcheck disable=SC2068
Felix Delattre's avatar
Felix Delattre committed
rabbitmq-server $@