Created
November 5, 2024 08:25
-
-
Save Appendme/623c85565b5846ee1ba2e04a6aba746d to your computer and use it in GitHub Desktop.
Revisions
-
Appendme created this gist
Nov 5, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ mongo: image: mongo:7.0.5 environment: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: p@ssword$ MONGO_REPLICA_SET_NAME: rs0 entrypoint: - bash - -c - | cp /keyfile /mongo_keyfile chmod 400 /mongo_keyfile chown 999:999 /mongo_keyfile exec docker-entrypoint.sh $$@ command: "mongod --bind_ip_all --replSet rs0 --keyFile /mongo_keyfile" ports: - "27017:27017" volumes: - ./data/mongo:/data/db - ./dev.keyfile:/keyfile - ./rs-init.sh:/docker-entrypoint-initdb.d/rs-init.sh:ro restart: unless-stopped This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/bin/bash mongosh -u root -p p@ssword$ <<EOF var config = { "_id": "rs0", "version": 1, "members": [ { "_id": 0, "host": "mongo:27017", "priority": 2 } ] }; rs.initiate(config, { force: true }); rs.status(); EOF