From 2d105e47a2b10cb2a4518d5a9f5b1d8c91b5e51e Mon Sep 17 00:00:00 2001 From: brooke Date: Wed, 12 Feb 2025 19:28:21 -0500 Subject: [PATCH] add rabbitmq entrypoint, fix config permission --- compose.yml | 14 ++++++++------ entryopoint.rabbitmq.sh.tmpl | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 entryopoint.rabbitmq.sh.tmpl diff --git a/compose.yml b/compose.yml index 4bbc6d0..f0b1a0f 100644 --- a/compose.yml +++ b/compose.yml @@ -8,7 +8,7 @@ services: configs: - source: entrypoint target: /custom-entrypoint.sh - mode: 555 + mode: 0555 entrypoint: /custom-entrypoint.sh environment: DB_HOST: "database" @@ -61,7 +61,7 @@ services: configs: - source: pg_backup target: /pg_backup.sh - mode: 555 + mode: 0555 healthcheck: test: [ "CMD-SHELL", "pg_isready" ] interval: 10s @@ -81,7 +81,7 @@ services: configs: - source: memcached_entrypoint target: /custom-entrypoint.sh - mode: 555 + mode: 0555 entrypoint: /custom-entrypoint.sh secrets: - memcached_password @@ -95,11 +95,13 @@ services: image: "rabbitmq:4.0.6" environment: RABBITMQ_DEFAULT_USER: "zulip" - RABBITMQ_DEFAULT_PASS_FILE: "/run/secrets/rabbitmq_password" configs: - source: rabbitmq_healthcheck target: /healthcheck.sh - mode: 555 + mode: 0555 + - source: rabbitmq_entrypoint + target: /custom-entrypoint.sh + mode: 0555 secrets: - rabbitmq_password volumes: @@ -117,7 +119,7 @@ services: configs: - source: redis_entrypoint target: /custom-entrypoint.sh - mode: 555 + mode: 0555 entrypoint: /custom-entrypoint.sh secrets: - redis_password diff --git a/entryopoint.rabbitmq.sh.tmpl b/entryopoint.rabbitmq.sh.tmpl new file mode 100644 index 0000000..4a7c263 --- /dev/null +++ b/entryopoint.rabbitmq.sh.tmpl @@ -0,0 +1,17 @@ +#!/bin/sh + +if [ -f /run/secrets/memcached_password ]; then + export MEMCACHED_PASSWORD=$(cat /run/secrets/memcached_password) +else + echo "Membcached password secret not found, skipping." +fi + + +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- memcached "$@" +fi + +exec "$@" \ No newline at end of file