chore: Update embedded MongoDB Schema version (#27985)

This commit is contained in:
Shrikant Sharat Kandula 2023-10-17 06:28:45 +05:30 committed by GitHub
parent 8fd8e32cd2
commit afd03a526d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 1 deletions

View File

@ -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

View File

@ -167,6 +167,8 @@ init_mongodb() {
openssl rand -base64 756 > "$MONGO_DB_KEY"
fi
use-mongodb-key "$MONGO_DB_KEY"
./mongodb-fixer.sh &
fi
}

View File

@ -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: /'