PromucFlow_constructor/deploy/docker/fs/opt/appsmith/mongodb-fixer.sh
Abhijeet 7e339d419d
test: Enable server tests for the PRs with base PG branch (#33429)
## Description
1. PR to enable server tests on PRs with `pg` as the base branch. 
2. Replace the DB URI from `APPSMITH_MONGODB_URI` to `APPSMITH_DB_URL` 

## Automation

/ok-to-test tags="@tag.Sanity, @tag.GenerateCRUD, @tag.Fork"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9174148396>
> Commit: 762b4255f654946a1a47a196df5a1afae5be09f2
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9174148396&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->












## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No

---------

Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
2024-05-22 15:55:20 +05:30

32 lines
618 B
Bash

#!/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_DB_URL" --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: /'