mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
mongo docker for testing; align mongodb directory naming
This commit is contained in:
@@ -15,7 +15,7 @@ services:
|
|||||||
- "27017:27017"
|
- "27017:27017"
|
||||||
restart: "unless-stopped"
|
restart: "unless-stopped"
|
||||||
volumes:
|
volumes:
|
||||||
- "./mongodb-docker-data:/data/db"
|
- "./mongodb-data-docker:/data/db"
|
||||||
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs" ]
|
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs" ]
|
||||||
mongoinit:
|
mongoinit:
|
||||||
image: "mongo:7.0"
|
image: "mongo:7.0"
|
||||||
|
|||||||
35
docker-compose.mongo-test-local.yml
Normal file
35
docker-compose.mongo-test-local.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# big thanks to https://pakisan.github.io/posts/docker-compose-mongodb-single-node-replica-set/ <3
|
||||||
|
|
||||||
|
networks:
|
||||||
|
mongodb-network:
|
||||||
|
name: "mongodb-network"
|
||||||
|
driver: bridge
|
||||||
|
services:
|
||||||
|
mongodb:
|
||||||
|
image: "mongo:7.0"
|
||||||
|
container_name: "mongodb"
|
||||||
|
networks:
|
||||||
|
- mongodb-network
|
||||||
|
hostname: "mongodb"
|
||||||
|
ports:
|
||||||
|
- "27017:27017"
|
||||||
|
restart: "unless-stopped"
|
||||||
|
volumes:
|
||||||
|
- "./mongodb-data-docker-testing:/data/db"
|
||||||
|
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs" ]
|
||||||
|
mongoinit:
|
||||||
|
image: "mongo:7.0"
|
||||||
|
container_name: "mongodb_replSet_initializer"
|
||||||
|
restart: "on-failure" # WITHOUT THIS, the initializer tries only once and fails
|
||||||
|
depends_on:
|
||||||
|
- mongodb
|
||||||
|
networks:
|
||||||
|
- mongodb-network
|
||||||
|
|
||||||
|
command: >
|
||||||
|
bash -c "
|
||||||
|
until mongosh --host mongodb:27017 --eval 'db.adminCommand({ping:1})' >/dev/null 2>&1; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
mongosh --host mongodb:27017 --eval 'try { rs.initiate({_id: \"rs\", members:[{_id:0, host: \"mongodb:27017\"}]}); } catch(e) { print(\"rs.initiate skipped or failed: \" + e); }'
|
||||||
|
"
|
||||||
@@ -108,6 +108,7 @@
|
|||||||
"mongo:dev:rs": "run-rs -v 7.0.23 -l ubuntu2214 --keep --dbpath mongodb-data-rs --number 1 --quiet",
|
"mongo:dev:rs": "run-rs -v 7.0.23 -l ubuntu2214 --keep --dbpath mongodb-data-rs --number 1 --quiet",
|
||||||
"mongo:test:rs": "run-rs -v 7.0.23 -l ubuntu2214 --keep --dbpath mongodb-data-rs-testing --number 1 --quiet",
|
"mongo:test:rs": "run-rs -v 7.0.23 -l ubuntu2214 --keep --dbpath mongodb-data-rs-testing --number 1 --quiet",
|
||||||
"mongo:dev:docker": "docker compose -f docker-compose.mongo-local.yml up",
|
"mongo:dev:docker": "docker compose -f docker-compose.mongo-local.yml up",
|
||||||
|
"mongo:test:docker": "docker compose -f docker-compose.mongo-test-local.yml up",
|
||||||
"mongo:test": "node scripts/start-local-mongo.mjs --test-db",
|
"mongo:test": "node scripts/start-local-mongo.mjs --test-db",
|
||||||
"postinstall": "git config --global url.\"https://\".insteadOf git:// && gulp build && cd website/client && npm install",
|
"postinstall": "git config --global url.\"https://\".insteadOf git:// && gulp build && cd website/client && npm install",
|
||||||
"apidoc": "gulp apidoc",
|
"apidoc": "gulp apidoc",
|
||||||
|
|||||||
Reference in New Issue
Block a user