chilly-daybreak-3126
01/19/2025, 10:29 PMfresh-football-47124
fresh-football-47124
fresh-football-47124
chilly-daybreak-3126
01/20/2025, 10:14 PMdocker-compose up
, use the mongodump
command to create a backup and output it to the mounted directory:
docker exec -it mongo mongodump --out /backup -u root -p develop --authenticationDatabase admin
docker-compose.yml
...
mongo:
container_name: mongo
image: "mongo:latest"
ports:
- 27017:27017
volumes:
- mongodata:/data/db
- ./.growthbook/data:/backup
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 3
mongo-restore:
image: mongo
depends_on:
- mongo
volumes:
- ./.growthbook/data:/backup
entrypoint: ["bash", "-c", "mongorestore --drop /backup -u <root_user_here> -p <root_password_here> --authenticationDatabase admin --host mongo:27017"]
growthbook:
container_name: growthbook
image: "growthbook/growthbook:latest"
ports:
- "4000:3000"
- "3100:3100"
depends_on:
mongo:
condition: service_healthy
...
Disclaimer: This is a localhost example(not tested) and not a production implementation or guideline. Please consider your relevant changes.
Thank you and hope it helps others also please let me know your thoughts.chilly-daybreak-3126
01/20/2025, 10:15 PM