diff --git a/codefresh/Chart.yaml b/codefresh/Chart.yaml index 939102a5f..db62bb102 100644 --- a/codefresh/Chart.yaml +++ b/codefresh/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 description: Helm Chart for Codefresh On-Prem name: codefresh -version: 2.8.2 +version: 2.8.3 keywords: - codefresh home: https://codefresh.io/ @@ -19,7 +19,7 @@ annotations: # supported kinds are added, changed, deprecated, removed, fixed and security. artifacthub.io/changes: | - kind: fixed - description: "Fix createDB function in postgres seed job" + description: "Fix mongo seed job to support Atlas" dependencies: - name: cf-common repository: oci://quay.io/codefresh/charts diff --git a/codefresh/README.md b/codefresh/README.md index 2efd0b612..91d4d5033 100644 --- a/codefresh/README.md +++ b/codefresh/README.md @@ -1,6 +1,6 @@ ## Codefresh On-Premises -![Version: 2.8.2](https://img.shields.io/badge/Version-2.8.2-informational?style=flat-square) ![AppVersion: 2.8.0](https://img.shields.io/badge/AppVersion-2.8.0-informational?style=flat-square) +![Version: 2.8.3](https://img.shields.io/badge/Version-2.8.3-informational?style=flat-square) ![AppVersion: 2.8.0](https://img.shields.io/badge/AppVersion-2.8.0-informational?style=flat-square) Helm chart for deploying [Codefresh On-Premises](https://codefresh.io/docs/docs/getting-started/intro-to-codefresh/) to Kubernetes. @@ -227,33 +227,13 @@ However, you might need to use external services like [MongoDB Atlas Database](h #### External MongoDB -> ⚠️ **Important!** If you use MongoDB Atlas, you must create the following databases in advance before installing Codefresh: - -```console -archive -audit -charts-manager -cluster-providers -codefresh -context-manager -gitops-dashboard-manager -k8s-monitor -pipeline-manager -platform-analytics-postgres -read-models -runtime-environment-manager -onboarding-status -payments -``` - -> You alse need to create a database user with `Write` permissions to ALL databases.
+> ⚠️ **Important!** If you use MongoDB Atlas, you must create user with `Write` permissions before installing Codefresh:
> Then, provide the user credentials in the chart values at
`.Values.global.mongodbUser/mongodbRootUserSecretKeyRef`
`.Values.global.mongodbPassword/mongodbRootPasswordSecretKeyRef`
`.Values.seed.mongoSeedJob.mongodbRootUser/mongodbRootUserSecretKeyRef`
`.Values.seed.mongoSeedJob.mongodbRootPassword/mongodbRootPasswordSecretKeyRef`
> Ref:
-> [Create Database in Atlas](https://www.mongodb.com/docs/atlas/atlas-ui/databases/#create-a-database)
> [Create Users in Atlas](https://www.mongodb.com/docs/atlas/security-add-mongodb-users/#configure-database-users) `values.yaml` for external MongoDB: diff --git a/codefresh/README.md.gotmpl b/codefresh/README.md.gotmpl index f98f7c26a..4492db31b 100644 --- a/codefresh/README.md.gotmpl +++ b/codefresh/README.md.gotmpl @@ -228,36 +228,15 @@ However, you might need to use external services like [MongoDB Atlas Database](h #### External MongoDB -> ⚠️ **Important!** If you use MongoDB Atlas, you must create the following databases in advance before installing Codefresh: - -```console -archive -audit -charts-manager -cluster-providers -codefresh -context-manager -gitops-dashboard-manager -k8s-monitor -pipeline-manager -platform-analytics-postgres -read-models -runtime-environment-manager -onboarding-status -payments -``` - -> You alse need to create a database user with `Write` permissions to ALL databases.
+> ⚠️ **Important!** If you use MongoDB Atlas, you must create user with `Write` permissions before installing Codefresh:
> Then, provide the user credentials in the chart values at
`.Values.global.mongodbUser/mongodbRootUserSecretKeyRef`
`.Values.global.mongodbPassword/mongodbRootPasswordSecretKeyRef`
`.Values.seed.mongoSeedJob.mongodbRootUser/mongodbRootUserSecretKeyRef`
`.Values.seed.mongoSeedJob.mongodbRootPassword/mongodbRootPasswordSecretKeyRef`
> Ref:
-> [Create Database in Atlas](https://www.mongodb.com/docs/atlas/atlas-ui/databases/#create-a-database)
> [Create Users in Atlas](https://www.mongodb.com/docs/atlas/security-add-mongodb-users/#configure-database-users) - `values.yaml` for external MongoDB: ```yaml diff --git a/codefresh/files/mongoSeedJobScript.sh b/codefresh/files/mongoSeedJobScript.sh index bf6878cc0..6762bad5c 100644 --- a/codefresh/files/mongoSeedJobScript.sh +++ b/codefresh/files/mongoSeedJobScript.sh @@ -115,6 +115,9 @@ for MONGODB_DATABASE in ${MONGODB_DATABASES[@]}; do mongosh ${MONGODB_ROOT_URI} ${MONGO_URI_EXTRA_PARAMS} --eval "db.getSiblingDB(\"${MONGODB_DATABASE}\").createUser({user: \"${MONGODB_USER}\", pwd: \"${MONGODB_PASSWORD}\", roles: [\"readWrite\"]})" 2>&1 || true waitForMongoDB mongosh ${MONGODB_ROOT_URI} ${MONGO_URI_EXTRA_PARAMS} --eval "db.getSiblingDB(\"${MONGODB_DATABASE}\").changeUserPassword(\"${MONGODB_USER}\",\"${MONGODB_PASSWORD}\")" 2>&1 || true + + # MongoDB Atlas + mongosh ${MONGODB_ROOT_URI} ${MONGO_URI_EXTRA_PARAMS} --eval "db = db.getSiblingDB(\"${MONGODB_DATABASE}\"); db[\"${MONGODB_DATABASE}\"].insertOne({ name: \"init\", value: true })" 2>&1 || true done mongosh ${MONGODB_ROOT_URI} ${MONGO_URI_EXTRA_PARAMS} --eval "db.getSiblingDB(\"codefresh\").grantRolesToUser( \"${MONGODB_USER}\", [ { role: \"readWrite\", db: \"pipeline-manager\" } ] )" 2>&1 || true