Repository navigation
Expand file tree
/
Copy pathcompose-services-replication.yml
More file actions
197 lines (184 loc) · 7.07 KB
/
Copy pathcompose-services-replication.yml
File metadata and controls
197 lines (184 loc) · 7.07 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
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
services:
# ── Cluster 1 ────────────────────────────────────────────────────────────────
postgresqlc1:
container_name: temporal-postgresql-c1
image: postgres:13
command: postgres -c 'max_connections=200'
environment:
POSTGRES_PASSWORD: temporal
POSTGRES_USER: temporal
ports:
- 5432:5432
volumes:
- /var/lib/postgresql/data2
healthcheck:
test: ["CMD-SHELL", "pg_isready -U temporal"]
interval: 5s
timeout: 5s
retries: 10
temporal-schema-c1:
container_name: temporal-schema-c1
image: temporalio/admin-tools:1.31.0
depends_on:
postgresqlc1:
condition: service_healthy
environment:
- SQL_PASSWORD=temporal
entrypoint:
- /bin/sh
- -c
- |
temporal-sql-tool --plugin postgres12 --ep postgresqlc1 -u temporal -p 5432 --db temporal create &&
temporal-sql-tool --plugin postgres12 --ep postgresqlc1 -u temporal -p 5432 --db temporal setup-schema -v 0.0 &&
temporal-sql-tool --plugin postgres12 --ep postgresqlc1 -u temporal -p 5432 --db temporal update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned &&
temporal-sql-tool --plugin postgres12 --ep postgresqlc1 -u temporal -p 5432 --db temporal_visibility create &&
temporal-sql-tool --plugin postgres12 --ep postgresqlc1 -u temporal -p 5432 --db temporal_visibility setup-schema -v 0.0 &&
temporal-sql-tool --plugin postgres12 --ep postgresqlc1 -u temporal -p 5432 --db temporal_visibility update-schema -d /etc/temporal/schema/postgresql/v12/visibility/versioned &&
echo "Schema setup complete for c1."
temporalc1:
container_name: temporalc1
image: temporalio/server:1.31.0
depends_on:
temporal-schema-c1:
condition: service_completed_successfully
environment:
- TEMPORAL_ALLOW_NO_AUTH=true
entrypoint:
- /bin/sh
- -c
- |
BIND_ON_IP=$$(getent hosts "$$(hostname)" | awk '{print $$1}')
sed "s/BROADCAST_ADDR_PLACEHOLDER/$$BIND_ON_IP/g" /etc/temporal/config/replication-config-c1.yaml > /tmp/config-c1.yaml
TEMPORAL_SERVER_CONFIG_FILE_PATH=/tmp/config-c1.yaml exec temporal-server start
ports:
- 7233:7233
- 7243:7243
volumes:
- ./dynamicconfig:/etc/temporal/config/dynamicconfig
- ./template/replication-config-c1.yaml:/etc/temporal/config/replication-config-c1.yaml
temporal-ns-c1:
container_name: temporal-ns-c1
image: temporalio/admin-tools:1.31.0
depends_on:
temporalc1:
condition: service_started
environment:
- TEMPORAL_ADDRESS=temporalc1:7233
entrypoint:
- /bin/sh
- -c
- |
until temporal operator cluster health | grep -q SERVING; do
echo "Waiting for c1 to be healthy..."
sleep 2
done
temporal operator namespace describe default 2>/dev/null || \
temporal operator namespace create --retention 72h default
echo "Namespace setup complete for c1."
temporal-ui-c1:
container_name: temporal-ui-c1
image: temporalio/ui:${TEMPORAL_UI_IMG}
depends_on:
temporalc1:
condition: service_started
environment:
- TEMPORAL_ADDRESS=temporalc1:7233
- TEMPORAL_CORS_ORIGINS=http://localhost:3000
- TEMPORAL_UI_PORT=8081
- TEMPORAL_SHOW_TEMPORAL_SYSTEM_NAMESPACE=true
ports:
- 8081:8081
# ── Cluster 2 ────────────────────────────────────────────────────────────────
postgresqlc2:
container_name: temporal-postgresql-c2
image: postgres:13
command: postgres -c 'max_connections=200'
environment:
POSTGRES_PASSWORD: temporal
POSTGRES_USER: temporal
PGPORT: 7432
ports:
- 7432:7432
volumes:
- /var/lib/postgresql/data3
healthcheck:
test: ["CMD-SHELL", "pg_isready -U temporal"]
interval: 5s
timeout: 5s
retries: 10
temporal-schema-c2:
container_name: temporal-schema-c2
image: temporalio/admin-tools:1.31.0
depends_on:
postgresqlc2:
condition: service_healthy
environment:
- SQL_PASSWORD=temporal
entrypoint:
- /bin/sh
- -c
- |
temporal-sql-tool --plugin postgres12 --ep postgresqlc2 -u temporal -p 7432 --db temporal create &&
temporal-sql-tool --plugin postgres12 --ep postgresqlc2 -u temporal -p 7432 --db temporal setup-schema -v 0.0 &&
temporal-sql-tool --plugin postgres12 --ep postgresqlc2 -u temporal -p 7432 --db temporal update-schema -d /etc/temporal/schema/postgresql/v12/temporal/versioned &&
temporal-sql-tool --plugin postgres12 --ep postgresqlc2 -u temporal -p 7432 --db temporal_visibility create &&
temporal-sql-tool --plugin postgres12 --ep postgresqlc2 -u temporal -p 7432 --db temporal_visibility setup-schema -v 0.0 &&
temporal-sql-tool --plugin postgres12 --ep postgresqlc2 -u temporal -p 7432 --db temporal_visibility update-schema -d /etc/temporal/schema/postgresql/v12/visibility/versioned &&
echo "Schema setup complete for c2."
temporalc2:
container_name: temporalc2
image: temporalio/server:1.31.0
depends_on:
temporal-schema-c2:
condition: service_completed_successfully
environment:
- TEMPORAL_ALLOW_NO_AUTH=true
entrypoint:
- /bin/sh
- -c
- |
BIND_ON_IP=$$(getent hosts "$$(hostname)" | awk '{print $$1}')
sed "s/BROADCAST_ADDR_PLACEHOLDER/$$BIND_ON_IP/g" /etc/temporal/config/replication-config-c2.yaml > /tmp/config-c2.yaml
TEMPORAL_SERVER_CONFIG_FILE_PATH=/tmp/config-c2.yaml exec temporal-server start
ports:
- 2233:2233
- 2245:2245
volumes:
- ./dynamicconfig:/etc/temporal/config/dynamicconfig
- ./template/replication-config-c2.yaml:/etc/temporal/config/replication-config-c2.yaml
temporal-ns-c2:
container_name: temporal-ns-c2
image: temporalio/admin-tools:1.31.0
depends_on:
temporalc2:
condition: service_started
environment:
- TEMPORAL_ADDRESS=temporalc2:2233
entrypoint:
- /bin/sh
- -c
- |
until temporal operator cluster health | grep -q SERVING; do
echo "Waiting for c2 to be healthy..."
sleep 2
done
temporal operator namespace describe default 2>/dev/null || \
temporal operator namespace create --retention 72h default
echo "Namespace setup complete for c2."
temporal-ui-c2:
container_name: temporal-ui-c2
image: temporalio/ui:${TEMPORAL_UI_IMG}
depends_on:
temporalc2:
condition: service_started
environment:
- TEMPORAL_ADDRESS=temporalc2:2233
- TEMPORAL_CORS_ORIGINS=http://localhost:3000
- TEMPORAL_UI_PORT=8082
- TEMPORAL_SHOW_TEMPORAL_SYSTEM_NAMESPACE=true
ports:
- 8082:8082
networks:
default:
external: true
name: temporal-network-replication