Repository navigation
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
121 lines (116 loc) · 4.45 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
121 lines (116 loc) · 4.45 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
# One project name for every checkout. The containers have fixed names and
# fixed ports, so there can only be one set; pinning the project lets compose
# in a second git worktree see those containers as its own instead of failing
# on "container name already in use" (#895).
name: sqlpilot
# The seed scripts are copied into a small image per server rather than
# bind-mounted. The containers are shared by every checkout, and a bind mount
# pins them to whichever checkout created them: once that one was removed,
# `docker start` failed because the mount source was gone (#903). Built on the
# first `up`; `just db-reset` rebuilds after a seed file changes.
x-seed-build: &seed-build
context: ./tests/fixtures/sql
services:
mysql-8:
image: sqlpilot-test-mysql-8
build:
<<: *seed-build
dockerfile_inline: |
FROM mysql:8.0
COPY --chmod=0444 seed.sql /docker-entrypoint-initdb.d/01-seed.sql
COPY --chmod=0444 seed_large.sql /docker-entrypoint-initdb.d/02-seed-large.sql
container_name: mas-mysql-8
environment:
MYSQL_ROOT_PASSWORD: test_root_password
MYSQL_DATABASE: test_db
MYSQL_USER: test_user
MYSQL_PASSWORD: test_password
ports:
- "13306:3306"
command: >
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--protocol=TCP", "-u", "root", "-ptest_root_password"]
interval: 5s
timeout: 3s
retries: 30
start_period: 30s
# Defined, never started: MySQL 5.7 reached end of life in October 2023 and
# nothing tests against it. Kept so that reinstating support is a matter of
# starting a container rather than writing one (see ADR-009).
mysql-5_7:
image: sqlpilot-test-mysql-57
build:
<<: *seed-build
dockerfile_inline: |
FROM mysql:5.7
COPY --chmod=0444 seed.sql /docker-entrypoint-initdb.d/01-seed.sql
container_name: mas-mysql-57
environment:
MYSQL_ROOT_PASSWORD: test_root_password
MYSQL_DATABASE: test_db
MYSQL_USER: test_user
MYSQL_PASSWORD: test_password
ports:
- "13307:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--protocol=TCP", "-u", "root", "-ptest_root_password"]
interval: 5s
timeout: 3s
retries: 30
start_period: 30s
mariadb-11:
image: sqlpilot-test-mariadb-11
build:
<<: *seed-build
dockerfile_inline: |
FROM mariadb:11
COPY --chmod=0444 seed.sql /docker-entrypoint-initdb.d/01-seed.sql
container_name: mas-mariadb-11
environment:
MYSQL_ROOT_PASSWORD: test_root_password
MYSQL_DATABASE: test_db
MYSQL_USER: test_user
MYSQL_PASSWORD: test_password
ports:
- "13308:3306"
healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "127.0.0.1", "--protocol=TCP", "-u", "root", "-ptest_root_password"]
interval: 5s
timeout: 3s
retries: 30
start_period: 30s
# Defined, never started. SSL configuration is real code with no test — a
# known gap rather than a claim (ADR-009). Still bind-mounts its files:
# the certificates are generated locally and not in git, so an image could
# not be built without them. :z relabels the mounts for SELinux hosts.
mysql-ssl:
image: mysql:8.0
container_name: mas-mysql-ssl
environment:
MYSQL_ROOT_PASSWORD: test_root_password
MYSQL_DATABASE: test_db
ports:
- "13309:3306"
volumes:
- ./tests/fixtures/ssl/server-cert.pem:/etc/mysql/ssl/server-cert.pem:ro,z
- ./tests/fixtures/ssl/server-key.pem:/etc/mysql/ssl/server-key.pem:ro,z
- ./tests/fixtures/ssl/ca-cert.pem:/etc/mysql/ssl/ca-cert.pem:ro,z
- ./tests/fixtures/ssl/my.cnf:/etc/mysql/conf.d/ssl.cnf:ro,z
command: >
--require-secure-transport=ON
--ssl-ca=/etc/mysql/ssl/ca-cert.pem
--ssl-cert=/etc/mysql/ssl/server-cert.pem
--ssl-key=/etc/mysql/ssl/server-key.pem
healthcheck:
# require-secure-transport rejects an unencrypted TCP ping, so this one
# service stays on the unix socket, which is exempt. It has no seed
# script, so the temporary-server race the TCP checks avoid cannot
# arise here.
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-ptest_root_password"]
interval: 5s
timeout: 3s
retries: 30
start_period: 30s