Supervisor & Background Workers
Supervisor & Background Workers
Queue workers, schedulers and long-running scripts must keep running after you log out and come back when they crash. The Supervisor app gives the panel a front end for supervisord: you define programs, start and stop their processes and read their logs without a shell. Hosting accounts can be allowed to run their own workers too.
Requirements
- Panel version 1.4.1 or later. Supervisor is a free app in the Vinza Store.
- Installing the app installs the
supervisorpackage if it is missing, enables and starts it, and adds a small event listener for alerts. - Open it from Management → Supervisor (
/apps/supervisor/). The dot next to the menu item is green when supervisord runs, red when it is stopped and grey when the panel cannot reach its system agent.
The full page is for administrators, because a program can run any command as any user. Hosting accounts get a confined Background workers page (see below).
Create a program
- On the Programs tab press New program.
- Optionally pick Start from a template — Laravel queue worker, Laravel Horizon, Celery worker, Celery beat, Node.js script or Generic worker — and adjust the paths and user to your app.
- Enter the fields below and press Save & apply.
| Field | What it means |
|---|---|
| Program name | Letters, digits, dot, dash and underscore. Becomes the config file name and cannot be changed later. |
| Command | An absolute path, for example /usr/bin/php /home/user/web/example.com/artisan queue:work. Supervisor does not run a shell, so pipes, redirects and ~ are literal text. |
| Working directory | The folder the command runs from; relative paths in the command start here. |
| Run as user | The Linux user. Empty runs it as root — avoid that for application code. |
| Environment | Comma-separated KEY=value pairs; hidden while you type. |
| Processes | How many copies run, 1–64. |
| Auto restart | Always, On unexpected exit or Never. |
| Start seconds | How long it must stay up to count as started (0–3600). |
| Stop wait seconds | Grace period after SIGTERM before SIGKILL. Give queue workers time to finish a job. |
| Priority | Start order, 0–999. |
| Start with supervisor, Stop child processes, Kill child processes | autostart, stopasgroup and killasgroup. |
| Restart after a deploy | See the next section. |
Each field is checked before it is written to /etc/supervisor/conf.d/<name>.conf. Saving refuses an interpreter command whose script is missing or is a folder (for example php …/site queue:work with artisan left out), or whose interpreter is not installed. Saving or deleting runs reread + update; deleting stops the program first. If supervisord rejects the configuration, the change is rolled back and reported.
Restart workers after a Git Manager deploy
A queue worker keeps running the old code until it restarts. Tick Restart after a deploy on the program (the templates turn it on). After a successful deploy of a website, the panel restarts the flagged programs that:
- run as the Linux user that owns that website, and
- have their Working directory in the website's folder or a folder inside it.
It works for deploys from Git Manager (Deploy (pull), Reset & deploy and push-to-deploy webhooks, after the post-deploy commands have run) and from the Python, Node.js and Go deploy apps. It needs Git Manager 1.2.1, Python Deploy 1.0.12, Node.js Deploy 1.0.11 or Go Deploy 1.1.7 or later. A failed deploy restarts nothing, and programs of other users are never touched. The process list marks such programs with Restarts after a deploy.
Set the working directory to the site folder, for example /home/<user>/web/<domain>, and the run-as user to the site owner. With /var/www/app and www-data from a template left unchanged, a deploy will not restart the worker.
Processes and logs
The Processes tab shows each process with State, PID, CPU, Memory (children included) and Uptime. Start, stop and restart per process, or use Start all, Restart all and Stop all. Filter by owner (All owners, Admin programs or one account) and turn Auto refresh on or off. Apply config runs reread + update.
Logs shows stdout or stderr. You can filter lines, Download the newest 1 MB and Clear the log. When a process is not running, a Why it is not running box shows the last exit code and what it means.
Groups and history
The Groups tab combines programs so you can start, stop or restart them together; grouped processes are addressed as group:program. History lists who changed, started or stopped what, admins and hosting accounts alike.
Alerts
When a program goes FATAL or keeps restarting (3 exits within 10 minutes), the admin gets a panel notification and a message on their alert channels. A hosting account is told about its own workers.
Background workers for hosting accounts
- Give the account the permission Can run own background workers (Supervisor), on the user's Permissions or for the group under Administration → Groups (see Users & Roles). A worker can run any command as the account's Linux user, like a cron job.
- Set the limits under Hosting accounts on the Supervisor page: Workers per account and Processes per worker (default 5 and 2), with Exceptions per plan or account. An account's own limit wins over its hosting plan's, which wins over the default.
The account then opens Supervisor in its sidebar and sees Background workers. It presses New worker, picks the Website and a Template — Laravel queue worker, Horizon or scheduler, Symfony Messenger consumer, PHP script, Django Celery worker or beat, Django management command, Python script or Node.js script — and the command, folder and the site's PHP version or Python virtualenv are filled in. Its workers always run as its own Linux user, from a folder in its home.
The supervisor service
The page header can start, stop and restart supervisord itself. Stopping it stops every supervised process.
Troubleshooting
- FATAL right after start: open Logs and the Why it is not running box. Usually a wrong path, a missing dependency, or a Start seconds value longer than the program stays up.
- Empty logs and exit at once: the script path in the command is wrong; use absolute paths.
- Supervisor is not running on this server (hosting account): ask the administrator to start the service.