125 lines
3.5 KiB
YAML
125 lines
3.5 KiB
YAML
# MadBase - Server 2: Pillar Node 1 (DB Primary + Worker)
|
|
services:
|
|
etcd1:
|
|
image: quay.io/coreos/etcd:v3.5.9
|
|
container_name: madbase_etcd1
|
|
environment:
|
|
- ETCD_NAME=etcd1
|
|
- ETCD_DATA_DIR=/etcd-data
|
|
- ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
|
|
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
|
|
- ETCD_INITIAL_ADVERTISE_PEER_URLS=http://${SERVER2_IP}:2380
|
|
- ETCD_ADVERTISE_CLIENT_URLS=http://${SERVER2_IP}:2379
|
|
- ETCD_INITIAL_CLUSTER_TOKEN=madbase-autobase
|
|
- ETCD_INITIAL_CLUSTER=etcd1=http://${SERVER2_IP}:2380,etcd2=http://${SERVER3_IP}:2380,etcd3=http://${SERVER4_IP}:2380
|
|
- ETCD_INITIAL_CLUSTER_STATE=new
|
|
volumes:
|
|
- etcd1_data:/etcd-data
|
|
restart: unless-stopped
|
|
networks:
|
|
- madbase_net
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
patroni1:
|
|
image: registry.gitlab.com/postgres-ai/postgresql-autobase/patroni:3.0.2
|
|
container_name: madbase_patroni1
|
|
environment:
|
|
- PATRONI_SCOPE=madbase-cluster
|
|
- PATRONI_NAME=patroni1
|
|
- PATRONI_ETCD3_HOSTS=${SERVER2_IP}:2379,${SERVER3_IP}:2379,${SERVER4_IP}:2379
|
|
- PATRONI_POSTGRESQL_PASSWORD=${POSTGRES_PASSWORD}
|
|
- PATRONI_RESTAPI_LISTEN=0.0.0.0:8008
|
|
- PATRONI_RESTAPI_CONNECT_ADDRESS=${SERVER2_IP}:8008
|
|
- PATRONI_POSTGRESQL_LISTEN=0.0.0.0:5432
|
|
- PATRONI_POSTGRESQL_CONNECT_ADDRESS=${SERVER2_IP}:5432
|
|
volumes:
|
|
- db_data:/var/lib/postgresql/data
|
|
depends_on:
|
|
- etcd1
|
|
restart: unless-stopped
|
|
networks:
|
|
- madbase_net
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
worker1:
|
|
image: git.madapes.com/madbase/worker:latest
|
|
container_name: madbase_worker1
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8002:8002"
|
|
env_file: .env
|
|
environment:
|
|
- DATABASE_URL=postgres://postgres:${POSTGRES_PASSWORD}@localhost:5433/postgres
|
|
- CONTROL_DB_URL=postgres://admin:${CONTROL_DB_PASSWORD}@localhost:5433/madbase_control
|
|
- REDIS_URL=redis://${SERVER3_IP}:6379
|
|
networks:
|
|
- madbase_net
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
haproxy:
|
|
image: haproxy:2.8-alpine
|
|
container_name: madbase_haproxy
|
|
volumes:
|
|
- ./autobase-haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
ports:
|
|
- "5432:5433" # Access via HAProxy
|
|
depends_on:
|
|
- patroni1
|
|
restart: unless-stopped
|
|
networks:
|
|
- madbase_net
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
db_backup:
|
|
image: prodrigestivill/postgres-backup-s3:17-alpine
|
|
container_name: madbase_db_backup
|
|
restart: unless-stopped
|
|
env_file: .env
|
|
environment:
|
|
- POSTGRES_DATABASE=postgres,madbase_control
|
|
- POSTGRES_HOST=localhost
|
|
- POSTGRES_PORT=5433
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
|
- S3_ACCESS_KEY_ID=${S3_ACCESS_KEY}
|
|
- S3_SECRET_ACCESS_KEY=${S3_SECRET_KEY}
|
|
- S3_BUCKET=${S3_BACKUP_BUCKET}
|
|
- S3_REGION=${S3_REGION:-us-east-1}
|
|
- S3_ENDPOINT=${S3_ENDPOINT}
|
|
- S3_S3_FORCE_PATH_STYLE=true
|
|
- SCHEDULE=${BACKUP_SCHEDULE:-@daily}
|
|
depends_on:
|
|
- haproxy
|
|
networks:
|
|
- madbase_net
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
volumes:
|
|
etcd1_data:
|
|
db_data:
|
|
|
|
networks:
|
|
madbase_net:
|
|
name: madbase_net
|
|
external: true
|