nixPkgs = ["...", "python311Packages.supervisor"]
"mkdir -p /etc/supervisor/conf.d/",
"cp /assets/worker-*.conf /etc/supervisor/conf.d/",
"cp /assets/supervisord.conf /etc/supervisord.conf",
"chmod +x /assets/start.sh",
# Transform the nginx configuration
node /assets/scripts/prestart.mjs /assets/nginx.template.conf /etc/nginx.conf
supervisord -c /etc/supervisord.conf -n
file=/assets/supervisor.sock
logfile=/var/log/supervisord.log
pidfile=/assets/supervisord.pid
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
serverurl=unix:///assets/supervisor.sock
files = /etc/supervisor/conf.d/*.conf
"worker-nginx.conf" = '''
process_name=%(program_name)s_%(process_num)02d
command=nginx -c /etc/nginx.conf
stdout_logfile=/var/log/worker-nginx.log
stderr_logfile=/var/log/worker-nginx.log
"worker-phpfpm.conf" = '''
process_name=%(program_name)s_%(process_num)02d
command=php-fpm -y /assets/php-fpm.conf -F
stdout_logfile=/var/log/worker-phpfpm.log
stderr_logfile=/var/log/worker-phpfpm.log
"worker-laravel.conf" = '''
process_name=%(program_name)s_%(process_num)02d
command=bash -c 'exec php /app/artisan queue:work --sleep=3 --tries=3 --max-time=3600'
stdout_logfile=/var/log/worker-laravel.log
stderr_logfile=/var/log/worker-laravel.log
pm.max_spare_servers = 32
"nginx.template.conf" = '''
worker_rlimit_nofile 8192;
worker_connections 4096; # Default: 1024
include $!{nginx}/conf/mime.types;
index index.html index.htm index.php;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx-access.log;
error_log /var/log/nginx-error.log;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts
$if(NIXPACKS_PHP_ROOT_DIR) (
root ${NIXPACKS_PHP_ROOT_DIR};
add_header X-Content-Type-Options "nosniff";
client_max_body_size 35M;
try_files $uri $uri/ /index.php?$query_string;
$if(NIXPACKS_PHP_FALLBACK_PATH) (
try_files $uri $uri/ ${NIXPACKS_PHP_FALLBACK_PATH}?$query_string;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include $!{nginx}/conf/fastcgi_params;
include $!{nginx}/conf/fastcgi.conf;
fastcgi_param PHP_VALUE "upload_max_filesize=30M \n post_max_size=35M";
location ~ /\.(?!well-known).* {