mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(tools): consolidate docker compose setup (#62525)
This commit is contained in:
committed by
GitHub
parent
f002f1b835
commit
3cbe2ab8b1
@@ -1,34 +0,0 @@
|
||||
services:
|
||||
db:
|
||||
image: mongo
|
||||
container_name: mongodb
|
||||
command: mongod --replSet rs0
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 27017:27017
|
||||
volumes:
|
||||
- db-data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongosh', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 2s
|
||||
retries: 5
|
||||
|
||||
setup:
|
||||
image: mongo
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
restart: on-failure
|
||||
# This will try to initiate the replica set, until it succeeds twice (i.e. until the replica set is already initialized)
|
||||
command: >
|
||||
mongosh --host db:27017 --eval '
|
||||
try {
|
||||
rs.initiate();
|
||||
} catch (err) {
|
||||
if(err.codeName !== "AlreadyInitialized") throw err;
|
||||
}
|
||||
'
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
driver: local
|
||||
Reference in New Issue
Block a user