diff --git a/docker-compose.production.yml b/docker-compose.production.yml index 404158cb..1abcda66 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -58,7 +58,8 @@ services: - ./:/zeppelin environment: DEBUG: ${DEBUG-} - command: ["/bin/bash", "/zeppelin/docker/production/start-api.sh"] + working_dir: /zeppelin/backend + command: ["npm", "run", "start-api-prod"] bot: build: diff --git a/docker/production/start-api.sh b/docker/production/start-api.sh deleted file mode 100755 index b92ee6b7..00000000 --- a/docker/production/start-api.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# This wrapper script is used for two purposes: -# 1. Waiting for the prepare_backend container to finish before starting (see https://github.com/docker/compose/issues/5007#issuecomment-335815508) -# 2. Forwarding signals to the app (see https://unix.stackexchange.com/a/196053) - -# Wait for the backend preparations to finish before continuing -echo "Waiting for prepare_backend to finish before starting the API..." -while ping -c1 prepare_backend &>/dev/null; do sleep 1; done; - -cd /zeppelin/backend -if [ -n "$DEBUG" ]; then - echo "Starting API in debug mode" - exec env NO_INSIGHT=true npm run start-api-prod-debug -else - echo "Starting API" - exec npm run start-api-prod -fi diff --git a/docker/production/start-bot.sh b/docker/production/start-bot.sh index f8b8bacc..37e34d11 100644 --- a/docker/production/start-bot.sh +++ b/docker/production/start-bot.sh @@ -1,17 +1,12 @@ #!/bin/bash -# This wrapper script is used for two purposes: -# 1. Waiting for the prepare_backend container to finish before starting (see https://github.com/docker/compose/issues/5007#issuecomment-335815508) -# 2. Forwarding signals to the app (see https://unix.stackexchange.com/a/196053) - -# Wait for the backend preparations to finish before continuing -echo "Waiting for prepare_backend to finish before starting the bot..." -while ping -c1 prepare_backend &>/dev/null; do sleep 1; done; +# This wrapper script is used to run different things based on the DEBUG env variable +# Exec is used to forward signals: https://unix.stackexchange.com/a/196053 cd /zeppelin/backend if [ -n "$DEBUG" ]; then - echo "Starting bot in debug mode" - exec env NO_INSIGHT=true npm run start-bot-prod-debug + echo "DEBUG MODE: Starting bot container without starting the bot" + exec tail -f /dev/null else echo "Starting bot" exec npm run start-bot-prod