From 1665fc2442dad94e411aaf5d0d17320d19a640d7 Mon Sep 17 00:00:00 2001 From: davwas Date: Wed, 17 Apr 2024 12:29:10 +0200 Subject: [PATCH] BC-6654 - Update mongo to v5 (#70) * update mongo version * remove enableMajorityReadConcern * remove readPreference --- compose-files/docker-compose.yml | 24 +++++++++++------------- envs/default.env | 2 +- scripts/mongo_setup.sh | 6 +++--- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/compose-files/docker-compose.yml b/compose-files/docker-compose.yml index 5622bd2..f1452bd 100644 --- a/compose-files/docker-compose.yml +++ b/compose-files/docker-compose.yml @@ -20,8 +20,8 @@ services: ### Schul-Cloud Server ### - mongodb: - image: mongo:4.2.9 ## change tag in version.env + mongodb-primary: + image: mongo:5.0.26 ## change tag in version.env container_name: mongodb-primary ports: - "27017:27017" @@ -31,10 +31,10 @@ services: - mongodb-secondary - mongodb-arbiter restart: unless-stopped - command: --bind_ip_all --replSet rs0 --enableMajorityReadConcern false + command: --bind_ip_all --replSet rs0 mongodb-secondary: - image: mongo:4.2.9 ## change tag in version.env + image: mongo:5.0.26 ## change tag in version.env container_name: mongodb-secondary ports: - "27017" @@ -42,10 +42,10 @@ services: volumes: - data-mongodb-secondary:/data/db restart: unless-stopped - command: --bind_ip_all --replSet rs0 --enableMajorityReadConcern false + command: --bind_ip_all --replSet rs0 mongodb-arbiter: - image: mongo:4.2.9 ## change tag in version.env + image: mongo:5.0.26 ## change tag in version.env container_name: mongodb-arbiter ports: - "27017" @@ -53,12 +53,12 @@ services: volumes: - data-mongodb-arbiter:/data/db restart: unless-stopped - command: --bind_ip_all --replSet rs0 --enableMajorityReadConcern false + command: --bind_ip_all --replSet rs0 mongosetup: - image: mongo:4.2.9 + image: mongo:5.0.26 depends_on: - - mongodb + - mongodb-primary - mongodb-secondary - mongodb-arbiter volumes: @@ -146,8 +146,7 @@ services: - CLAMAV__SERVICE_HOSTNAME=localhost - CLAMAV__SERVICE_PORT=3310 # URIs and Port - - DB_URL=mongodb://mongodb:27017,mongodb-secondary:27017,mongodb-arbiter:27017/schulcloud?replicaSet=rs0&tls=false&readPreference=secondary - - DATABASE__URL=mongodb://server-mongodb:27017/schulcloud + - DB_URL=mongodb://mongodb-primary:27017,mongodb-secondary:27017,mongodb-arbiter:27017/schulcloud?replicaSet=rs0&tls=false - REDIS_URI=redis://redis:6379 - RABBITMQ_URI=amqp://guest:guest@rabbit:5672 - CONTENT_URI=https://consent.schul-cloud.org #lernstore @@ -207,8 +206,7 @@ services: - FILES_STORAGE__S3_BUCKET=schulcloud - FILES_STORAGE__S3_REGION=eu-central-1 # URIs and Port - - DB_URL=mongodb://mongodb:27017,mongodb-secondary:27017,mongodb-arbiter:27017/schulcloud?replicaSet=rs0&tls=false&readPreference=secondary - - DATABASE__URL=mongodb://server-mongodb:27017/schulcloud + - DB_URL=mongodb://mongodb-primary:27017,mongodb-secondary:27017,mongodb-arbiter:27017/schulcloud?replicaSet=rs0&tls=false - REDIS_URI=redis://redis:6379 - RABBITMQ_URI=amqp://guest:guest@rabbit:5672 - CONTENT_URI=https://consent.schul-cloud.org #lernstore diff --git a/envs/default.env b/envs/default.env index 6008389..8ae38a8 100644 --- a/envs/default.env +++ b/envs/default.env @@ -4,5 +4,5 @@ COMPOSE_FILES_PATH=./compose-files POSTGRES_DOCKER_TAG=11.9 REDIS_DOCKER_TAG=6.0.8 -MONGO_DOCKER_TAG=4.2.9 +MONGO_DOCKER_TAG=5.0.26 RABBITMQ_DOCKER_TAG=3.8.9-management diff --git a/scripts/mongo_setup.sh b/scripts/mongo_setup.sh index 3c3545c..c21e9b7 100644 --- a/scripts/mongo_setup.sh +++ b/scripts/mongo_setup.sh @@ -2,15 +2,15 @@ sleep 10 echo SETUP.sh time now: `date +"%T" ` -mongo --host mongodb:27017 --eval 'rs.initiate({_id: "rs0", members: [{_id: 0, host: "mongodb:27017" }]})' -mongo --host mongodb:27017 << EOF +mongo --host mongodb-primary:27017 --eval 'rs.initiate({_id: "rs0", members: [{_id: 0, host: "mongodb-primary:27017" }]})' +mongo --host mongodb-primary:27017 << EOF var cfg = { "_id": "rs0", "version": 1, "members": [ { "_id": 0, - "host": "mongodb:27017", + "host": "mongodb-primary:27017", "priority": 2, "votes": 1 },