diff --git a/deploy/docker/scripts/run-nginx.sh b/deploy/docker/scripts/run-nginx.sh index da2bfad75a..7b9d5b09ba 100755 --- a/deploy/docker/scripts/run-nginx.sh +++ b/deploy/docker/scripts/run-nginx.sh @@ -1,11 +1,6 @@ #!/bin/bash NGINX_SSL_CMNT="#" -ENV_PATH="/appsmith-stacks/configuration/docker.env" -echo 'Load environment configuration' -set -o allexport -. "$ENV_PATH" -set +o allexport TEMPLATE_DIR="/opt/appsmith/templates" APP_TEMPLATE="$TEMPLATE_DIR/nginx-app-http.conf.template.sh" @@ -25,4 +20,4 @@ bash "$APP_TEMPLATE" "$APPSMITH_CUSTOM_DOMAIN" >"/etc/nginx/conf.d/nginx_app.con echo "Generating nginx configuration" cat /etc/nginx/conf.d/nginx_app.conf.template | envsubst "$(printf '$%s,' $(env | grep -Eo '^APPSMITH_[A-Z0-9_]+'))" | sed -e 's|\${\(APPSMITH_[A-Z0-9_]*\)}||g' >/etc/nginx/sites-available/default -exec nginx -g "daemon off;" \ No newline at end of file +exec nginx -g "daemon off;" diff --git a/deploy/docker/scripts/run-with-env.sh b/deploy/docker/scripts/run-with-env.sh new file mode 100755 index 0000000000..9e8402b12d --- /dev/null +++ b/deploy/docker/scripts/run-with-env.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +ENV_PATH="/appsmith-stacks/configuration/docker.env" +echo 'Load environment configuration' +set -o allexport +. "$ENV_PATH" +set +o allexport + +if [[ -z "${APPSMITH_MAIL_ENABLED}" ]]; then + unset APPSMITH_MAIL_ENABLED # If this field is empty is might cause application crash +fi + +if [[ -z "${APPSMITH_OAUTH2_GITHUB_CLIENT_ID}" ]] || [[ -z "${APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET}" ]]; then + unset APPSMITH_OAUTH2_GITHUB_CLIENT_ID # If this field is empty is might cause application crash + unset APPSMITH_OAUTH2_GITHUB_CLIENT_SECRET +fi + +if [[ -z "${APPSMITH_OAUTH2_GOOGLE_CLIENT_ID}" ]] || [[ -z "${APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET}" ]]; then + unset APPSMITH_OAUTH2_GOOGLE_CLIENT_ID # If this field is empty is might cause application crash + unset APPSMITH_OAUTH2_GOOGLE_CLIENT_SECRET +fi + +if [[ -z "${APPSMITH_GOOGLE_MAPS_API_KEY}" ]]; then + unset APPSMITH_GOOGLE_MAPS_API_KEY +fi + +if [[ -z "${APPSMITH_RECAPTCHA_SITE_KEY}" ]] || [[ -z "${APPSMITH_RECAPTCHA_SECRET_KEY}" ]] || [[ -z "${APPSMITH_RECAPTCHA_ENABLED}" ]]; then + unset APPSMITH_RECAPTCHA_SITE_KEY # If this field is empty is might cause application crash + unset APPSMITH_RECAPTCHA_SECRET_KEY + unset APPSMITH_RECAPTCHA_ENABLED +fi + +exec "$@" diff --git a/deploy/docker/templates/supervisord/application_process/backend.conf b/deploy/docker/templates/supervisord/application_process/backend.conf index ecb18f7945..a76ec18d28 100644 --- a/deploy/docker/templates/supervisord/application_process/backend.conf +++ b/deploy/docker/templates/supervisord/application_process/backend.conf @@ -1,6 +1,6 @@ [program:backend] directory=/opt/appsmith/backend -command=java -Dserver.port=8080 -Djava.security.egd='file:/dev/./urandom' -jar server.jar +command=/opt/appsmith/run-with-env.sh java -Dserver.port=8080 -Djava.security.egd='file:/dev/./urandom' -jar server.jar priority=15 autostart=true autorestart=true @@ -13,4 +13,4 @@ stderr_logfile_maxbytes=10MB stdout_logfile_backups=5 stderr_logfile_backups=5 stdout_events_enabled=true -stderr_events_enabled=true \ No newline at end of file +stderr_events_enabled=true diff --git a/deploy/docker/templates/supervisord/application_process/editor.conf b/deploy/docker/templates/supervisord/application_process/editor.conf index 9011f851b1..1a584c43d6 100644 --- a/deploy/docker/templates/supervisord/application_process/editor.conf +++ b/deploy/docker/templates/supervisord/application_process/editor.conf @@ -1,5 +1,5 @@ [program:editor] -command=/opt/appsmith/run-nginx.sh +command=/opt/appsmith/run-with-env.sh /opt/appsmith/run-nginx.sh priority=25 autostart=true autorestart=true @@ -13,4 +13,4 @@ stdout_logfile_backups=5 stderr_logfile_backups=5 stdout_events_enabled=true stderr_events_enabled=true -stopsignal=QUIT \ No newline at end of file +stopsignal=QUIT diff --git a/deploy/docker/templates/supervisord/application_process/rts.conf b/deploy/docker/templates/supervisord/application_process/rts.conf index b0964c1eb1..52989bd3ad 100644 --- a/deploy/docker/templates/supervisord/application_process/rts.conf +++ b/deploy/docker/templates/supervisord/application_process/rts.conf @@ -1,6 +1,6 @@ [program:rts] directory=/opt/appsmith/rts -command=node server.js +command=/opt/appsmith/run-with-env.sh node server.js priority=20 autostart=true autorestart=true @@ -13,4 +13,4 @@ stderr_logfile_maxbytes=10MB stdout_logfile_backups=5 stderr_logfile_backups=5 stdout_events_enabled=true -stderr_events_enabled=true \ No newline at end of file +stderr_events_enabled=true