Developer Tools

How to run background workers with Supervisor

~3 min read

Supervisor is a process manager that keeps background workers (like Laravel queue workers or Node.js processes) running continuously and restarts them automatically if they crash.

Before you start

  • Supervisor installed (enable it during stack installation)

Steps

  1. 1

    Open Supervisor

    Open your server and click "Supervisor" in the sidebar.

  2. 2

    Click Add Worker

    Click "Add Worker" to configure a new background process.

  3. 3

    Enter a name

    Give the worker a descriptive name (e.g. laravel-queue or node-app). This is how it appears in the Supervisor list.

  4. 4

    Enter the command

    Enter the full command to run. Use absolute paths for both the executable and the script.

    /usr/bin/php /var/www/mysite.com/artisan queue:work --sleep=3 --tries=3 --max-time=3600
  5. 5

    Set the number of processes

    For most apps, 1 process is sufficient. For high-throughput queues, increase this to 2–4. Each process runs the command independently.

  6. 6

    Save and start

    Click "Save". DeployFly creates the Supervisor program config and starts it. The status changes to "running".

  7. 7

    Monitor the worker

    Click "View Logs" to see stdout/stderr output from the worker. Use this to debug startup errors.

Watch out

  • If Supervisor is not installed, go to your server's Install tab and enable it. Installing after the initial stack setup requires re-running the installer.

Tips

  • For Laravel queues, the `--max-time=3600` flag restarts the worker every hour, which prevents memory leaks in long-running processes.
  • Supervisor automatically restarts the worker if it exits unexpectedly. No manual restart needed after a crash.

Related guides