-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocker-compose.yml
98 lines (94 loc) · 2.62 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: active_record_proxy_adapters
x-postgres-common: &postgres-common
restart: always
user: postgres
healthcheck:
test: 'pg_isready -U postgres_primary_test --dbname=postgres'
interval: 10s
timeout: 5s
retries: 5
networks:
- postgres
services:
app:
build:
args:
- RUBY_VERSION=${RUBY_VERSION:-3.3.6}
container_name: app
image: active_record_proxy_adapters-app:${ENV_TAG:-latest}
tty: true
stdin_open: true
environment:
- RAILS_VERSION=${RAILS_VERSION:-8.0.0}
- PGHOST=postgres_primary
- PG_PRIMARY_USER=postgres_primary_test
- PG_PRIMARY_PASSWORD=postgres_primary_test
- PG_PRIMARY_HOST=postgres_primary
- PG_PRIMARY_PORT=5432
- PG_REPLICA_USER=postgres_primary_test
- PG_REPLICA_PASSWORD=postgres_primary_test
- PG_REPLICA_HOST=postgres_replica
- PG_REPLICA_PORT=5432
- MYSQL_PRIMARY_USER=root
- MYSQL_PRIMARY_PASSWORD=mysql
- MYSQL_PRIMARY_HOST=mysql_primary
- MYSQL_PRIMARY_PORT=3306
- MYSQL_REPLICA_USER=root
- MYSQL_REPLICA_PASSWORD=mysql
- MYSQL_REPLICA_HOST=mysql_primary
- MYSQL_REPLICA_PORT=3306
depends_on:
- postgres_primary
- postgres_replica
- mariadb
networks:
- app
- postgres
- mariadb
volumes:
- .:/app
postgres_primary:
<<: *postgres-common
build:
context: .
dockerfile: docker/postgres_primary.dockerfile
args:
- POSTGRES_LOGGING_COLLECTOR=${POSTGRES_LOGGING_COLLECTOR:-}
- POSTGRES_LOG_DESTINATION=${POSTGRES_LOG_DESTINATION:-}
- POSTGRES_LOG_STATEMENT=${POSTGRES_LOG_STATEMENT:-}
- REPLICA_USER=replicator
- REPLICA_PASSWORD=replicator
container_name: postgres_primary
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres_primary_test
POSTGRES_PASSWORD: postgres_primary_test
POSTGRES_HOST_AUTH_METHOD: "scram-sha-256\nhost replication all 0.0.0.0/0 md5"
POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256"
postgres_replica:
<<: *postgres-common
build:
context: .
dockerfile: docker/postgres_replica.dockerfile
container_name: postgres_replica
environment:
PGUSER: replicator
PGPASSWORD: replicator
PRIMARY_DATABASE_HOST: postgres_primary
depends_on:
- postgres_primary
# TODO: create mysql replica images
mariadb:
image: mariadb:11.4
container_name: mysql_primary
environment:
MARIADB_ROOT_PASSWORD: mysql
MARIADB_DATABASE: mysql
ports:
- "3306:3306"
networks:
- mariadb
networks:
app:
postgres:
mariadb: