Add shared httpd + PHP-FPM-only container architecture
Some checks failed
Cloud Apache Container / Build-and-Push (74) (push) Successful in 2m22s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 3m14s
Cloud Apache Container / Build-and-Push (82) (push) Has been cancelled
Cloud Apache Container / Build-and-Push (83) (push) Has been cancelled
Cloud Apache Container / Build-and-Push (84) (push) Has been cancelled
Cloud Apache Container / Build-and-Push (85) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (74) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (80) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (81) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (82) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (83) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (84) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (85) (push) Has been cancelled
Cloud Apache Container / Build-Shared-httpd (push) Has been cancelled
Cloud Apache Container / Build-and-Push (81) (push) Has been cancelled
Some checks failed
Cloud Apache Container / Build-and-Push (74) (push) Successful in 2m22s
Cloud Apache Container / Build-and-Push (80) (push) Successful in 3m14s
Cloud Apache Container / Build-and-Push (82) (push) Has been cancelled
Cloud Apache Container / Build-and-Push (83) (push) Has been cancelled
Cloud Apache Container / Build-and-Push (84) (push) Has been cancelled
Cloud Apache Container / Build-and-Push (85) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (74) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (80) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (81) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (82) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (83) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (84) (push) Has been cancelled
Cloud Apache Container / Build-FPM-Images (85) (push) Has been cancelled
Cloud Apache Container / Build-Shared-httpd (push) Has been cancelled
Cloud Apache Container / Build-and-Push (81) (push) Has been cancelled
Separate Apache and PHP-FPM into distinct container roles to reduce per-customer memory overhead on shared servers. Adds three new images: - Dockerfile.fpm: PHP-FPM only (no Apache), listens on TCP port 9000 - Dockerfile.shared-httpd: Apache only (no PHP), with SSL and proxy_fcgi - Existing Dockerfile unchanged for standalone mode Key changes: - detect-memory.sh: CONTAINER_ROLE env var (combined/fpm_only/httpd_only) controls the memory budget split - create-php-config.sh: FPM_LISTEN env var for TCP port vs Unix socket, added /fpm-ping and /fpm-status health endpoints - New entrypoints for each container role - tune-mpm.sh for hot-adjusting Apache MPM settings - shared-vhost-template.tpl with proxy_fcgi and SSL on port 443 - CI/CD builds all three image types in parallel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,15 +2,28 @@
|
||||
|
||||
rm /etc/php-fpm.d/www.conf
|
||||
|
||||
FPM_LISTEN=${FPM_LISTEN:-/run/php-fpm/www.sock}
|
||||
|
||||
# Determine listen directive and ownership based on socket vs TCP
|
||||
if echo "$FPM_LISTEN" | grep -q '/'; then
|
||||
# Unix socket mode
|
||||
listen_directive="$FPM_LISTEN"
|
||||
listen_owner_block="listen.owner = apache
|
||||
listen.group = apache"
|
||||
else
|
||||
# TCP port mode
|
||||
listen_directive="0.0.0.0:${FPM_LISTEN}"
|
||||
listen_owner_block=""
|
||||
fi
|
||||
|
||||
cat <<EOF > /etc/php-fpm.d/$user.conf
|
||||
|
||||
[$user]
|
||||
|
||||
user = $user
|
||||
group = $user
|
||||
listen = /run/php-fpm/www.sock
|
||||
listen.owner = apache
|
||||
listen.group = apache
|
||||
listen = ${listen_directive}
|
||||
${listen_owner_block}
|
||||
|
||||
pm = ${PHP_FPM_PM}
|
||||
pm.max_children = ${PHP_FPM_MAX_CHILDREN}
|
||||
@@ -22,7 +35,12 @@ pm.start_servers = ${PHP_FPM_START_SERVERS}
|
||||
pm.min_spare_servers = ${PHP_FPM_MIN_SPARE}
|
||||
pm.max_spare_servers = ${PHP_FPM_MAX_SPARE}
|
||||
|
||||
slowlog = /etc/httpd/logs/error_log
|
||||
; Health check endpoints
|
||||
ping.path = /fpm-ping
|
||||
ping.response = pong
|
||||
pm.status_path = /fpm-status
|
||||
|
||||
slowlog = /home/$user/logs/php-fpm/slowlog
|
||||
request_slowlog_timeout = 3s
|
||||
|
||||
php_admin_value[error_log] = /home/$user/logs/php-fpm/error.log
|
||||
|
||||
Reference in New Issue
Block a user