diff --git a/Dockerfile b/Dockerfile index 9b4a29f641..25da3b208b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -92,7 +92,7 @@ ENV PATH /opt/appsmith/utils/node_modules/.bin:/opt/java/bin:/opt/node/bin:$PATH RUN cd ./utils && npm install --only=prod && npm install --only=prod -g . && cd - \ && chmod 0644 /etc/cron.d/* \ - && chmod +x entrypoint.sh renew-certificate.sh healthcheck.sh templates/nginx-app.conf.sh /watchtower-hooks/*.sh \ + && chmod +x *.sh templates/nginx-app.conf.sh /watchtower-hooks/*.sh \ # Disable setuid/setgid bits for the files inside container. && find / \( -path /proc -prune \) -o \( \( -perm -2000 -o -perm -4000 \) -print -exec chmod -s '{}' + \) || true \ && node prepare-image.mjs diff --git a/deploy/docker/fs/opt/appsmith/entrypoint.sh b/deploy/docker/fs/opt/appsmith/entrypoint.sh index 7eee9ea9dd..6001de8d7e 100644 --- a/deploy/docker/fs/opt/appsmith/entrypoint.sh +++ b/deploy/docker/fs/opt/appsmith/entrypoint.sh @@ -167,6 +167,8 @@ init_mongodb() { openssl rand -base64 756 > "$MONGO_DB_KEY" fi use-mongodb-key "$MONGO_DB_KEY" + + ./mongodb-fixer.sh & fi } diff --git a/deploy/docker/fs/opt/appsmith/mongodb-fixer.sh b/deploy/docker/fs/opt/appsmith/mongodb-fixer.sh new file mode 100644 index 0000000000..9d070d4e29 --- /dev/null +++ b/deploy/docker/fs/opt/appsmith/mongodb-fixer.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -o errexit +set -o nounset + +{ + +while [[ ! -S "$TMP/supervisor.sock" ]]; do + sleep 1 +done +echo "supervisor.sock found" + +while supervisorctl status mongodb | grep -q RUNNING; do + sleep 1 +done +echo "MongoDB is RUNNING" + +for _ in {1..60}; do + if mongosh --quiet "$APPSMITH_MONGODB_URI" --eval ' + parseFloat(db.adminCommand({getParameter: 1, featureCompatibilityVersion: 1}).featureCompatibilityVersion.version) < 5 && + db.adminCommand({setFeatureCompatibilityVersion: "5.0"}) + '; then + echo "MongoDB version set to 5.0" + break + fi + sleep 1 +done + +echo Done + +} | sed -u 's/^/mongodb-fixer: /'