Compare commits

..

1 Commits

Author SHA1 Message Date
Lance Pioch
7a41804097 docker: fix healthcheck so the HTTP check actually runs
The condition '[ ${SKIP_CADDY} ! "true" ]' is invalid test syntax and
evaluated false in every configuration, so the curl check against /up
never ran and only php-fpm's FCGI socket was verified. A wedged Caddy or
fatally erroring app still reported healthy.

Also probe every 30s instead of 5m so failures are detected promptly, and
raise start-period to 2m since boot runs migrations and filament:optimize.
2026-07-15 20:33:08 -04:00
7 changed files with 7 additions and 51 deletions

View File

@@ -84,9 +84,6 @@ RUN mkdir -p /pelican-data/storage /var/run/supervisord \
&& chown -R www-data: /pelican-data .env ./storage ./bootstrap/cache /var/run/supervisord /var/www/html/public/storage \
&& chmod -R 770 /pelican-data ./storage ./bootstrap/cache /var/run/supervisord \
&& chown -R www-data: /usr/local/etc/php/ /usr/local/etc/php-fpm.d/ /var/www/html/composer.json /var/www/html/composer.lock
# Configure PHP and PHP-FPM
COPY docker/php/pelican.ini /usr/local/etc/php/conf.d/zz-pelican.ini
COPY docker/php/pelican-pool.conf /usr/local/etc/php-fpm.d/zz-pelican.conf
# Configure Supervisor
COPY docker/supervisord.conf /etc/supervisord.conf
COPY docker/Caddyfile /etc/caddy/Caddyfile
@@ -96,7 +93,7 @@ COPY docker/crontab /etc/crontabs/crontab
COPY docker/entrypoint.sh /entrypoint.sh
COPY docker/healthcheck.sh /healthcheck.sh
HEALTHCHECK --interval=5m --timeout=10s --start-period=5s --retries=3 \
HEALTHCHECK --interval=30s --timeout=10s --start-period=2m --retries=3 \
CMD /bin/ash /healthcheck.sh
EXPOSE 80 443

View File

@@ -5,9 +5,6 @@ FROM --platform=$TARGETOS/$TARGETARCH php:8.5-fpm-alpine
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN install-php-extensions bcmath gd intl zip opcache pcntl pdo_mysql pdo_pgsql bz2
RUN install-php-extensions bcmath gd intl zip pcntl pdo_mysql pdo_pgsql bz2
RUN rm /usr/local/bin/install-php-extensions
# Use the production php.ini shipped with the image as the baseline
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

View File

@@ -5,13 +5,10 @@ FROM --platform=$TARGETOS/$TARGETARCH php:8.5-fpm-alpine AS base
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN install-php-extensions bcmath gd intl zip opcache pcntl pdo_mysql pdo_pgsql bz2
RUN install-php-extensions bcmath gd intl zip pcntl pdo_mysql pdo_pgsql bz2
RUN rm /usr/local/bin/install-php-extensions
# Use the production php.ini shipped with the image as the baseline
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# ================================
# Stage 1-1: Composer Install
# ================================
@@ -93,9 +90,6 @@ RUN mkdir -p /pelican-data/storage /var/run/supervisord \
&& chmod -R 770 /pelican-data ./storage ./bootstrap/cache /var/run/supervisord \
&& chown -R www-data: /usr/local/etc/php/ /usr/local/etc/php-fpm.d/ /var/www/html/composer.json /var/www/html/composer.lock
# Configure PHP and PHP-FPM
COPY docker/php/pelican.ini /usr/local/etc/php/conf.d/zz-pelican.ini
COPY docker/php/pelican-pool.conf /usr/local/etc/php-fpm.d/zz-pelican.conf
# Configure Supervisor
COPY docker/supervisord.conf /etc/supervisord.conf
COPY docker/Caddyfile /etc/caddy/Caddyfile
@@ -105,7 +99,7 @@ COPY docker/crontab /etc/crontabs/crontab
COPY docker/entrypoint.sh /entrypoint.sh
COPY docker/healthcheck.sh /healthcheck.sh
HEALTHCHECK --interval=5m --timeout=10s --start-period=5s --retries=3 \
HEALTHCHECK --interval=30s --timeout=10s --start-period=2m --retries=3 \
CMD /bin/ash /healthcheck.sh
EXPOSE 80 443

View File

@@ -66,12 +66,6 @@ fi
echo "Optimizing Filament"
php artisan filament:optimize
# Note: config/route/event caches are intentionally NOT built here. Settings
# live in .env and are edited at runtime, and plugins register providers (and
# routes) at runtime - those caches would freeze them until the next restart.
echo "Caching Blade views"
php artisan view:cache
# default to caddy not starting
export SUPERVISORD_CADDY=false
export CADDY_APP_URL="${APP_URL}"

View File

@@ -1,9 +1,9 @@
#!/bin/ash -e
if [ ${SKIP_CADDY} ! "true" ]; then
curl -f http://localhost/up || exit 1
if [ "${SKIP_CADDY:-false}" != "true" ]; then
curl -sf http://localhost/up || exit 1
fi
cgi-fcgi -bind -connect 127.0.0.1:9000 || exit 2
exit 0
exit 0

View File

@@ -1,12 +0,0 @@
; Pelican overrides for the default www pool.
; The image default of pm.max_children = 5 caps the panel at five concurrent
; PHP requests. Sizing assumes roughly 64-128MB per worker; lower
; pm.max_children on very small hosts.
[www]
pm = dynamic
pm.max_children = 15
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 8
; recycle workers periodically to guard against memory leaks
pm.max_requests = 500

View File

@@ -1,14 +0,0 @@
; Pelican overrides, layered on top of php.ini-production
; Filament recommends at least 256M
memory_limit = 256M
[opcache]
opcache.enable = 1
opcache.memory_consumption = 192
opcache.interned_strings_buffer = 32
opcache.max_accelerated_files = 30000
; keep timestamp validation enabled so runtime plugin installs pick up
; new and changed files without a container restart
opcache.validate_timestamps = 1
opcache.revalidate_freq = 2