The process
The program must stay in the foreground: don’t add &, nohup or a “daemon” option.
How long a stop waits for the current job to finish before killing it.
More options
Leave empty for Supervisor’s default and the systemd journal.
One KEY=value per line. Keep secrets in the app’s own .env file instead.
Supervisor
systemd
Supervisor or systemd?
Both start a process when the server boots, restart it if it crashes and stop it cleanly. Use whichever you already have:
- systemd is built into Ubuntu, Debian, Red Hat and every other mainstream Linux distribution, so there is nothing to install. Several copies of the same worker use a template unit (
name@.service) started asname@1,name@2and so on. - Supervisor is what the Laravel documentation uses, and what Laravel Forge and many hosting panels set up. It runs several copies with
numprocsand gives you one command,supervisorctl, to manage them.
Don’t run the same worker under both, or you’ll have twice as many workers as you think.
Laravel queue workers
A queue worker is a long-running PHP process that loads your code once. Three settings matter:
- Stop timeout: when you stop or restart a worker, it finishes the job it’s working on first. The stop timeout (
stopwaitsecsin Supervisor,TimeoutStopSecin systemd) must be longer than your longest job, or the job is killed halfway. Laravel’s documentation uses 3600 seconds. - --max-time: makes each worker exit after a set time so it’s restarted fresh, which keeps memory leaks in check.
- queue:restart after deploys: workers keep running the old code until they restart. Add
php artisan queue:restartto your deploy script; Supervisor or systemd starts them again with the new code.
Our guide to keeping a Laravel queue worker running covers the setup step by step. Horizon is different: run exactly one php artisan horizon process, and set the number of workers in config/horizon.php.
Node.js and Python apps
Node.js and Gunicorn apps work the same way: one process (or several, behind Nginx) that must keep running. Bind the app to 127.0.0.1 and put Nginx in front of it; the Nginx Config Generator’s reverse proxy option writes that config. If Node.js was installed with nvm, or Python packages live in a virtualenv, use the full path to the program in the command, because services don’t load your shell’s PATH.
Checking logs
With Supervisor, output goes to the log file in the config; read it with tail -f or supervisorctl tail -f name. With systemd, output goes to the journal unless you set a log file: journalctl -u name -f. If a process keeps restarting, the last lines there say why: usually a wrong path, a missing permission, or a missing environment variable.
Everything is generated in your browser. Nothing you type is sent to Cloudhim.