mirror of https://github.com/zulip/zulip.git
configure-rabbitmq: Allow running as root.
This makes it possible to run this in production without access to sudo.
This commit is contained in:
parent
4c3c669b41
commit
042893a448
|
@ -11,9 +11,16 @@ if [ -n "$RABBITMQ_NODE" ]; then
|
|||
fi
|
||||
RABBITMQ_USERNAME=$("$(dirname "$0")/../get-django-setting" RABBITMQ_USERNAME)
|
||||
RABBITMQ_PASSWORD=$("$(dirname "$0")/../get-django-setting" RABBITMQ_PASSWORD)
|
||||
sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" delete_user "$RABBITMQ_USERNAME" || true
|
||||
sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" delete_user zulip || true
|
||||
sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" delete_user guest || true
|
||||
sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" add_user "$RABBITMQ_USERNAME" "$RABBITMQ_PASSWORD"
|
||||
sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" set_user_tags "$RABBITMQ_USERNAME" administrator
|
||||
sudo rabbitmqctl "${RABBITMQ_FLAGS[@]}" set_permissions -p / "$RABBITMQ_USERNAME" '.*' '.*' '.*'
|
||||
|
||||
if [ "$EUID" -eq 0 ]; then
|
||||
RABBITMQCTL_COMMAND="rabbitmqctl"
|
||||
else
|
||||
RABBITMQCTL_COMMAND="sudo rabbitmqctl"
|
||||
fi
|
||||
|
||||
$RABBITMQCTL_COMMAND "${RABBITMQ_FLAGS[@]}" delete_user "$RABBITMQ_USERNAME" || true
|
||||
$RABBITMQCTL_COMMAND "${RABBITMQ_FLAGS[@]}" delete_user zulip || true
|
||||
$RABBITMQCTL_COMMAND "${RABBITMQ_FLAGS[@]}" delete_user guest || true
|
||||
$RABBITMQCTL_COMMAND "${RABBITMQ_FLAGS[@]}" add_user "$RABBITMQ_USERNAME" "$RABBITMQ_PASSWORD"
|
||||
$RABBITMQCTL_COMMAND "${RABBITMQ_FLAGS[@]}" set_user_tags "$RABBITMQ_USERNAME" administrator
|
||||
$RABBITMQCTL_COMMAND "${RABBITMQ_FLAGS[@]}" set_permissions -p / "$RABBITMQ_USERNAME" '.*' '.*' '.*'
|
||||
|
|
Loading…
Reference in New Issue