-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
166 lines (156 loc) · 4.12 KB
/
docker-compose.yml
File metadata and controls
166 lines (156 loc) · 4.12 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: active_record_proxy_adapters
x-app-common: &app-common
image: active_record_proxy_adapters-app:${ENV_TAG:-latest}
x-healthcheck_common: &healthcheck-common
interval: 5s
timeout: 10s
retries: 30
x-postgres-common: &postgres-common
restart: always
user: postgres
healthcheck:
<<: *healthcheck-common
test: 'pg_isready -U postgres_primary_test --dbname=postgres'
networks:
- postgres
services:
app:
<<: *app-common
build:
args:
- RUBY_VERSION=${RUBY_VERSION:-4.0.2}
- DOCKER_REGISTRY=${DOCKER_REGISTRY:-docker.io}
container_name: app
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
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DATABASE=0
- REDIS_URL=${REDIS_URL:-redis://${REDIS_HOST:-redis}:${REDIS_PORT:-6379}/${REDIS_DATABASE:-0}}
- MEMCACHED_HOST=memcached
- MEMCACHED_PORT=11211
- MEMCACHED_URL=${MEMCACHED_URL:-${MEMCACHED_HOST:-memcached}:${MEMCACHED_PORT:-11211}}
depends_on:
postgres_primary:
condition: service_healthy
postgres_replica:
condition: service_healthy
mariadb:
condition: service_healthy
networks:
- app
- postgres
- mariadb
volumes:
- .:/app
- bundle:/usr/local/bundle
ports:
- 8808:8808
postgres_primary:
<<: *postgres-common
build:
context: docker/postgres_primary
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"
volumes:
- postgres_primary:/var/lib/postgresql/data
postgres_replica:
<<: *postgres-common
build:
context: docker/postgres_replica
container_name: postgres_replica
environment:
PGUSER: replicator
PGPASSWORD: replicator
PRIMARY_DATABASE_HOST: postgres_primary
volumes:
- postgres_replica:/var/lib/postgresql/data
depends_on:
postgres_primary:
condition: service_healthy
# TODO: create mysql replica images
mariadb:
image: mariadb:11.4
container_name: mysql_primary
environment:
MARIADB_ROOT_PASSWORD: mysql
MARIADB_DATABASE: mysql
volumes:
- mariadb:/var/lib/mysql
ports:
- "3306:3306"
networks:
- mariadb
healthcheck:
<<: *healthcheck-common
test: 'mariadb-admin -pmysql ping'
redis:
image: redis:latest
container_name: redis
restart: always
ports:
- "6379:6379"
networks:
- redis
- app
memcached:
image: memcached:latest
container_name: memcached
restart: always
ports:
- "11211:11211"
networks:
- app
- memcached
yard:
<<: *app-common
container_name: yard
pull_policy: never
ports:
- 8808:8808
command: [ "bundle", "exec", "yard", "server", "--reload"]
volumes:
- .:/app
- yard:/app/.yardoc
networks:
app:
postgres:
mariadb:
redis:
memcached:
volumes:
bundle:
mariadb:
postgres_primary:
postgres_replica:
yard: