Use PHP-FPM for local dev while still using RoadRunner in production.
This commit is contained in:
parent
e2a4005077
commit
4ab8fe667b
|
@ -81,6 +81,7 @@ final class ServiceControl
|
|||
'mariadb' => __('Database'),
|
||||
'nginx' => __('Web server'),
|
||||
'roadrunner' => __('Roadrunner PHP Server'),
|
||||
'php-fpm' => __('PHP FastCGI Process Manager'),
|
||||
'php-nowplaying' => __('Now Playing manager service'),
|
||||
'php-worker' => __('PHP queue processing worker'),
|
||||
'redis' => __('Cache'),
|
||||
|
@ -102,6 +103,7 @@ final class ServiceControl
|
|||
}
|
||||
|
||||
if (!$this->environment->isDevelopment()) {
|
||||
unset($services['php-fpm']);
|
||||
unset($services['vite']);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
[global]
|
||||
error_log = /dev/stderr
|
||||
daemonize = no
|
||||
|
||||
[www]
|
||||
user = azuracast
|
||||
group = azuracast
|
||||
listen = 127.0.0.1:6080
|
||||
|
||||
pm = ondemand
|
||||
pm.max_children = 20
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 2
|
||||
pm.max_spare_servers = 4
|
||||
pm.max_requests = 200
|
||||
pm.status_path = /status
|
||||
pm.process_idle_timeout = 60s
|
||||
|
||||
chdir = /
|
||||
clear_env=No
|
||||
catch_workers_output = yes
|
||||
decorate_workers_output = no
|
||||
process.dumpable = yes
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
source /etc/php/.version
|
||||
|
||||
cp /etc/php/${PHP_VERSION}/cli/conf.d/05-azuracast.ini /etc/php/${PHP_VERSION}/fpm/conf.d/05-azuracast.ini
|
||||
|
||||
gosu azuracast azuracast_php_startup
|
||||
|
||||
# Run PHP-FPM
|
||||
exec /usr/sbin/php-fpm${PHP_VERSION} -F --fpm-config /etc/php/${PHP_VERSION}/fpm/php-fpm.conf \
|
||||
-c /etc/php/${PHP_VERSION}/fpm/
|
|
@ -0,0 +1,14 @@
|
|||
[program:php-fpm]
|
||||
command=run_php_fpm
|
||||
priority=300
|
||||
numprocs=1
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
stopasgroup=true
|
||||
killasgroup=true
|
||||
|
||||
stdout_logfile=/proc/1/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/proc/1/fd/2
|
||||
stderr_logfile_maxbytes=0
|
|
@ -7,7 +7,7 @@ export DEBIAN_FRONTEND=noninteractive
|
|||
apt-get update
|
||||
|
||||
# Install common scripts
|
||||
# cp -rT /bd_build/dev/scripts/ /usr/local/bin
|
||||
cp -rT /bd_build/dev/scripts/ /usr/local/bin
|
||||
|
||||
# cp -rT /bd_build/dev/startup_scripts/. /etc/my_init.d/
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
|
||||
source /etc/php/.version
|
||||
|
||||
apt-get install -y --no-install-recommends php${PHP_VERSION}-xdebug
|
|
@ -4,6 +4,14 @@ set -x
|
|||
|
||||
source /etc/php/.version
|
||||
|
||||
# Install dev PHP stuff
|
||||
apt-get install -y --no-install-recommends php${PHP_VERSION}-fpm php${PHP_VERSION}-xdebug
|
||||
|
||||
mkdir -p /run/php
|
||||
touch /run/php/php${PHP_VERSION}-fpm.pid
|
||||
|
||||
cp /bd_build/dev/php/www.conf /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf
|
||||
|
||||
# Install PHP SPX profiler
|
||||
apt-get install -y --no-install-recommends php${PHP_VERSION}-dev zlib1g-dev build-essential
|
||||
|
||||
|
@ -20,3 +28,4 @@ apt-get remove --purge -y php${PHP_VERSION}-dev zlib1g-dev build-essential
|
|||
|
||||
echo "extension=spx.so" > /etc/php/${PHP_VERSION}/mods-available/30-spx.ini
|
||||
ln -s /etc/php/${PHP_VERSION}/mods-available/30-spx.ini /etc/php/${PHP_VERSION}/cli/conf.d/30-spx.ini
|
||||
ln -s /etc/php/${PHP_VERSION}/mods-available/30-spx.ini /etc/php/${PHP_VERSION}/fpm/conf.d/30-spx.ini
|
|
@ -1,15 +1,22 @@
|
|||
upstream roadrunner {
|
||||
server 127.0.0.1:6090;
|
||||
}
|
||||
|
||||
upstream centrifugo {
|
||||
server 127.0.0.1:6020;
|
||||
}
|
||||
|
||||
{{if eq .Env.APPLICATION_ENV "development"}}
|
||||
upstream vite {
|
||||
server 127.0.0.1:5173;
|
||||
}
|
||||
upstream php {
|
||||
server 127.0.0.1:6080;
|
||||
}
|
||||
|
||||
upstream vite {
|
||||
server 127.0.0.1:5173;
|
||||
}
|
||||
|
||||
{{else}}
|
||||
|
||||
upstream php {
|
||||
server 127.0.0.1:6090;
|
||||
}
|
||||
|
||||
{{end}}
|
||||
|
||||
server {
|
||||
|
@ -97,9 +104,13 @@ server {
|
|||
|
||||
location ~ ^/index\.php(/|$) {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass roadrunner;
|
||||
fastcgi_read_timeout {{ default .Env.NGINX_TIMEOUT "1800" }};
|
||||
fastcgi_buffering off;
|
||||
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||
fastcgi_pass php;
|
||||
internal;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ apt-get install -y --no-install-recommends php${PHP_VERSION}-cli php${PHP_VERSIO
|
|||
# Copy PHP configuration
|
||||
echo "PHP_VERSION=$PHP_VERSION" >> /etc/php/.version
|
||||
|
||||
cp /bd_build/web/php/php.ini.tmpl /etc/php/${PHP_VERSION}/cli/05-azuracast.ini.tmpl
|
||||
cp /bd_build/web/php/php.ini.tmpl /etc/php/${PHP_VERSION}/05-azuracast.ini.tmpl
|
||||
|
||||
# Enable FFI (for StereoTool inspection)
|
||||
echo 'ffi.enable="true"' >> /etc/php/${PHP_VERSION}/mods-available/ffi.ini
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
source /etc/php/.version
|
||||
|
||||
dockerize -template "/etc/php/${PHP_VERSION}/cli/05-azuracast.ini.tmpl:/etc/php/${PHP_VERSION}/cli/conf.d/05-azuracast.ini"
|
||||
dockerize -template "/etc/php/${PHP_VERSION}/05-azuracast.ini.tmpl:/etc/php/${PHP_VERSION}/cli/conf.d/05-azuracast.ini"
|
||||
|
|
Loading…
Reference in New Issue