-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.haproxy-acra-pgsql.yml
209 lines (190 loc) · 6.89 KB
/
docker-compose.haproxy-acra-pgsql.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
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
version: "3"
services:
#===== Keymakers ===========================================================
acra-keymaker_writer:
image: "cossacklabs/acra-keymaker:${ACRA_DOCKER_IMAGE_TAG:-0.95.0}"
network_mode: "none"
environment:
ACRA_MASTER_KEY: ${ACRA_SERVER_MASTER_KEY:-N0MyZEVCRGY1cHA4ODRSVHp3c3BNeGtDekxaV3BhTHI=}
volumes:
- ./.acrakeys:/keys
- ./ssl/acra-client/:/ssl:ro
command: >-
--client_id=""
--tls_cert=/ssl/acra-client.crt
--generate_acrawriter_keys
--generate_symmetric_storage_key
--keys_output_dir=/keys/acra-server
--keys_public_output_dir=/keys/acra-writer
--keystore=v1
#===== Databases ===========================================================
pgsql-master:
build:
context: ./
dockerfile: pgsql-replication.dockerfile
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-test}
POSTGRES_DB: ${POSTGRES_DB:-test}
POSTGRES_REPLICATION_USER: ${POSTGRES_REPLICATION_USER:-replica}
POSTGRES_REPLICATION_PASSWORD: ${POSTGRES_REPLICATION_PASSWORD:-2QTkGNGuxEC25viP}
ports:
- "5434:5432"
networks:
- world
- acraserver-m-pgsql-master
pgsql-replication-setup:
depends_on:
- pgsql-master
build:
context: ./
dockerfile: replication-setup.dockerfile
environment:
POSTGRES_HOST: ${POSTGRES_HOST:-pgsql-master}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-test}
POSTGRES_REPLICATION_USER: ${POSTGRES_REPLICATION_USER:-replica}
POSTGRES_REPLICATION_PASSWORD: ${POSTGRES_REPLICATION_PASSWORD:-2QTkGNGuxEC25viP}
POSTGRES_REPLICATION_MASTER_HOST: pgsql-master
volumes:
- ./pgdata:/var/lib/postgresql/data/
networks:
- acraserver-m-pgsql-master
pgsql-slave:
depends_on:
pgsql-replication-setup:
condition:
service_completed_successfully
build:
context: ./
dockerfile: pgsql-slave.dockerfile
volumes:
- ./pgdata:/var/lib/postgresql/data/
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-test}
POSTGRES_REPLICATION_USER: ${POSTGRES_REPLICATION_USER:-replica}
POSTGRES_REPLICATION_PASSWORD: ${POSTGRES_REPLICATION_PASSWORD:-2QTkGNGuxEC25viP}
POSTGRES_REPLICATION_MASTER_HOST: pgsql-master
DATABASE_ALREADY_EXISTS: "true"
ports:
- "5435:5432"
networks:
- acraserver-s-pgsql-slave
- world
#===== AcraServer ==============================================================
acra-server-m:
image: "cossacklabs/acra-server:${ACRA_DOCKER_IMAGE_TAG:-0.95.0}"
restart: always
depends_on:
- pgsql-master
environment:
ACRA_MASTER_KEY: ${ACRA_SERVER_MASTER_KEY:-N0MyZEVCRGY1cHA4ODRSVHp3c3BNeGtDekxaV3BhTHI=}
networks:
- acraserver-m-pgsql-master
- haproxy-acraserver
- python-acraserver-m
volumes:
- ./.acrakeys/acra-server:/keys
- ./.acraconfigs/acra-server-m:/config
- ./ssl/acra-server/:/ssl
command: >-
--db_host=pgsql-master
--db_port=5432
--keys_dir=/keys
--tls_auth=4
--tls_ca=/ssl/root.crt
--tls_cert=/ssl/acra-server.crt
--tls_key=/ssl/acra-server.key
--tls_client_id_from_cert
--tls_database_sni=pgsql
--tls_identifier_extractor_type=distinguished_name
--config_file=/config/acra-server.yaml
--v
--d
acra-server-s:
image: "cossacklabs/acra-server:${ACRA_DOCKER_IMAGE_TAG:-0.95.0}"
restart: always
depends_on:
- pgsql-slave
environment:
ACRA_MASTER_KEY: ${ACRA_SERVER_MASTER_KEY:-N0MyZEVCRGY1cHA4ODRSVHp3c3BNeGtDekxaV3BhTHI=}
networks:
- acraserver-s-pgsql-slave
- haproxy-acraserver
volumes:
- ./.acrakeys/acra-server:/keys
- ./.acraconfigs/acra-server-s:/config
- ./ssl/acra-server/:/ssl
command: >-
--db_host=pgsql-slave
--db_port=5432
--keys_dir=/keys
--tls_auth=4
--tls_ca=/ssl/root.crt
--tls_cert=/ssl/acra-server.crt
--tls_key=/ssl/acra-server.key
--tls_client_id_from_cert
--tls_database_sni=pgsql
--tls_identifier_extractor_type=distinguished_name
--config_file=/config/acra-server.yaml
--v
--d
#===== HAProxy =============================================================
haproxy:
depends_on:
- acra-server-s
- acra-server-m
build:
context: ./
dockerfile: haproxy-acra-pgsql.dockerfile
ports:
# RW
- "9393:9393"
# RO
- "9394:9394"
networks:
- haproxy-acraserver
- python-haproxy
- haproxy-pgsql
- world
#===== Example client ==========================================================
python:
depends_on:
- acra-keymaker_writer
build:
context: ./
dockerfile: acra-python-example.dockerfile
environment:
EXAMPLE_HOST: haproxy
EXAMPLE_PORT: 9393
EXAMPLE_DB_USER: ${POSTGRES_USER:-postgres}
EXAMPLE_DB_PASSWORD: ${POSTGRES_PASSWORD:-test}
EXAMPLE_DB_NAME: ${POSTGRES_DB:-test}
# sha512 of the certificate's distinguished name
EXAMPLE_PUBLIC_KEY: "/app.acrakeys/28fa1ef8aa3184d7ce0621341299d74b5b561a95aecdee3b46b847d63495f800d276cdd1233f5950efb348113f2892ceef4b354abed383d8afc026901854ca28_storage.pub"
EXAMPLE_SSL_MODE: verify-ca
EXAMPLE_TLS_ROOT_CERT: /ssl/root.crt
EXAMPLE_TLS_KEY: /ssl/acra-client.key
EXAMPLE_TLS_CERT: /ssl/acra-client.crt
EXAMPLE_POSTGRESQL: !!str 'true'
networks:
- python-haproxy
- python-acraserver-m
volumes:
- ./.acrakeys/acra-writer:/app.acrakeys:ro
networks:
world:
acraserver-m-pgsql-master:
internal: true
acraserver-s-pgsql-slave:
internal: true
haproxy-acraserver:
internal: true
python-haproxy:
internal: true
haproxy-pgsql:
internal: true
python-acraserver-m:
internal: true