mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-08-14 07:50:34 +02:00
* docs: clarify MongoDB Tailscale bind addresses * fix: make MongoDB replica host mapping deterministic * docs: add complete MongoDB replica runbook * docs: support different replica server paths
46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
name: anonymous-github-mongo-secondary
|
|
|
|
services:
|
|
mongodb-secondary:
|
|
image: ${MONGO_IMAGE:-mongo:latest}
|
|
hostname: ${MONGO_SECONDARY_HOSTNAME:-mongo-secondary}
|
|
restart: unless-stopped
|
|
entrypoint:
|
|
- /bin/bash
|
|
- /opt/anonymous-github/mongodb-replica-entrypoint.sh
|
|
command:
|
|
- --quiet
|
|
- --replSet
|
|
- rs0
|
|
- --keyFile
|
|
- /tmp/mongo-replica-keyfile
|
|
- --bind_ip_all
|
|
environment:
|
|
MONGO_REPLICA_KEYFILE_PATH: /run/secrets/mongo-replica-keyfile
|
|
extra_hosts:
|
|
- "${MONGO_PRIMARY_HOSTNAME:-mongo-primary}:${MONGO_PRIMARY_ADDRESS:?Set MONGO_PRIMARY_ADDRESS to the primary server Tailscale IP}"
|
|
networks:
|
|
default:
|
|
aliases:
|
|
- ${MONGO_SECONDARY_HOSTNAME:-mongo-secondary}
|
|
volumes:
|
|
- mongodb_secondary_data:/data/db
|
|
- ${MONGO_REPLICA_KEYFILE:-./secrets/mongo-replica-keyfile}:/run/secrets/mongo-replica-keyfile:ro
|
|
- ./scripts/mongodb-replica-entrypoint.sh:/opt/anonymous-github/mongodb-replica-entrypoint.sh:ro
|
|
ports:
|
|
- ${MONGO_BIND_ADDRESS:-127.0.0.1}:27017:27017
|
|
healthcheck:
|
|
test:
|
|
- CMD
|
|
- mongosh
|
|
- --quiet
|
|
- --eval
|
|
- "db.adminCommand('ping')"
|
|
interval: 10s
|
|
timeout: 10s
|
|
retries: 12
|
|
start_period: 10s
|
|
|
|
volumes:
|
|
mongodb_secondary_data:
|