Skip to content

Commit

Permalink
fix(dev-tools): upgrade mongo version
Browse files Browse the repository at this point in the history
  • Loading branch information
Regzox committed Nov 15, 2023
1 parent 34ae91a commit 476e3e4
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 27 deletions.
26 changes: 14 additions & 12 deletions tools/docker/mongo/mongo_cluster.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
version: '3'
version: "3"

services:
mongo-dev:
image: mongo:4.0.6
container_name: vitamui-mongo
image: mongo:7.0.2
container_name:
vitamui-mongo
# environment:
# provide your credentials here
# - MONGO_INITDB_ROOT_USERNAME=root
Expand All @@ -24,8 +25,9 @@ services:
command: mongod --replSet "rs0" --port=27018

mongo-dev2:
image: mongo:4.0.6
container_name: vitamui-mongo2
image: mongo:7.0.2
container_name:
vitamui-mongo2
# environment:
# provide your credentials here
# - MONGO_INITDB_ROOT_USERNAME=root
Expand All @@ -37,28 +39,28 @@ services:
ports:
- "27019:27019"
volumes:
# if you wish to setup additional user accounts specific per DB or with different roles you can use following entry point
# if you wish to setup additional user accounts specific per DB or with different roles you can use following entry point
- "$PWD/mongo-entrypoint/:/scripts/mongo/data"
- "$PWD/replica-set/:/scripts/mongo/replica-set"

# no --auth is needed here as presence of username and password add this option automatically
command: mongod --replSet "rs0" --port=27019

mongo-dev3:
image: mongo:4.0.6
image: mongo:7.0.2
container_name: vitamui-mongo3
# environment:
# provide your credentials here
# - MONGO_INITDB_ROOT_USERNAME=root
# - MONGO_INITDB_ROOT_PASSWORD=rootpwd
# environment:
# provide your credentials here
# - MONGO_INITDB_ROOT_USERNAME=root
# - MONGO_INITDB_ROOT_PASSWORD=rootpwd

networks:
- mongo-cluster

ports:
- "27020:27020"
volumes:
# if you wish to setup additional user accounts specific per DB or with different roles you can use following entry point
# if you wish to setup additional user accounts specific per DB or with different roles you can use following entry point
- "$PWD/mongo-entrypoint/:/scripts/mongo/data"
- "$PWD/replica-set/:/scripts/mongo/replica-set"

Expand Down
4 changes: 2 additions & 2 deletions tools/docker/mongo/mongo_dev.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: '3.5'
version: "3.5"

services:
mongo-dev:
image: mongo:4.0.6
image: mongo:7.0.2
container_name: vitamui-mongo
hostname: vitamui-mongo
# environment:
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/mongo/mongo_vars_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pki_dir: "{{lookup('env','PWD')}}/../../../dev-deployment/environments/certs"
# Overwrite vitamui defaults in order to perform transparent execution of deployment scripts.

gateway:
enabled: true
enabled: false

vitamui_defaults:
folder:
Expand Down
20 changes: 10 additions & 10 deletions tools/docker/mongo/replica-set/000_replicaset_dev.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
rs.initiate({
"_id" : "rs0",
"members" : [
{
"_id" : 0,
"host" : "vitamui-mongo:27018",
"priority": 1,
"slaveDelay" : NumberLong(0),
"votes" : 1
}
]
_id: "rs0",
members: [
{
_id: 0,
host: "vitamui-mongo:27018",
priority: 1,
secondaryDelaySecs: NumberLong(0),
votes: 1,
},
],
});
2 changes: 1 addition & 1 deletion tools/docker/mongo/start_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ docker-compose -f ./mongo_dev.yml up -d
sleep 2

# Create replica set and wait a few before execution other init scripts
docker exec -it vitamui-mongo /bin/bash -c "mongo --port=27018 < /scripts/mongo/replica-set/000_replicaset_dev.js;sleep 5;mongo --port=27018 < /scripts/mongo/replica-set/00_check_replicaset.js"
docker exec -it vitamui-mongo /bin/bash -c "mongosh --port=27018 -f /scripts/mongo/replica-set/000_replicaset_dev.js;sleep 5;mongosh --port=27018 -f /scripts/mongo/replica-set/00_check_replicaset.js"

#########################

Expand Down
2 changes: 1 addition & 1 deletion tools/docker/mongo/start_docker_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ docker-compose -f ./mongo_cluster.yml up -d
sleep 2

# Create replica set and wait a few before execution other init scripts
docker exec -it vitamui-mongo /bin/bash -c "mongo --port=27018 < /scripts/mongo/replica-set/000_replicaset_dev.js;sleep 5;mongo --port=27018 < /scripts/mongo/replica-set/00_check_replicaset.js"
docker exec -it vitamui-mongo /bin/bash -c "mongosh --port=27018 -f /scripts/mongo/replica-set/000_replicaset_dev.js;sleep 5;mongosh --port=27018 -f /scripts/mongo/replica-set/00_check_replicaset.js"

#########################

Expand Down

0 comments on commit 476e3e4

Please sign in to comment.