-
Notifications
You must be signed in to change notification settings - Fork 4.6k
chore(mongo): upgrade embedded MongoDB from 6.0 to 7.0 #41743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release
Are you sure you want to change the base?
Changes from all commits
cbc5e25
dd2d5ba
f73a3e0
a6a96df
2f95cfe
912ad5d
94805f1
bbe9d84
f4b16d7
2455ab0
33dc825
af34f2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,29 +3,67 @@ | |
| set -o errexit | ||
| set -o nounset | ||
|
|
||
| # Marker file recording the minimum MongoDB featureCompatibilityVersion that | ||
| # this Appsmith release commits to preserve. Written once mongod is confirmed | ||
| # RUNNING under this release; read (presence only) by entrypoint.sh on | ||
| # subsequent boots to fast-path the pre-flight compatibility check. See | ||
| # entrypoint.sh::ensure_mongodb_fcv_compatible. | ||
| # | ||
| # The marker value is a release-level contract, not a live reading of mongod's | ||
| # current FCV. Use `mongosh` if you want the live value. | ||
| MONGO_FCV_MIN_MARKER="/appsmith-stacks/data/mongodb/.appsmith-mongo-fcv-min" | ||
|
|
||
| # Minimum FCV this Appsmith release commits to preserve. We deliberately do | ||
| # NOT raise FCV to 7.0 — keeping it at 6.0 preserves the ability to roll back | ||
| # to a 6.x Appsmith release if something goes wrong. When MongoDB 8 arrives, | ||
| # bump this constant to 7.0; the ensure_fcv_floor block below will handle the | ||
| # `setFeatureCompatibilityVersion` call automatically. | ||
| FCV_MIN="6.0" | ||
|
|
||
| write_fcv_marker() { | ||
| local value="$1" | ||
| local tmp="${MONGO_FCV_MIN_MARKER}.tmp" | ||
| if ! printf '%s\n' "$value" > "$tmp" 2>/dev/null; then | ||
| tlog "warning: failed to write FCV marker temp file" | ||
| return 0 | ||
| fi | ||
| mv -f "$tmp" "$MONGO_FCV_MIN_MARKER" 2>/dev/null || tlog "warning: failed to move FCV marker into place" | ||
| } | ||
|
|
||
| { | ||
|
|
||
| while [[ ! -S "$TMP/supervisor.sock" ]]; do | ||
| sleep 1 | ||
| done | ||
| tlog "supervisor.sock found" | ||
|
|
||
| while supervisorctl status mongodb | grep -q RUNNING; do | ||
| while ! supervisorctl status mongodb | grep -q RUNNING; do | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a max attempt counter here to avoid unbounded looping?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don't get to supervisord at least running, it'll kill the container because the health checks will fail anyway. I think it's not worth the risk of this dying too early. |
||
| sleep 1 | ||
| done | ||
| tlog "MongoDB is RUNNING" | ||
|
|
||
| # Ensure FCV is at the floor this release commits to. In the steady state this | ||
| # is a no-op — entrypoint.sh's pre-flight probe already guarantees mongod won't | ||
| # come up on data below the supported FCV. The check is kept active so the | ||
| # upgrade scaffolding is exercised and the next major-version bump is just a | ||
| # constant change. | ||
| tlog "Ensuring MongoDB featureCompatibilityVersion is at least $FCV_MIN" | ||
| for _ in {1..60}; do | ||
| if mongosh --quiet "$APPSMITH_DB_URL" --eval ' | ||
| parseFloat(db.adminCommand({getParameter: 1, featureCompatibilityVersion: 1}).featureCompatibilityVersion.version) < 6 && | ||
| db.adminCommand({setFeatureCompatibilityVersion: "6.0"}) | ||
| const floor = '"$FCV_MIN"'; | ||
| const current = parseFloat(db.adminCommand({getParameter: 1, featureCompatibilityVersion: 1}).featureCompatibilityVersion.version); | ||
| if (current < floor) { | ||
| db.adminCommand({setFeatureCompatibilityVersion: "'"$FCV_MIN"'", confirm: true}); | ||
| } | ||
| '; then | ||
| tlog "MongoDB version set to 6.0" | ||
| tlog "MongoDB featureCompatibilityVersion floor of $FCV_MIN confirmed" | ||
| break | ||
| fi | ||
| sleep 1 | ||
| done | ||
|
|
||
| tlog "Recording committed FCV minimum: $FCV_MIN" | ||
| write_fcv_marker "$FCV_MIN" | ||
| tlog Done | ||
|
|
||
| } | sed -u 's/^/mongodb-fixer: /' | ||
Uh oh!
There was an error while loading. Please reload this page.