Repository navigation
Expand file tree
/
Copy pathcompose.test.yaml
More file actions
178 lines (170 loc) · 4.9 KB
/
Copy pathcompose.test.yaml
File metadata and controls
178 lines (170 loc) · 4.9 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
name: pgacc-test
services:
# PostgreSQL 18, the only supported server. database-test uses the same image
# so that psql matches the server version. The 18+ images keep PGDATA in
# /var/lib/postgresql/18/docker and refuse to start when
# /var/lib/postgresql/data is a mount point.
database:
image: postgres:18-bookworm@sha256:bbf83594798e144bff365a9c191c5d779f181fb3135902064ab8ff11918020fc
environment:
POSTGRES_DB: accounting
POSTGRES_USER: pgacc_test
POSTGRES_PASSWORD: pgacc_test
TZ: UTC
healthcheck:
test: ["CMD-SHELL", "pg_isready --username=pgacc_test --dbname=accounting"]
interval: 2s
timeout: 3s
retries: 30
networks:
- test
tmpfs:
- /var/lib/postgresql
php-lint:
image: php:8.5-cli@sha256:d5e3f03b94966fd65df52b9819c6dde463003b5a32d032698290a0b37b53bb37
command: ["sh", "tests/lint.sh"]
init: true
read_only: true
tmpfs:
- /tmp
volumes:
- .:/app:ro
working_dir: /app
database-test:
image: postgres:18-bookworm@sha256:bbf83594798e144bff365a9c191c5d779f181fb3135902064ab8ff11918020fc
depends_on:
database:
condition: service_healthy
environment:
PGHOST: database
PGPORT: "5432"
PGDATABASE: accounting
PGUSER: pgacc_test
PGPASSWORD: pgacc_test
TZ: UTC
command: ["sh", "tests/database-smoke.sh"]
init: true
networks:
- test
read_only: true
tmpfs:
- /tmp
volumes:
- .:/app:ro
working_dir: /app
# Local membership-system stub (tests/reference/membership/): getusers()
# fetches the members_url of tests/runtime/test-sync-secrets.php
# (https://mitglieder.piratenpartei.at/members.php), which this alias
# resolves to inside the internal test network, so the import and member
# pages never reach a real service. Serves the synthetic JSON member list
# for that file's members_token over HTTPS with the synthetic certificate
# of the application image, signed by the test CA that is the file's
# members_cafile (tests/php-runtime.Dockerfile). The image is built with
# the application service.
membership:
image: pgacc-test-application${PGACC_TEST_SUFFIX:-}
pull_policy: never
command: ["php", "/app/tests/reference/membership/server.php"]
healthcheck:
test: ["CMD", "php", "-r", "exit(@file_get_contents('https://mitglieder.piratenpartei.at/__stub/health') === \"ok\\n\" ? 0 : 1);"]
interval: 2s
timeout: 3s
retries: 30
init: true
networks:
test:
aliases:
- mitglieder.piratenpartei.at
read_only: true
tmpfs:
- /tmp
application:
image: pgacc-test-application${PGACC_TEST_SUFFIX:-}
build:
context: .
# PHP 8.5, the only supported runtime.
dockerfile: tests/php-runtime.Dockerfile
depends_on:
database:
condition: service_healthy
membership:
condition: service_healthy
environment:
PGHOST: database
PGPORT: "5432"
PGDATABASE: accounting
PGUSER: pgacc_test
PGPASSWORD: pgacc_test
PGACC_TEST_DIAGNOSTICS_DIR: /diagnostics
TZ: UTC
command:
- php
- -d
- output_buffering=4096
- -d
- auto_prepend_file=/app/tests/runtime/diagnostics-prepend.php
- -S
- 0.0.0.0:8080
- -t
- /app/public
# The allow list of the nginx site (tests/runtime/router.php).
- /app/tests/runtime/router.php
healthcheck:
test:
- CMD
- php
- -r
- "exit(@fsockopen('127.0.0.1', 8080) ? 0 : 1);"
interval: 2s
timeout: 3s
retries: 30
init: true
networks:
- test
read_only: true
tmpfs:
- /tmp
volumes:
- diagnostics:/diagnostics
- receipts:/app/files
application-test:
image: pgacc-test-application${PGACC_TEST_SUFFIX:-}
depends_on:
application:
condition: service_healthy
environment:
PGACC_TEST_BASE_URL: http://application:8080
PGHOST: database
PGPORT: "5432"
PGDATABASE: accounting
PGUSER: pgacc_test
PGPASSWORD: pgacc_test
PGACC_TEST_DIAGNOSTICS_DIR: /diagnostics
TZ: UTC
command: ["sh", "tests/application-tests.sh"]
init: true
networks:
- test
read_only: true
tmpfs:
- /tmp
volumes:
- diagnostics:/diagnostics
# tests/http-receipts.php checks and plants the server's receipt files.
- receipts:/app/files
networks:
test:
internal: true
volumes:
# Per-request PHP diagnostics written by tests/runtime/diagnostics-prepend.php
# on the test servers and read by the HTTP tests. Removed with the project.
diagnostics:
driver_opts:
type: tmpfs
device: tmpfs
# The application's files/ directory (receipt storage), shared with the
# tests. Synthetic receipts only; removed with the project.
receipts:
driver_opts:
type: tmpfs
device: tmpfs