-
Notifications
You must be signed in to change notification settings - Fork 58
275 lines (243 loc) · 10.8 KB
/
compose.yaml
File metadata and controls
275 lines (243 loc) · 10.8 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
name: Test compose examples
on:
pull_request:
paths:
- 'compose/**'
- '.github/workflows/compose.yaml'
push:
branches:
- main
paths:
- 'compose/**'
- '.github/workflows/compose.yaml'
permissions:
contents: read
jobs:
lint-actions:
name: Lint GitHub Actions workflows
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Lint actions
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color
shell: bash
compose-test:
name: Test ${{ matrix.compose-file }}
needs: lint-actions
strategy:
fail-fast: false
matrix:
compose-file:
- docker-compose.yml
- docker-compose-postgres.yml
- docker-compose-mysql.yml
- docker-compose-mysql-es.yml
- docker-compose-cass-es.yml
- docker-compose-postgres-opensearch.yml
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Print build information
env:
HEAD_REF: ${{ github.head_ref }}
REF: ${{ github.ref }}
COMPOSE_FILE: ${{ matrix.compose-file }}
run: echo "head_ref=$HEAD_REF ref=$REF compose=$COMPOSE_FILE"
- uses: actions/checkout@v6
- name: Start compose stack
working-directory: compose
run: docker compose -f ${{ matrix.compose-file }} up -d
- name: Wait for admin-tools to complete
working-directory: compose
run: |
echo "Waiting up to 3 minutes for admin-tools to complete..."
timeout 180 bash -c 'until [ "$(docker compose -f ${{ matrix.compose-file }} ps temporal-admin-tools --format json | jq -r ".[0].State")" = "exited" ]; do sleep 2; done' || {
echo "Admin-tools failed to complete"
docker compose -f ${{ matrix.compose-file }} logs temporal-admin-tools
exit 1
}
# Check exit code
EXIT_CODE=$(docker compose -f ${{ matrix.compose-file }} ps temporal-admin-tools --format json | jq -r ".[0].ExitCode")
if [ "$EXIT_CODE" != "0" ]; then
echo "Admin-tools exited with code $EXIT_CODE"
docker compose -f ${{ matrix.compose-file }} logs temporal-admin-tools
exit 1
fi
echo "Admin-tools completed successfully"
- name: Wait for services to be healthy
working-directory: compose
run: |
echo "Waiting up to 5 minutes for services to be healthy..."
timeout 300 bash -c 'until docker compose -f ${{ matrix.compose-file }} ps | grep -E "(healthy|Started)"; do sleep 5; done' || {
echo "Services failed to become healthy"
docker compose -f ${{ matrix.compose-file }} ps
docker compose -f ${{ matrix.compose-file }} logs
exit 1
}
- name: Check admin-tools logs
working-directory: compose
run: |
docker compose -f ${{ matrix.compose-file }} logs temporal-admin-tools
if docker compose -f ${{ matrix.compose-file }} logs temporal-admin-tools | grep -i "error" | grep -v "unable to describe namespace"; then
echo "Found errors in admin-tools logs"
exit 1
fi
- name: Check namespace creation logs
working-directory: compose
run: |
docker compose -f ${{ matrix.compose-file }} logs temporal-create-namespace
if ! docker compose -f ${{ matrix.compose-file }} logs temporal-create-namespace | grep -q "Namespace 'default' created"; then
echo "Namespace creation failed"
exit 1
fi
- name: Verify temporal server is healthy
working-directory: compose
run: |
docker compose -f ${{ matrix.compose-file }} exec -T temporal temporal operator cluster health || {
echo "Temporal server health check failed"
docker compose -f ${{ matrix.compose-file }} logs temporal
exit 1
}
- name: Cleanup
if: always()
working-directory: compose
run: docker compose -f ${{ matrix.compose-file }} down -v
compose-tls-test:
name: Test docker-compose-tls.yml
needs: lint-actions
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Print build information
env:
HEAD_REF: ${{ github.head_ref }}
REF: ${{ github.ref }}
run: echo "head_ref=$HEAD_REF ref=$REF compose=docker-compose-tls.yml"
- uses: actions/checkout@v6
- name: Generate TLS certificates
working-directory: compose
run: |
docker build -t temporal_tls:test -f tls/Dockerfile.tls .
mkdir -p .pki
docker run --rm -v temporal_tls_pki:/pki -v "${PWD}"/.pki:/pki-out temporal_tls:test
- name: Build TLS images
working-directory: compose
run: COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml build --no-cache
- name: Start TLS compose stack
working-directory: compose
run: COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml up -d
- name: Wait for admin-tools-setup to complete
working-directory: compose
run: |
echo "Waiting up to 3 minutes for admin-tools-setup to complete..."
timeout 180 bash -c 'until [ "$(COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml ps temporal-admin-tools-setup --format json | jq -r ".[0].State")" = "exited" ]; do sleep 2; done' || {
echo "Admin-tools-setup failed to complete"
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-admin-tools-setup
exit 1
}
# Check exit code
EXIT_CODE=$(COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml ps temporal-admin-tools-setup --format json | jq -r ".[0].ExitCode")
if [ "$EXIT_CODE" != "0" ]; then
echo "Admin-tools-setup exited with code $EXIT_CODE"
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-admin-tools-setup
exit 1
fi
echo "Admin-tools-setup completed successfully"
- name: Wait for services to be healthy
working-directory: compose
run: |
echo "Waiting up to 5 minutes for services to be healthy..."
timeout 300 bash -c 'until COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml ps | grep -E "(healthy|Started)"; do sleep 5; done' || {
echo "Services failed to become healthy"
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml ps
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs
exit 1
}
- name: Check admin-tools logs
working-directory: compose
run: |
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-admin-tools-setup
if COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-admin-tools-setup | grep -i "error" | grep -v "unable to describe namespace"; then
echo "Found errors in admin-tools logs"
exit 1
fi
- name: Check namespace creation logs
working-directory: compose
run: |
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-create-namespace
if ! COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml logs temporal-create-namespace | grep -q "Namespace 'default' created"; then
echo "Namespace creation failed"
exit 1
fi
- name: Cleanup
if: always()
working-directory: compose
run: |
COMPOSE_PROJECT_NAME=tls_test docker compose -f docker-compose-tls.yml down -v
docker volume rm temporal_tls_pki || true
rm -rf .pki
compose-multirole-test:
name: Test docker-compose-multirole.yaml
needs: lint-actions
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Print build information
env:
HEAD_REF: ${{ github.head_ref }}
REF: ${{ github.ref }}
run: echo "head_ref=$HEAD_REF ref=$REF compose=docker-compose-multirole.yaml"
- uses: actions/checkout@v6
- name: Install loki Docker plugin
run: docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
- name: Start multirole compose stack
working-directory: compose
run: docker compose -f docker-compose-multirole.yaml up -d
- name: Wait for setup to complete
working-directory: compose
run: |
echo "Waiting up to 3 minutes for setup to complete..."
timeout 180 bash -c 'until [ "$(docker compose -f docker-compose-multirole.yaml ps temporal-setup --format json | jq -r ".[0].State")" = "exited" ]; do sleep 2; done' || {
echo "Setup failed to complete"
docker compose -f docker-compose-multirole.yaml logs temporal-setup
exit 1
}
# Check exit code
EXIT_CODE=$(docker compose -f docker-compose-multirole.yaml ps temporal-setup --format json | jq -r ".[0].ExitCode")
if [ "$EXIT_CODE" != "0" ]; then
echo "Setup exited with code $EXIT_CODE"
docker compose -f docker-compose-multirole.yaml logs temporal-setup
exit 1
fi
echo "Setup completed successfully"
- name: Wait for services to be healthy
working-directory: compose
run: |
echo "Waiting up to 5 minutes for services to be healthy..."
timeout 300 bash -c 'until docker compose -f docker-compose-multirole.yaml ps | grep -E "(healthy|Started)"; do sleep 5; done' || {
echo "Services failed to become healthy"
docker compose -f docker-compose-multirole.yaml ps
docker compose -f docker-compose-multirole.yaml logs
exit 1
}
- name: Check setup logs
working-directory: compose
run: |
docker compose -f docker-compose-multirole.yaml logs temporal-setup
if docker compose -f docker-compose-multirole.yaml logs temporal-setup | grep -i "error" | grep -v "unable to describe namespace"; then
echo "Found errors in setup logs"
exit 1
fi
- name: Verify temporal services are running
working-directory: compose
run: |
docker compose -f docker-compose-multirole.yaml ps temporal-history temporal-frontend temporal-matching temporal-worker
- name: Cleanup
if: always()
working-directory: compose
run: docker compose -f docker-compose-multirole.yaml down -v