Commit Graph

936 Commits

Author SHA1 Message Date
Marc
7fceb32f7b give /var/lib/frankenphp sys_rw_content_t permissions for mercure.db files (#2037)
The current configuration is not able to start FrankenPHP when mercure
and SELinux are used with a Caddyfile like this:

```Caddyfile
mercure {
    transport bolt {
        path mercure.db
    }
}
```

closes https://github.com/php/frankenphp/issues/2035

Exact error:
```
SELinux is preventing /usr/bin/frankenphp from map access on the file /var/lib/frankenphp/mercure.db.

*****  Plugin catchall_boolean (89.3 confidence) suggests   ******************

If you want to allow domain to can mmap files
Then you must tell SELinux about this by enabling the 'domain_can_mmap_files' boolean.

Do
setsebool -P domain_can_mmap_files 1

*****  Plugin catchall (11.6 confidence) suggests   **************************

If you believe that frankenphp should be allowed map access on the mercure.db file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'frankenphp' --raw | audit2allow -M my-frankenphp
# semodule -X 300 -i my-frankenphp.pp


Additional Information:
Source Context                system_u:system_r:httpd_t:s0
Target Context                system_u:object_r:httpd_var_lib_t:s0
Target Objects                /var/lib/frankenphp/mercure.db [ file ]
Source                        frankenphp
Source Path                   /usr/bin/frankenphp
Port                          <Unknown>
Host                          localhost
Source RPM Packages           frankenphp-1.10.0_84-1.x86_64
Target RPM Packages
SELinux Policy RPM            selinux-policy-targeted-3.14.3-139.el8_10.1.noarch
Local Policy RPM              selinux-policy-targeted-3.14.3-139.el8_10.1.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     localhost
Platform                      Linux localhost
                              4.18.0-553.81.1.el8_10.x86_64 #1 SMP Mon Oct 27
                              11:29:19 EDT 2025 x86_64 x86_64
Alert Count                   12
First Seen                    2025-10-29 17:25:26 CET
Last Seen                     2025-11-25 17:18:19 CET
Local ID                      c4e79504-117e-4e9f-ad8c-f0bcc4856697

Raw Audit Messages
type=AVC msg=audit(1764087499.320:475517): avc:  denied  { map } for  pid=322613 comm="frankenphp" path="/var/lib/frankenphp/mercure.db" dev="md3" ino=93716492 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_var_lib_t:s0 tclass=file permissive=0


type=SYSCALL msg=audit(1764087499.320:475517): arch=x86_64 syscall=mmap success=no exit=EACCES a0=0 a1=8000 a2=1 a3=1 items=0 ppid=1 pid=322613 auid=4294967295 uid=991 gid=988 euid=991 suid=991 fsuid=991 egid=988 sgid=988 fsgid=988 tty=(none) ses=4294967295 comm=frankenphp exe=/usr/bin/frankenphp subj=system_u:system_r:httpd_t:s0 key=(null)

Hash: frankenphp,httpd_t,httpd_var_lib_t,file,map
```
2025-11-28 11:11:28 +01:00
Marc
1b30905c26 fox(static): add watcher to defaultExtensionLibs (#2039)
fix https://github.com/php/frankenphp/issues/2038
2025-11-27 00:10:41 +01:00
Alexander Stecher
dadeb5a628 perf: tail latency with goSched (#2033)
Alternate implementation to #2016 that doesn't reduce RPS with lower
amounts of threads
2025-11-26 18:33:07 +01:00
Marc
abaf03c7f7 deduplicate installation instructions in README(#2013) 2025-11-26 08:19:27 +01:00
Kévin Dunglas
fc5f6ef092 chore: prepare release 1.10.1 caddy/v1.10.1 v1.10.1 2025-11-25 10:54:34 +01:00
Marc
65111334a1 docs: update issue template to differentiate between deb and RPM packages 2025-11-25 10:50:38 +01:00
dependabot[bot]
6747aaae2d ci: bump actions/checkout from 5 to 6 in the github-actions group
Bumps the github-actions group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 5 to 6
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-25 10:49:11 +01:00
Kévin Dunglas
6c764ad9c5 fix: correctly set the Mercure hub for the main worker request 2025-11-24 11:21:45 +01:00
Kévin Dunglas
e6b3f70d91 chore: bump deps 2025-11-23 23:13:12 +01:00
Kévin Dunglas
911e6d156b fix: crash when a string is passed for the topics parameter of the mercure_publish() function (#2021) 2025-11-23 17:03:43 +01:00
Kévin Dunglas
c6cadf3bf6 chore: prepare release 1.10.0 caddy/v1.10.0 v1.10.0 2025-11-21 16:16:01 +01:00
Marc
f28f6e8d03 docs: update docs for rpm packages and extension availability (#1988)
continues https://github.com/php/frankenphp/pull/1756

---------

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-11-21 14:31:43 +01:00
Antonin CLAUZIER
01beb66573 ci: PHP 8.5 (#2006)
Co-authored-by: Marc <m@pyc.ac>
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-11-21 13:54:07 +01:00
Kévin Dunglas
41e0713a1b fix: allow null for mercure_publish() retry parameter 2025-11-21 13:52:55 +01:00
Kévin Dunglas
bbfb1b0a0e ci: upgrade macOS runners 2025-11-21 13:51:15 +01:00
Marc
49e98cc8d6 delete source/downloads after building in script, add .editorconfig (#2000)
* delete source/downloads after building in script, not in dockerfile

* add editorconfig

* eol

* cs fix

* added \n there

* we expect Hello\n

* Change tab width for shell scripts to 4 spaces

* bring back embed comment
2025-11-20 11:49:09 +01:00
Kévin Dunglas
c93729e136 chore: use sync.WaitGroup.Go when possible (#1996)
* chore: use sync.WaitGroup.Go when possible

* Update internal/watcher/watcher.go

Co-authored-by: Alexandre Daubois <2144837+alexandre-daubois@users.noreply.github.com>

---------

Co-authored-by: Alexandre Daubois <2144837+alexandre-daubois@users.noreply.github.com>
2025-11-20 11:48:18 +01:00
Kévin Dunglas
ea042637e6 ci: add back ARMv6 build 2025-11-20 11:47:36 +01:00
Marc
0b74507945 don't upx pack on macos (#2003) 2025-11-20 10:19:27 +01:00
Kévin Dunglas
aa1bd23004 ci: use local sources when building with Bake 2025-11-20 05:48:40 +01:00
Marc
02f900bb97 we use "mac" for os-name, not "darwin" (#2001) 2025-11-19 22:11:23 +01:00
Vincent Amstoutz
56df2666e1 ci: add PHP 8.5 support for building images 2025-11-19 16:19:32 +01:00
Marc
1de9073e49 simplify build-static script (#1968)
* simplify build-static script

* we don't require go anymore, since spc will install it

* bring back eof newline

* move to frankenphp-os-arch again

* shell fmt

* Add FrankenPHP Caddy modules to build script
2025-11-19 15:30:00 +01:00
Kévin Dunglas
36062a0dce feat(static): add XSL extension (#1998) 2025-11-19 14:55:53 +01:00
Kévin Dunglas
10cf2c4a2e fix: use the global logger during classes preloading (#1994)
* fix: use the global logger during classes preloading

* better fix

* fix comparision

* Update frankenphp.go
2025-11-19 14:18:29 +01:00
Ahmet Türk
f224f8e391 docs: fix minor typo (#1991) 2025-11-18 14:29:25 +01:00
Alexander Stecher
0b2d3c913f feat: per worker max threads (#1962)
* adds worker max_threads

* Adds tests for all calculation cases.

* Adds max_threads limitation to test.

* Removes the test sleep.

* Adds max_threads to error message.

* correctly uses continue.

* Fixes logic with only worker max_threads set.

* Adjust comments.

* Removes unnecessary check.

* Fixes comment.

* suggestions by @dunlgas.

* copilot suggestions.

* Renames logger.

* review

---------

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-11-18 11:55:29 +01:00
Kévin Dunglas
75a48e81a7 chore: bump deps 2025-11-18 11:48:59 +01:00
Alexandre Daubois
bd943f49de feat(extgen): print gen_stub.php in case of failure 2025-11-18 11:10:03 +01:00
Alexandre Daubois
8f298ab060 fix(extgen): constant should be declared under the namespace provided by export_php:namespace 2025-11-18 10:40:59 +01:00
Kévin Dunglas
41cb2bbeaa feat: mercure_publish() PHP function to dispatch Mercure updates (#1927)
* feat: mercure_publish() PHP function to dispatch Mercure updates

* fix stubs for old versions

* review

* cleanup and fixes
2025-11-18 09:59:53 +01:00
Marc
853cb67e95 shallow clone to save space in CI (#1987)
* shallow clone

* also remove source dir after building in CI

* formatting

* pass them through?

* only CI

* add as variable
2025-11-18 08:48:06 +01:00
Alexandre Daubois
eeb7d1a0c4 fix(extgen): only register ext_functions if functions are declared 2025-11-17 17:40:30 +01:00
Kévin Dunglas
8341cc98c6 refactor: rely on context.Context for log/slog and others (#1969)
* refactor: rely on context.Context for log/slog and others

* optimize

* refactor

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix watcher-skip

* better globals handling

* fix

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-17 16:32:23 +01:00
Alexandre Daubois
40cb42aace chore: bump net 2025-11-17 15:09:30 +01:00
Alexandre Daubois
1e48fbb801 chore(docs): catch-up french translation (#1978) 2025-11-17 12:07:38 +01:00
Alexandre Daubois
4e6d67e0b4 fix(extgen): don't remove everything in the build directory now that there's no build subdir 2025-11-14 15:13:54 +01:00
Alexandre Daubois
18946308fd docs: remove superfluous arg in an example (#1972) 2025-11-14 15:12:56 +01:00
Alexandre Daubois
f7298557aa feat(extgen): automatically add "runtime/cgo" to the imports if necessary 2025-11-14 15:12:28 +01:00
Alexandre Daubois
861b345b05 fix(extgen): replace any by interface{} in the generated go file when dealing with handles 2025-11-14 14:54:40 +01:00
Kévin Dunglas
724c0b11ca feat: set a custom Server header
# Conflicts:
#	caddy/module.go
#	frankenphp.go
2025-11-10 17:25:22 +01:00
dependabot[bot]
63168e087e ci: bump golangci/golangci-lint-action in the github-actions group
Bumps the github-actions group with 1 update: [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action).


Updates `golangci/golangci-lint-action` from 8 to 9
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v8...v9)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-10 17:24:24 +01:00
Kévin Dunglas
6225da9c18 refactor: improve ExtensionWorkers API (#1952)
* refactor: improve ExtensionWorkers API

* Update workerextension.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update workerextension.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update caddy/app.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* review

* fix tests

* docs

* errors

* improved error handling

* fix race

* add missing return

* use %q in Errorf

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-10 14:12:14 +01:00
Alexander Stecher
407ef09ac3 fix: fail immediately on missing worker file (#1963) 2025-11-10 09:23:50 +01:00
Marc
bf4c9fe986 fix test typo (#1964)
* Fix typo in TestFlushEmptyResponse_worker function

* Fix test function name for flush empty response
2025-11-08 08:28:56 +01:00
Marc
b22bdd987b update docs to remove old references to frankenphp:static-builder (#1950)
* update docs to remove old references to frankenphp:static-builder (we have -musl and -gnu)

* remove --platform and make gnu default

* add --platform back in (let dunglas decide)

* fix missed translations
2025-11-07 10:27:37 +01:00
Alexandre Daubois
28d17b39dc chore: bump GitHub Action deps (#1957) 2025-11-04 08:52:23 +01:00
Marc
264f92835d bring back logic for workers to inherit php_server parent environment (#1956)
* bring back logic to inherit php_server parent environment

* change order to account for

php {
    worker file.php 1 {

    }
}
cases

* suggestion

* add inherit env test
2025-11-02 14:50:50 +01:00
Alexandre Daubois
b49aed1934 chore: bump deps 2025-10-31 16:51:26 +01:00
Kévin Dunglas
4d0fb7d0f8 refactor: simplify Init() 2025-10-29 23:14:46 +01:00