mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-01 20:55:16 +09:00
Give new WordPress sites PhpRedis and MySQL 8.4
Object Cache Pro refuses to start without the redis PHP extension, which the upstream wordpress image does not ship, so the runtime image now builds it and fails the build if it does not load. Site Health flags MySQL 8.0 as outdated and WordPress recommends 8.4, so new sites are created on 8.4. Existing sites keep the database they have; nothing upgrades a data directory in place. Fixes #252 Fixes #253
This commit is contained in:
1 parent
ccfd68607b
commit
9d97a1c305
3 files changed
+23
-1
No files matched your search
@@ -92,6 +92,10 @@ files:
|
||||
FROM wordpress:${VERSION}
|
||||
RUN php -r '$v=PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION; $min=["8.2"=>"8.2.35","8.3"=>"8.3.36"]; exit(isset($min[$v]) && version_compare(PHP_VERSION,$min[$v],">=") ? 0 : 1);' \
|
||||
&& docker-php-ext-install pdo_mysql
|
||||
RUN pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
&& rm -rf /tmp/pear \
|
||||
&& php -r 'exit(extension_loaded("redis") ? 0 : 1);'
|
||||
RUN printf 'session.upload_progress.enabled=0\n' > /usr/local/etc/php/conf.d/zz-serverkit-security.ini \
|
||||
&& printf 'php_admin_flag session.upload_progress.enabled Off\n' > /etc/apache2/conf-available/serverkit-php-security.conf \
|
||||
&& a2enconf serverkit-php-security
|
||||
@@ -77,7 +77,7 @@ compose:
|
||||
restart: unless-stopped
|
||||
|
||||
db:
|
||||
image: mysql:8.0
|
||||
image: mysql:8.4
|
||||
container_name: ${APP_NAME}-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
@@ -98,6 +98,10 @@ files:
|
||||
FROM wordpress:${VERSION}
|
||||
RUN php -r '$v=PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION; $min=["8.2"=>"8.2.35","8.3"=>"8.3.36"]; exit(isset($min[$v]) && version_compare(PHP_VERSION,$min[$v],">=") ? 0 : 1);' \
|
||||
&& docker-php-ext-install pdo_mysql
|
||||
RUN pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
&& rm -rf /tmp/pear \
|
||||
&& php -r 'exit(extension_loaded("redis") ? 0 : 1);'
|
||||
RUN printf 'session.upload_progress.enabled=0\n' > /usr/local/etc/php/conf.d/zz-serverkit-security.ini \
|
||||
&& printf 'php_admin_flag session.upload_progress.enabled Off\n' > /etc/apache2/conf-available/serverkit-php-security.conf \
|
||||
&& a2enconf serverkit-php-security
|
||||
@@ -21,3 +21,17 @@ def test_wordpress_build_files_do_not_become_container_mounts(tmp_path, name):
|
||||
assert 'FROM wordpress:7.1.3-php8.3-apache' in dockerfile
|
||||
assert '8.3.36' in dockerfile and 'pdo_mysql' in dockerfile
|
||||
assert 'php_admin_flag session.upload_progress.enabled Off' in dockerfile
|
||||
# Issue #252: Object Cache Pro refuses to start without PhpRedis, and the
|
||||
# upstream image does not ship it. Verified in the build, like pdo_mysql.
|
||||
assert 'pecl install redis' in dockerfile and 'docker-php-ext-enable redis' in dockerfile
|
||||
assert 'extension_loaded("redis")' in dockerfile
|
||||
# A collapsed line continuation would still be one valid-looking string.
|
||||
assert all(line.endswith('\\') or line.startswith((' && php', ' && docker-php-ext-install',
|
||||
' && a2enconf'))
|
||||
for line in dockerfile.splitlines() if line.startswith(('RUN', ' &&')))
|
||||
|
||||
|
||||
def test_new_wordpress_sites_get_the_mysql_wordpress_recommends():
|
||||
# Issue #253: Site Health flags MySQL 8.0 as outdated; WordPress asks for 8.4+.
|
||||
template = yaml.safe_load((Path(__file__).parents[1] / 'templates' / 'wordpress.yaml').read_text())
|
||||
assert template['compose']['services']['db']['image'] == 'mysql:8.4'
|
||||
Reference in new issue
Block a user