diff --git a/Dockerfile b/Dockerfile index 678f4f3e5a..c6b096d552 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,9 +67,9 @@ COPY ./deploy/docker/templates/nginx/* \ templates/ # Add bootstrapfile -COPY ./deploy/docker/entrypoint.sh ./deploy/docker/scripts/* ./ +COPY ./deploy/docker/entrypoint.sh ./deploy/docker/scripts/* ./scripts/start-backend.sh ./ -# Add uitl tools +# Add util tools COPY ./deploy/docker/utils ./utils RUN cd ./utils && npm install && npm install -g . @@ -81,7 +81,7 @@ COPY ./deploy/docker/templates/supervisord/ templates/supervisord/ COPY ./deploy/docker/templates/cron.d /etc/cron.d/ RUN chmod 0644 /etc/cron.d/* -RUN chmod +x entrypoint.sh renew-certificate.sh healthcheck.sh +RUN chmod +x entrypoint.sh renew-certificate.sh healthcheck.sh start-backend.sh # Disable setuid/setgid bits for the files inside container. RUN find / \( -path /proc -prune \) -o \( \( -perm -2000 -o -perm -4000 \) -print -exec chmod -s '{}' + \) || true diff --git a/deploy/docker/templates/supervisord/application_process/backend.conf b/deploy/docker/templates/supervisord/application_process/backend.conf index 6f359d401f..ff582463b0 100644 --- a/deploy/docker/templates/supervisord/application_process/backend.conf +++ b/deploy/docker/templates/supervisord/application_process/backend.conf @@ -1,7 +1,7 @@ [program:backend] directory=/opt/appsmith/backend -command=/opt/appsmith/run-with-env.sh /opt/appsmith/run-java.sh -priority=15 +command=/opt/appsmith/start-backend.sh +priority=20 autostart=true autorestart=true startsecs=10 diff --git a/deploy/docker/templates/supervisord/application_process/rts.conf b/deploy/docker/templates/supervisord/application_process/rts.conf index 4cfe4046df..fbf4283aab 100644 --- a/deploy/docker/templates/supervisord/application_process/rts.conf +++ b/deploy/docker/templates/supervisord/application_process/rts.conf @@ -1,7 +1,7 @@ [program:rts] directory=/opt/appsmith/rts command=/opt/appsmith/run-with-env.sh node server.js -priority=20 +priority=15 autostart=true autorestart=true startsecs=0 diff --git a/scripts/start-backend.sh b/scripts/start-backend.sh new file mode 100644 index 0000000000..28c96ec35c --- /dev/null +++ b/scripts/start-backend.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -o errexit + +# Wait until RTS started and listens on port 8091 +while ! curl --fail --silent localhost/rts-api/v1/health-check; do + echo 'Waiting for RTS to start ...' + sleep 1 +done +echo 'RTS started.' + +# Start server. +echo 'Starting Backend server...' +exec /opt/appsmith/run-with-env.sh /opt/appsmith/run-java.sh