Skip to content

Commit 56b358f

Browse files
committed
Enhance logging and SSL generation scripts
- Updated the `LOG_OUTPUT_LEVEL` description in the documentation to clarify verbosity levels and their impact on logging behavior. - Modified the entrypoint script to remove unnecessary checks for `LOG_OUTPUT_LEVEL` when displaying container info. - Added checks in the SSL generation script to conditionally log messages based on the `LOG_OUTPUT_LEVEL`, improving debugging capabilities.
1 parent a64e1bf commit 56b358f

4 files changed

Lines changed: 17 additions & 6 deletions

File tree

docs/content/docs/8.reference/1.environment-variable-specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Setting environment variables all depends on what method you're using to run you
6565
`HEALTHCHECK_PATH`<br />*Default: "/healthcheck"*|Set the path for the health check endpoint. (<a target="_blank" href="https://docs.docker.com/engine/reference/builder/#healthcheck">Official docs</a>)|all (except `cli` and `frankenphp`)
6666
`HEALTHCHECK_SSL_CERTIFICATE_FILE`<br />*Default: "/etc/ssl/healthcheck/localhost.crt"*|Set the path to the SSL certificate for the health check endpoint.| fpm-apache, fpm-nginx, frankenphp
6767
`HEALTHCHECK_SSL_PRIVATE_KEY_FILE`<br />*Default: "/etc/ssl/healthcheck/localhost.key"*|Set the path to the SSL private key for the health check endpoint.| fpm-apache, fpm-nginx, frankenphp
68-
`LOG_OUTPUT_LEVEL`<br />*Default:* <br /> *"warn" (for all)* <br /> *"info" (for frankenphp)*|Set your container output different verbosity levels: debug, warn, info, off |all
68+
`LOG_OUTPUT_LEVEL`<br />*Default:* <br /> *"warn" (for all)* <br /> *"info" (for frankenphp)*|Set the verbosity level for container output and service logs. Valid values (least to most verbose): `emerg`, `alert`, `crit`, `error`, `warn`, `notice`, `info`, `debug`. Each level is translated to the native log configuration for PHP, PHP-FPM, and the active web server. <br />ℹ️ FrankenPHP defaults to `info` because Caddy unifies access and error logs — setting `warn` would suppress HTTP request logs entirely (unlike Apache/NGINX where access logs are a separate directive).|all
6969
`NGINX_ACCESS_LOG`<br />*Default: "/dev/stdout"*|Set the default output stream for access log.|fpm-nginx
7070
`NGINX_ERROR_LOG`<br />*Default: "/dev/stderr"*|Set the default output stream for error log.|fpm-nginx
7171
`NGINX_FASTCGI_BUFFERS`<br />*Default: "8 8k"*|Sets the number and size of the buffers used for reading a response from a FastCGI server. (<a target="_blank" href="https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffers">Official Docs</a>)|fpm-nginx

src/common/etc/entrypoint.d/0-container-info.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
2-
if [ "$SHOW_WELCOME_MESSAGE" = "false" ] || [ "$LOG_OUTPUT_LEVEL" = "off" ] || [ "$DISABLE_DEFAULT_CONFIG" = "true" ]; then
2+
if [ "$SHOW_WELCOME_MESSAGE" = "false" ] || [ "$DISABLE_DEFAULT_CONFIG" = "true" ]; then
33
if [ "$LOG_OUTPUT_LEVEL" = "debug" ]; then
4-
echo "👉 $0: Container info was display was skipped."
4+
echo "👉 $0: Container info display was skipped."
55
fi
66
# Skip the rest of the script
77
exit 0

src/common/usr/local/bin/docker-php-serversideup-entrypoint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fi
1313

1414
# Check if the default command is being used
1515
case "$1" in
16-
"/init" | "php-fpm")
16+
"/init" | "php-fpm" | "frankenphp")
1717
SERVERSIDEUP_DEFAULT_COMMAND="true"
1818
;;
1919
esac

src/utilities-webservers/etc/entrypoint.d/5-generate-ssl.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,23 @@ if [ "$DISABLE_DEFAULT_CONFIG" = "true" ]; then
99
exit 0
1010
fi
1111

12+
if [ "$SERVERSIDEUP_DEFAULT_COMMAND" != "true" ]; then
13+
if [ "$LOG_OUTPUT_LEVEL" = "debug" ]; then
14+
echo "👉 $script_name: SERVERSIDEUP_DEFAULT_COMMAND is not true, so we won't generate a self-signed SSL key pair."
15+
fi
16+
exit 0
17+
fi
18+
1219
SSL_CERTIFICATE_FILE=${SSL_CERTIFICATE_FILE:-"/etc/ssl/private/self-signed-web.crt"}
1320
SSL_PRIVATE_KEY_FILE=${SSL_PRIVATE_KEY_FILE:-"/etc/ssl/private/self-signed-web.key"}
1421
SSL_MODE=${SSL_MODE:-"off"}
1522
HEALTHCHECK_SSL_CERTIFICATE_FILE=${HEALTHCHECK_SSL_CERTIFICATE_FILE:-"/etc/ssl/healthcheck/localhost.crt"}
1623
HEALTHCHECK_SSL_PRIVATE_KEY_FILE=${HEALTHCHECK_SSL_PRIVATE_KEY_FILE:-"/etc/ssl/healthcheck/localhost.key"}
1724

1825
if [ "$SSL_MODE" = "off" ]; then
19-
echo "ℹ️ NOTICE ($script_name): SSL mode is off, so we won't generate a self-signed SSL key pair."
26+
if [ "$LOG_OUTPUT_LEVEL" = "debug" ]; then
27+
echo "👉 $script_name: SSL mode is off, so we won't generate a self-signed SSL key pair."
28+
fi
2029
return 0
2130
fi
2231

@@ -45,7 +54,9 @@ if [ -d "/etc/frankenphp/" ]; then
4554
fi
4655

4756
if [ -f "$SSL_CERTIFICATE_FILE" ] && [ -f "$SSL_PRIVATE_KEY_FILE" ]; then
48-
echo "ℹ️ NOTICE ($script_name): SSL certificate and private key already exist, so we'll use the existing files."
57+
if [ "$LOG_OUTPUT_LEVEL" = "debug" ]; then
58+
echo "👉 $script_name: SSL certificate and private key already exist, so we'll use the existing files."
59+
fi
4960
return 0
5061
fi
5162

0 commit comments

Comments
 (0)