In /opt/zw-vmmc-docker/mongo you need to create mongo-initentrypoint.jssh:
Create file:
Code Block vim /opthome/zw-vmmc-docker/mongo/mongo-init.jsentrypoint.sh chmod +x entrypoint.sh
And paste the next lines:
Code Block #!/bin/sh sleep 20 echo "Restoring databases..." mongorestore --host mongo Init --port 27017 --username <mongo-user> --password <mongo-password> --authenticationDatabase admin --gzip --archive=/backups/db1-backup.gz mongorestore --host mongo --port 27017 --username <mongo-user> --password <mongo-password> --authenticationDatabase admin --gzip --archive=/backups/dbLog-backup.gz mongorestore --host mongo --port 27017 --username <mongo-user> --password <mongo-password> --authenticationDatabase admin --gzip --archive=/backups/dbOthers-backup.gz echo "creating users..." mongosh --host mongo --port 27017 --username gaspar --password gaspar --authenticationDatabase admin <<EOF use admin db.createUser( { user: "<user>", pwd: "<password>", mechanisms: ["SCRAM-SHA-1"], roles: [ { role: "readWrite", db: "db1" }, { role: "readWrite", db: "dbOthers" }, { role: "readWrite", db: "dbLog" }, ] } ); use db1 db.createUser( { user: "<user>", pwd: "<pwd><password>", mechanisms: ["SCRAM-SHA-1"], roles: [ { role: "readWrite", db: "db1" }, { role: "readWrite", db: "dbOthers" }, { role: "readWrite", db: "dbLog" }, ] } ); use dbOthers db.createUser( { user: "<user>", pwd: "<password>", mechanisms: ["SCRAM-SHA-1"], roles: [ { role: "readWrite", db: "db1" }, { role: "readWrite", db: "dbOthers" }, { role: "readWrite", db: "proddbLog" }, ] } ); use dbLog db.createUser( { user: "<user>", pwd: "<password>", mechanisms: ["SCRAM-SHA-1"], roles: [ { role: "readWrite", db: "devdb1" }, { role: "dbAdminreadWrite", db: "devdbOthers" }, { role: "dbAdminreadWrite", db: "proddbLog" }, ] } ); exit
You will need to replace “<user>” and “<pwd>” with the user and password existing here: mongo-user // TODO
You will also need to download backups log-backup.gz, prod-backup.gz and proddbOthers-backup.gz. Temporally, whichyou will find here. you can get them from api-dev.psi-connect.org, in the next path: /opt/tomcat/mongo-test-backups And paste in /opthome/zw-vmmc-docker/mongo/backups // TODO
About the Mongo configuration, we will finish the configuration when we focus on the docker-compose.yml file.
...