Commit Graph

674 Commits

Author SHA1 Message Date
Indra Gunawan
87315a19ae feat: introduces worker name option, use label on worker metrics instead (#1376)
* add worker name option and use it in logs and metrics, update tests

* fix missing reference for collector

* update tests

* update docs

* fix conflict

* add missing allowedDirectives

* update tests
2025-03-22 12:32:59 +01:00
Jerry Ma
3bc426482a feat: add glibc-based static binary (#1438)
* Add gnu static binary build support

* Remove --libc option

* configure ./build-static.sh to allow extension loading with glibc

* use tabs everywhere

* do not use prebuilt sources for glibc build

* ffi does not work with musl builds

* remove unnecessary tabs

* disable opcache jit on musl

* disable opcache jit on musl again

* err, build command, not download command

* cs fixes

* spellcheck

* even more cs fixes

* fix ar removing .a libs

* disable ffi extension for now

* add gnu static action

* add gnu-static target

* skip CHECKOV 2 and 3

* rename static-builder to static-builder-musl, gnu-static to static-builder-gnu
run arm64 gnu job on ubuntu-arm

* rename build-linux to build-linux-musl

* rename job description to specify musl

* higher optimisation flags

* Update docker-bake.hcl

---------

Co-authored-by: DubbleClick <m@pyc.ac>
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-03-22 11:41:47 +01:00
Kévin Dunglas
341b0240c9 ci: include version in BuildInfo and Prometheus metrics (#1418) 2025-03-19 13:27:28 +01:00
Alexander Stecher
432824edf1 fix: ensure env is not in an invalid state on shutdown (#1442) 2025-03-19 13:22:06 +01:00
Alexander Stecher
9cca12858b feat: maximum wait times (#1445) 2025-03-19 13:21:37 +01:00
Alexander Stecher
cc473ee03e fix: better max_threads calculation (#1446) 2025-03-19 13:21:10 +01:00
Alexander Stecher
93266dfcad feat(watcher): log last changed file (#1447)
* logs last changed file.

* Fixes race condition.

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
2025-03-19 13:10:02 +01:00
dependabot[bot]
6203d207fa chore(caddy): bump github.com/caddyserver/certmagic in /caddy
Bumps [github.com/caddyserver/certmagic](https://github.com/caddyserver/certmagic) from 0.21.7 to 0.22.0.
- [Release notes](https://github.com/caddyserver/certmagic/releases)
- [Commits](https://github.com/caddyserver/certmagic/compare/v0.21.7...v0.22.0)

---
updated-dependencies:
- dependency-name: github.com/caddyserver/certmagic
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-12 15:30:22 +01:00
Kévin Dunglas
424ca426cb fix: timeouts handling on macOS (#1435)
* ci: run tests on macOS

* debug

* debug

* fix

* nobrotli

* install brotli

* fix

* fix

* Also registers php.ini if ZEND_MAX_EXECUTION_TIMERS is disabled.

* Removes max_execution_time from tests (it gets overwritten on mac)

* tiny refacto

* fix free

* cs

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
2025-03-11 17:34:49 +01:00
Alexander Stecher
a9cf944b62 ci: env test remediation (#1436)
* nbParallell

* trigger build

* Update frankenphp_test.go

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-03-10 22:59:18 +01:00
Alexander Stecher
8d9ce15849 fix: log worker failures (#1437)
* Small fixes on error.

* Adds comments.

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
2025-03-10 22:49:58 +01:00
Kévin Dunglas
409c0fdf5f chore: bump deps (#1434) 2025-03-10 15:35:17 +01:00
Alexander Stecher
f50248a7d2 refactor: removes context on the C side (#1404) 2025-03-10 08:44:03 +01:00
Alexander Stecher
09b8219ad4 fix(caddy): stricter configuration handling (#1424)
* Adds warnings.

* trigger build

* Errors on wrong configuration.

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
2025-03-10 08:43:37 +01:00
Alexander Stecher
f2bae25a78 chore: update static build cli PHP version to 8.4 (#1425) 2025-03-09 17:04:06 +01:00
dependabot[bot]
3dd90a3071 ci: bump super-linter/super-linter from 7.2.1 to 7.3.0
Bumps [super-linter/super-linter](https://github.com/super-linter/super-linter) from 7.2.1 to 7.3.0.
- [Release notes](https://github.com/super-linter/super-linter/releases)
- [Changelog](https://github.com/super-linter/super-linter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/super-linter/super-linter/compare/v7.2.1...v7.3.0)

---
updated-dependencies:
- dependency-name: super-linter/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-03 23:22:37 +01:00
Alexander Stecher
c57f741d83 fix: concurrent env access (#1409) 2025-03-01 14:45:04 +01:00
Alexander Stecher
3ba4e257a1 fix: only drain workers on graceful shutdown (#1405)
* Only drains workers on shutdown.

* trigger build

* Marks func as experimental.

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
2025-02-28 12:10:00 +01:00
Alexander Stecher
619c903386 perf: nocallback and noescape cgo flags (#1406) 2025-02-28 12:08:08 +01:00
Kévin Dunglas
78824107f0 docs: Homebrew installation instructions 2025-02-27 17:17:10 +01:00
Kévin Dunglas
f64c0f948e chore: remove unused executePHPFunction (#1398) 2025-02-21 19:09:54 +01:00
Alexander Stecher
db3e1a047c fix: race condition revealed by tests (#1403)
* Resolves a race condition

* Removes unused code.

* trigger build

* Removes accidental files.

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
2025-02-21 19:09:08 +01:00
Kévin Dunglas
80f13f07ea docs: fix typos (#1399) 2025-02-21 13:55:37 +01:00
Alliballibaba2
072151dfee feat: Adds automatic thread scaling at runtime and php_ini configuration in Caddyfile (#1266)
Adds option to scale threads at runtime

Adds php_ini configuration in Caddyfile
2025-02-19 20:39:33 +01:00
Kévin Dunglas
965fa6570c chore: prepare release 1.4.4 caddy/v1.4.4 v1.4.4 2025-02-19 12:43:26 +01:00
Kévin Dunglas
251567a617 fix: Mercure duplicate metrics panic (#1393)
* fix: Mercure duplicate metrics panic

* tidy

* ci: clang-format
2025-02-19 12:40:59 +01:00
Indra Gunawan
57e7747b9b fix: duplicate metrics collector registration attempted panic 2025-02-19 12:18:40 +01:00
Niels Dossche
f109f0403b perf: avoid redundant work in frankenphp_release_temporary_streams()
Persistent streams are of type le_pstream, not le_stream. Therefore, the
persistent check will always be false. We can thus replace that check
with an assertion.

`zend_list_delete` removes the entry from the regular_list table, and
calls `zend_resource_dtor` via the table destructor.
When the refcount is 1, `zend_list_close` calls `zend_resource_dtor`,
but keeps the entry in the table.
Multiple calls to `zend_resource_dtor` have no effect: the destructor is
only called once.
Therefore, the `zend_list_close` operation is redundant because it is
fully included in the work done by `zend_list_delete`.
2025-02-19 00:16:00 +01:00
Kévin Dunglas
d407dbd498 chore: prepare release 1.4.3 caddy/v1.4.3 v1.4.3 2025-02-18 09:19:00 +01:00
Kévin Dunglas
d970309544 ci: upgrade watcher to the latest stable version (#1385)
* ci: workaround to compile the latest version of watcher

* remove workaround
2025-02-18 09:17:44 +01:00
Niels Dossche
30bf69cbe5 perf: avoid extra string allocation in get_full_env() (#1382)
* Avoid extra string allocation in get_full_env()

We can pass the key directly to add_assoc_str().

* Use add_assoc_str_ex
2025-02-18 09:11:23 +01:00
Kévin Dunglas
f61bc180c4 chore: upgrade to Go 1.24 2025-02-18 07:33:36 +01:00
Alexander Stecher
9f5e7a9eaa fix(watcher): handles associated events (#1379)
* Handles associated events.

* triggers pipeline

* Adjusts comment.

* Uses fixed version.

* Update watch_pattern_test.go

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-02-17 23:47:27 +01:00
Kévin Dunglas
a5ca60da44 chore: fix markdown linter (#1384) 2025-02-17 23:46:11 +01:00
Indra Gunawan
1c097a6fdf feat(caddy): use logger from Caddy context (#1369) 2025-02-17 10:32:15 +01:00
Indra Gunawan
233753ca6b docs: update docs for first-time contributor (#1368) 2025-02-17 10:31:33 +01:00
Indra Gunawan
9dd05b0b1b docs: link metrics docs to website (#1370) 2025-02-17 10:30:58 +01:00
Indra Gunawan
4c92633396 fix: missing metrics with Caddy 2.9 (#1366)
* fix missing metrics

* update tests

* use interface instead
2025-02-12 12:55:53 +01:00
Zhanbolat Yerkinbay
be2e4714f5 docs: translate to RU (#1325)
* README.md

* worker.md

* early-hints.md

* config.md

* docker.md

* production.md

* fix

* mercure.md

* performance.md

* embed.md

* compile.md

* static.md

* laravel.md

* known-issues.md

* fix links

* github-actions.md

* metrics.md

* CONTRIBUTING.md

* fix

* fix

* fix

* main review fix

---------

Co-authored-by: zhanbolat <z.yerkinbay@slotegrator.space>
2025-01-29 18:09:48 +01:00
Kévin Dunglas
941f218a79 chore: prepare release 1.4.2 caddy/v1.4.2 v1.4.2 2025-01-28 11:22:00 +01:00
Kévin Dunglas
7bd6ca89b0 chore: bump deps 2025-01-28 11:19:14 +01:00
dependabot[bot]
5342d34126 ci: bump docker/bake-action from 5 to 6
Bumps [docker/bake-action](https://github.com/docker/bake-action) from 5 to 6.
- [Release notes](https://github.com/docker/bake-action/releases)
- [Commits](https://github.com/docker/bake-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: docker/bake-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-27 23:07:00 +01:00
Alexander Stecher
dd250e3bda perf: optimized request headers (#1335)
* Optimizes header registration.

* Adds malformed cookie tests.

* Sets key to NULL (releasing them is unnecessary)

* Adjusts test.

* Sanitizes null bytes anyways.

* Sorts headers.

* trigger

* clang-format

* More clang-format.

* Updates headers and tests.

* Adds header test.

* Adds more headers.

* Updates headers again.

* ?Removes comments.

* ?Reformats headers

* ?Reformats headers

* renames header files.

* ?Renames test.

* ?Fixes assertion.

* test

* test

* test

* Moves headers test to main package.

* Properly capitalizes headers.

* Allows and tests multiple cookie headers.

* Fixes comment.

* Adds otter back in.

* Verifies correct capitalization.

* Resets package version.

* Removes debug log.

* Makes persistent strings also interned and saves them once on the main thread.

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
2025-01-27 21:48:20 +01:00
Alexander Stecher
7e39e0a201 Fix: only flush temporary unreferenced streams (#1351)
* Only flush temporary streams.
---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
2025-01-27 00:25:12 +01:00
Rob Landers
05aafc7c44 fix memory leaks (#1350)
* fix a memory leak on thread shutdown

* clean up unused resources at end of request

* try the obvious

* Test

* clang-format

* Also ignores persistent streams.

* Adds stream test.

* Moves clean up function to frankenphp_worker_request_shutdown.

* Fixes test on -nowatcher

* Fixes test on -nowatcher

* Update testdata/file-stream.txt

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Update frankenphp_test.go

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-01-25 22:54:04 +01:00
Viktor Szépe
eee1de147e chore: fix CS (#1345) 2025-01-21 11:27:46 +01:00
Viktor Szépe
ece420c569 chore: fix typos (#1328)
* Fix typos

* Fix indentation
2025-01-21 00:32:52 +01:00
Alexander Stecher
2f4c8310e2 fix - flushing temporary files after each worker request (#1321)
* Removes temporary fix and flushes files on each request.
2025-01-20 18:45:00 +01:00
Kévin Dunglas
d712aed2a5 chore: prepare release 1.4.1 caddy/v1.4.1 v1.4.1 2025-01-19 23:41:10 +01:00
Rob Landers
d0b259df42 ensure worker failures do not count fatal errors during the request (#1336)
* ensure worker failures do not count fatal errors during the request

* only count towards the backoff if it was not in a request
2025-01-18 19:30:25 +01:00