fix: include FrankenPHP version in startup logs#2551
Conversation
|
To me, this shouldn't be configurable with a Go API. This is already doable using build flags. I don't want to introduce the API surface for that. |
|
Thanks, addressed in 73e6a61. I removed the public Go option and the Caddy parser. The startup log version is now kept internal to the frankenphp package and set from Docker build flags with: -X github.com/dunglas/frankenphp.frankenPHPVersion=$FRANKENPHP_VERSIONLocal validation: ./go.sh test -run TestStartupLogAttrsIncludeBuildFlagFrankenPHPVersion -count=1 .
FRANKENPHP_EXPECT_LDFLAG_VERSION=1.12.4-test ./go.sh test -ldflags "-X github.com/dunglas/frankenphp.frankenPHPVersion=1.12.4-test" -run TestStartupLogAttrsIncludeBuildFlagFrankenPHPVersion -count=1 .
./go.sh test -count=1 . |
|
I don't understand why this is necessary. We already have the caddy version string which includes the frankenphp version? |
73e6a61 to
522dcf4
Compare
|
Good point. The existing Caddy custom version is still the source used by {"php_version":"...","num_threads":...,"max_threads":...,"max_requests":...}I updated the patch so it does not add another Go ldflag or parse Caddy’s version string. FrankenPHP already has the Validated locally in the builder image: ./go.sh test -run TestStartupLogAttrsIncludeFrankenPHPVersion -count=1 .
FRANKENPHP_EXPECT_VERSION=1.12.4-test CGO_CFLAGS="-DFRANKENPHP_VERSION=1.12.4-test" ./go.sh test -run TestStartupLogAttrsIncludeFrankenPHPVersion -count=1 .
./go.sh test -count=1 . |
522dcf4 to
7f214db
Compare
7f214db to
c47ae88
Compare
|
Addressed the remaining review follow-up: Validation: the pushed SHA |
|
I still don't understand the use case for having the version number in logs. |
|
@dunglas the use case is environments where operators only have access to centralized logs and not necessarily interactive shell access to the running instance. The startup log currently includes php_version, num_threads, max_threads and max_requests, but not the FrankenPHP version. Recording it there provides a simple deployment trace and helps identify which FrankenPHP version was started when reviewing startup logs. WDYT? |
Summary
FRANKENPHP_VERSIONC build flag through a package-local cgo helper.Test verification (RED -> GREEN)
RED on
origin/mainwith the new startup-log test copied in:GREEN after the review cleanup:
Additional validation: