Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
192 lines (186 loc) Β· 8.37 KB
/
Copy pathcompose.yaml
File metadata and controls
192 lines (186 loc) Β· 8.37 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
services:
wordpress:
image: wordpress:${WORDPRESS_VERSION:-6.8}-php${PHP_VERSION:-8.1}
container_name: simple-history-wordpress
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
user: "33:33"
depends_on:
db:
condition: service_healthy
# The image copies WordPress core into the shared volume *after* the
# container starts, which takes 10-20s on a fresh volume (`docker compose
# down -v`, or a WORDPRESS_VERSION switch). php-cli's WPLoader reads that
# volume with no wait or retry, so `service_started` would hand it a
# half-copied core. wp-config.php is written once the copy is done.
healthcheck:
test:
[
"CMD-SHELL",
"test -f /var/www/html/wp-config.php && test -f /var/www/html/wp-includes/version.php",
]
interval: 5s
timeout: 5s
retries: 30
start_period: 30s
ports:
- "${DOCKER_WEB_PORT_FORWARD:-9191}:80"
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wp_test_site
WORDPRESS_DB_USER: dbuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_CONFIG_EXTRA: |
define( 'WP_AUTO_UPDATE_CORE', false );
define( 'AUTOMATIC_UPDATER_DISABLED', true );
define( 'DISABLE_WP_CRON', true );
define( 'WP_ENVIRONMENT_TYPE', 'local' );
volumes:
- wordpress:/var/www/html
- ./:/var/www/html/wp-content/plugins/simple-history
- ./tests/plugins/akismet:/var/www/html/wp-content/plugins/akismet
- ./tests/plugins/jetpack:/var/www/html/wp-content/plugins/jetpack
- ./tests/plugins/wp-crontrol:/var/www/html/wp-content/plugins/wp-crontrol
- ./tests/plugins/duplicate-post:/var/www/html/wp-content/plugins/duplicate-post
- ./tests/plugins/redirection:/var/www/html/wp-content/plugins/redirection
- ./tests/plugins/enable-media-replace:/var/www/html/wp-content/plugins/enable-media-replace
- ./tests/plugins/user-switching:/var/www/html/wp-content/plugins/user-switching
- ./tests/plugins/developer-loggers-for-simple-history:/var/www/html/wp-content/plugins/developer-loggers-for-simple-history
- ./tests/_data/plugins/issue-373-disable-core-loggers:/var/www/html/wp-content/plugins/issue-373-disable-core-loggers
- ./tests/plugins/simple-history-premium:/var/www/html/wp-content/plugins/simple-history-premium
- ./tests/_data/mu-plugins:/var/www/html/wp-content/mu-plugins
- "${WP_UPLOADS_DIR:-./data/wp-uploads}:/var/www/html/wp-content/uploads"
db:
image: "${DB_IMAGE:-mariadb:10.5}"
container_name: simple-history-database
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
# Without this, `docker compose run php-cli` returns as soon as the db
# container has *started*, not when it accepts connections, and the test
# run races the database on any cold machine.
# mysqladmin rather than the mariadb image's healthcheck.sh: the
# npm test:mysql55/57 scripts swap DB_IMAGE for mysql images that do not
# ship that script, but every one of them has mysqladmin.
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-u", "root", "-prootpass"]
interval: 5s
timeout: 5s
retries: 30
start_period: 30s
environment:
MYSQL_DATABASE: wp_test_site
MYSQL_USER: dbuser
MYSQL_PASSWORD: examplepass
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_ROOT_HOST: "%"
ports:
- "${DB_EXPOSE_PORT:-127.0.0.1:}:3306"
volumes:
- "${DB_DATA_DIR:-./data/mysql}:/var/lib/mysql"
# Creates tests_db for the wpunit suite on first start. Only runs on an
# empty data directory, so it never touches an existing local database.
- ./docker/db-init:/docker-entrypoint-initdb.d:ro
chrome:
image: selenium/standalone-chromium:145.0
shm_size: "2gb"
container_name: simple-history-chrome
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
# Selenium needs ~10s after the container starts before it accepts
# sessions. `npm run test:acceptance` waits on this healthcheck; without
# it the first WPWebDriver action dies with a curl connection error on a
# cold stack. check-grid.sh ships in the image for exactly this.
healthcheck:
test: ["CMD", "/opt/bin/check-grid.sh", "--host", "0.0.0.0", "--port", "4444"]
interval: 5s
timeout: 5s
retries: 20
start_period: 20s
# ports:
# - 14444:4444
extra_hosts:
- host.docker.internal:host-gateway
# Lightweight PHP service for linting (phpcs, phpstan, rector).
# Does not depend on any other docker services.
# Contains composer.
php-lint:
image: dockette/ci:php${PHP_CLI_VERSION:-81}
init: true
container_name: simple-history-php-lint
profiles:
- noautostart
working_dir: /srv
volumes:
- ./:/srv
# Full PHP CLI for tests.
# Needs wordpress: that service populates the shared `wordpress` volume with
# WordPress core, which WPLoader (wp-browser 3.x) loads rather than installing
# its own. Does NOT need chrome β only the acceptance suite talks to it, and
# `npm run test:acceptance` starts it. Keeping chrome here made every wpunit
# run boot a 1GB Selenium container for nothing.
php-cli:
image: dockette/ci:php${PHP_CLI_VERSION:-81}
init: true
container_name: simple-history-php-cli
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wp_test_site
WORDPRESS_DB_USER: dbuser
WORDPRESS_DB_PASSWORD: examplepass
profiles:
- noautostart
working_dir: /srv
volumes:
- ./:/srv
- wordpress:/wordpress
- ./:/wordpress/wp-content/plugins/simple-history
- ./tests/plugins/akismet:/wordpress/wp-content/plugins/akismet
- ./tests/plugins/jetpack:/wordpress/wp-content/plugins/jetpack
- ./tests/plugins/wp-crontrol:/wordpress/wp-content/plugins/wp-crontrol
- ./tests/plugins/duplicate-post:/wordpress/wp-content/plugins/duplicate-post
- ./tests/plugins/redirection:/wordpress/wp-content/plugins/redirection
- ./tests/plugins/enable-media-replace:/wordpress/wp-content/plugins/enable-media-replace
- ./tests/plugins/user-switching:/wordpress/wp-content/plugins/user-switching
- ./tests/_data/plugins/issue-373-disable-core-loggers:/wordpress/wp-content/plugins/issue-373-disable-core-loggers
- ./tests/plugins/simple-history-premium:/wordpress/wp-content/plugins/simple-history-premium
- ./tests/_data/mu-plugins:/wordpress/wp-content/mu-plugins
depends_on:
db:
condition: service_healthy
wordpress:
condition: service_healthy
wp-cli:
image: wordpress:cli-php${PHP_VERSION:-7.4}
container_name: simple-history-wpcli
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_NAME: wp_test_site
WORDPRESS_DB_USER: dbuser
WORDPRESS_DB_PASSWORD: examplepass
user: "33:33"
depends_on:
db:
condition: service_healthy
wordpress:
condition: service_healthy
init: true
volumes:
- wordpress:/var/www/html:rw
# Make tests folder available so we can export/import db.
- ./tests/_data/:/var/www/html/tests/_data:rw
- ./:/var/www/html/wp-content/plugins/simple-history
- ./tests/plugins/akismet:/var/www/html/wp-content/plugins/akismet
- ./tests/plugins/jetpack:/var/www/html/wp-content/plugins/jetpack
- ./tests/plugins/wp-crontrol:/var/www/html/wp-content/plugins/wp-crontrol
- ./tests/plugins/duplicate-post:/var/www/html/wp-content/plugins/duplicate-post
- ./tests/plugins/redirection:/var/www/html/wp-content/plugins/redirection
- ./tests/plugins/enable-media-replace:/var/www/html/wp-content/plugins/enable-media-replace
- ./tests/plugins/user-switching:/var/www/html/wp-content/plugins/user-switching
- ./tests/plugins/developer-loggers-for-simple-history:/var/www/html/wp-content/plugins/developer-loggers-for-simple-history
- ./tests/_data/plugins/issue-373-disable-core-loggers:/var/www/html/wp-content/plugins/issue-373-disable-core-loggers
- ./tests/_data/mu-plugins:/var/www/html/wp-content/mu-plugins
# Same uploads directory the wordpress service serves. Without it
# wp-cli sees the volume's own (root-owned, empty) uploads directory
# and anything it writes or deletes there is invisible to the site.
- "${WP_UPLOADS_DIR:-./data/wp-uploads}:/var/www/html/wp-content/uploads"
profiles:
- noautostart
volumes:
wordpress: null