Skip to content

Modernize the project: Go 1.27, e2e tests, and bug fixes - #6

Merged
asp24 merged 18 commits into
masterfrom
chore/modernize
Oct 21, 2026
Merged

asp24 merged 18 commits into
masterfrom
chore/modernize

Conversation

@asp24

@asp24 asp24 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

This branch updates the project to Go 1.27, replaces the manual e2e test with automated e2e tests, and fixes the bugs that the new tests found.

Toolchain and CI

  • Go 1.27, all dependencies updated.
  • pflag and viper-lite replaced with go-flags. The names of the flags and the environment variables do not change. --help shows the environment variables.
  • Travis CI (Go 1.10, glide) replaced with GitHub Actions: lint, unit tests, and e2e tests.
  • The release workflow runs the tests first and builds static binaries (CGO_ENABLED=0). The linux/amd64 binary of 1.0.2 needed glibc and did not start on Alpine images.

E2E tests

The tests start the wrapper with php-fpm in a container (testcontainers-go) as www-data. CI runs them on php:5.6, 7.4, 8.2, 8.3, 8.4, 8.5 (Alpine) and 8.5 (Debian). Run them locally with make e2e.

Fixes

  • --shutdown-delay also applies to SIGQUIT. The php-fpm images have STOPSIGNAL SIGQUIT, so Docker and Kubernetes stopped php-fpm without the delay.
  • The error log proxy writes a line in an unknown format without a change and continues. Before, it stopped at the first such line (decorate_workers_output = no, the default of the official images).
  • The wrapper pipe has mode 0666 for all umask values. Before, workers that run as a different user than the master could not write to it.
  • The wrapper reads the php-fpm config with php-fpm -tt and runs php-fpm with an overlay config in --run-dir. The overlay moves error_log and the slowlogs to FIFOs. This fixes these problems:
    • the error log of the official images (error_log = /proc/self/fd/2 in an included file) was not proxied;
    • a relative include (PHP 7.4 and earlier images) was not found;
    • without root, the wrapper could not use an error_log in /var/log;
    • the wrapper replaced the files of the user with FIFOs.
  • The logger creation error is handled. Before, an unknown --log-encoder caused a panic.

New features

  • --session-cleanup-interval removes expired PHP session files, as the sessionclean cron job of Debian does. It is off by default.
  • --run-dir sets the directory for the generated php-fpm config and the log FIFOs.

Behavior changes

See CHANGELOG.md, section "Unreleased". The most important:

  • error_log = syslog also goes through the proxy. Use --fpm-no-errlog to keep it.
  • An empty environment variable sets an empty value, for example WRAPPER_PIPE=.
  • An argument before -- that is not a flag of the wrapper stops the wrapper at start.
  • --log-level accepts a name or a number from -1 to 5.

@asp24
asp24 merged commit 560c66b into master Oct 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant