115 lines
3.0 KiB
YAML
115 lines
3.0 KiB
YAML
# MadBase - Server 3: Pillar Node 2 (DB Replica + Worker + Redis)
|
|
services:
|
|
etcd2:
|
|
image: quay.io/coreos/etcd:v3.5.9
|
|
container_name: madbase_etcd2
|
|
environment:
|
|
- ETCD_NAME=etcd2
|
|
- 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://${SERVER3_IP}:2380
|
|
- ETCD_ADVERTISE_CLIENT_URLS=http://${SERVER3_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:
|
|
- etcd2_data:/etcd-data
|
|
restart: unless-stopped
|
|
networks:
|
|
- madbase_net
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
patroni2:
|
|
image: registry.gitlab.com/postgres-ai/postgresql-autobase/patroni:3.0.2
|
|
container_name: madbase_patroni2
|
|
environment:
|
|
- PATRONI_SCOPE=madbase-cluster
|
|
- PATRONI_NAME=patroni2
|
|
- 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=${SERVER3_IP}:8008
|
|
- PATRONI_POSTGRESQL_LISTEN=0.0.0.0:5432
|
|
- PATRONI_POSTGRESQL_CONNECT_ADDRESS=${SERVER3_IP}:5432
|
|
volumes:
|
|
- db_data:/var/lib/postgresql/data
|
|
depends_on:
|
|
- etcd2
|
|
restart: unless-stopped
|
|
networks:
|
|
- madbase_net
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
worker2:
|
|
image: git.madapes.com/madbase/worker:latest
|
|
container_name: madbase_worker2
|
|
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://localhost: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_v2
|
|
volumes:
|
|
- ./autobase-haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
ports:
|
|
- "5433:5433"
|
|
depends_on:
|
|
- patroni2
|
|
restart: unless-stopped
|
|
networks:
|
|
- madbase_net
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: madbase_redis
|
|
command: redis-server --appendonly yes
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
restart: unless-stopped
|
|
networks:
|
|
- madbase_net
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
volumes:
|
|
etcd2_data:
|
|
db_data:
|
|
redis_data:
|
|
|
|
networks:
|
|
madbase_net:
|
|
name: madbase_net
|
|
external: true
|