1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-03 17:14:08 +02:00

basic frankenphp support

fixes #17
This commit is contained in:
Robin Appelman 2026-03-22 14:10:19 +01:00
commit 3b4014b5e4
9 changed files with 83 additions and 41 deletions

View file

@ -84,4 +84,11 @@ if [ -n "${PROXY_BASE:-}" ]; then
cp /etc/supervisor/dnsmasq.conf /etc/supervisor/enabled/ cp /etc/supervisor/dnsmasq.conf /etc/supervisor/enabled/
fi fi
if [ -n "${FRANKENPHP:-}" ]; then
cp /etc/supervisor/frankenphp.conf /etc/supervisor/enabled/
else
cp /etc/supervisor/php-fpm.conf /etc/supervisor/enabled/
cp /etc/supervisor/nginx.conf /etc/supervisor/enabled/
fi
exec supervisord -c /etc/supervisor/supervisord.conf exec supervisord -c /etc/supervisor/supervisord.conf

View file

@ -0,0 +1,3 @@
[program:frankenphp]
command = /bin/frankenphp php-server
directory = /var/www/html

View file

@ -0,0 +1,2 @@
[program:nginx]
command = /bin/nginx -c /etc/nginx.conf

View file

@ -0,0 +1,2 @@
[program:php-fpm]
command = /bin/php-fpm --fpm-config /etc/php-fpm.conf

View file

@ -8,18 +8,11 @@ pidfile = /var/run/supervisord.pid
file = /var/run/supervisor.sock file = /var/run/supervisor.sock
chmod = 0777 chmod = 0777
[rpcinterface:supervisor] [rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl] [supervisorctl]
serverurl = unix:///var/run/supervisor.sock serverurl = unix:///var/run/supervisor.sock
[program:nginx]
command = /bin/nginx -c /etc/nginx.conf
[program:php-fpm]
command = /bin/php-fpm --fpm-config /etc/php-fpm.conf
[include] [include]
files = enabled/* files = enabled/*

View file

@ -35,6 +35,7 @@
helix, helix,
python3Packages, python3Packages,
dnsmasq, dnsmasq,
frankenphp,
}: let }: let
inherit (builtins) toString; inherit (builtins) toString;
inherit (lib) readFile getExe concatStringsSep splitString take; inherit (lib) readFile getExe concatStringsSep splitString take;
@ -163,6 +164,12 @@
phpEnv phpEnv
phpEnv.packages.composer phpEnv.packages.composer
phpunit phpunit
(frankenphp.override {
php = php.withExtensions (import ./php-ext.nix {
inherit lib php;
enableBlackfire = false;
});
})
]; ];
}; };
in in

44
nix/image/php-ext.nix Normal file
View file

@ -0,0 +1,44 @@
{
lib,
php,
debug ? false,
enableBlackfire ? true,
}: let
inherit (builtins) compareVersions;
inherit (lib) optionals;
withBlackfire = enableBlackfire && !debug && ((compareVersions php.version "8.1.0") == 1);
in
{
enabled,
all,
}:
enabled
++ (with all;
[
xdebug
excimer
inotify
redis
oci8
zip
pdo
pdo_pgsql
pdo_sqlite
pdo_mysql
pgsql
intl
curl
mbstring
pcntl
ldap
exif
gmp
apcu
ffi
]
++ optionals (!debug) [
smbclient # this breaks the build for no apparent reason
]
++ optionals withBlackfire [
blackfire
])

View file

@ -8,40 +8,7 @@
withBlackfire = !debug && ((compareVersions php.version "8.1.0") == 1); withBlackfire = !debug && ((compareVersions php.version "8.1.0") == 1);
in in
php.buildEnv { php.buildEnv {
extensions = { extensions = import ./php-ext.nix {inherit lib php debug;};
enabled,
all,
}:
enabled
++ (with all;
[
xdebug
excimer
inotify
redis
oci8
zip
pdo
pdo_pgsql
pdo_sqlite
pdo_mysql
pgsql
intl
curl
mbstring
pcntl
ldap
exif
gmp
apcu
ffi
]
++ optionals (!debug) [
smbclient # this breaks the build for no apparent reason
]
++ optionals withBlackfire [
blackfire
]);
extraConfig = '' extraConfig = ''
xdebug.mode=debug,trace,profile xdebug.mode=debug,trace,profile
xdebug.start_with_request=trigger xdebug.start_with_request=trigger

View file

@ -207,6 +207,19 @@ impl ServiceTrait for RedisTls {
} }
} }
#[derive(Clone, Eq, PartialEq, Debug)]
pub struct FrankenPhp;
impl ServiceTrait for FrankenPhp {
fn name(&self) -> &str {
"franken-php"
}
fn env(&self) -> &[&str] {
&["FRANKENPHP=1"]
}
}
#[derive( #[derive(
Copy, Clone, Debug, PartialEq, EnumString, EnumMessage, EnumIter, IntoStaticStr, Display, Copy, Clone, Debug, PartialEq, EnumString, EnumMessage, EnumIter, IntoStaticStr, Display,
)] )]
@ -281,6 +294,8 @@ pub enum ServiceType {
Redis, Redis,
/// External redis instance with TLS /// External redis instance with TLS
RedisTls, RedisTls,
/// Use FrankenPHP instead of PHP-FPM
FrankenPhp,
} }
#[enum_dispatch] #[enum_dispatch]
@ -310,6 +325,7 @@ pub enum Service {
Mail(Mail), Mail(Mail),
Redis(Redis), Redis(Redis),
RedisTls(RedisTls), RedisTls(RedisTls),
FrankenPhp(FrankenPhp),
Preset(PresetService), Preset(PresetService),
} }
@ -352,6 +368,7 @@ impl Service {
ServiceType::Mail => Some(vec![Service::Mail(Mail)]), ServiceType::Mail => Some(vec![Service::Mail(Mail)]),
ServiceType::Redis => Some(vec![Service::Redis(Redis)]), ServiceType::Redis => Some(vec![Service::Redis(Redis)]),
ServiceType::RedisTls => Some(vec![Service::RedisTls(RedisTls)]), ServiceType::RedisTls => Some(vec![Service::RedisTls(RedisTls)]),
ServiceType::FrankenPhp => Some(vec![Service::FrankenPhp(FrankenPhp)]),
} }
} else { } else {
presets presets