|
| 1 | +--- |
| 2 | +hidden: true |
| 3 | +--- |
| 4 | +# Supervisord |
| 5 | +Supervisor(d) is a process control system that allows you to run, monitor, and manage long-running programs on your server. It starts configured processes, keeps them running, restarts them if they fail, and provides command-line tools for checking status, stopping, starting, and restarting services. It is commonly used to manage application workers, background jobs, and other supporting processes in a simple and consistent way. |
| 6 | + |
| 7 | +## Enabling it via the TurboStack Platform |
| 8 | +You can enable this setting by going to your server in the TurboStack Platform, then going to `Advanced` > `Operating System`. Here you'll find the `Supervisord Support` slider. |
| 9 | + |
| 10 | +After enabling this setting, publish the config to start the installation. |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +## Enabling it via the YAML editor |
| 15 | +You can enable this setting by adding the following to your TurboStack config: |
| 16 | + |
| 17 | +```yaml |
| 18 | +supervisor_enabled: true |
| 19 | +``` |
| 20 | +After adding the above config, **publish** the config to start the installation. |
| 21 | +
|
| 22 | +## Configuring your services |
| 23 | +Supervisord services work via `.conf` files. These files can be found in the `~/.config/supervisor/conf.d/` directory. |
| 24 | + |
| 25 | +The **Logs** can be found in the `~/.config/supervisor/log/` directory. |
| 26 | + |
| 27 | +An example of a `.conf` file: |
| 28 | + |
| 29 | +```ini |
| 30 | +[program:messenger-consume] |
| 31 | +command=php /var/www/<USER>/current/bin/console messenger:consume async failed hello_retail --time-limit=3600 --memory-limit=512M |
| 32 | +user=<USER> |
| 33 | +numprocs=4 |
| 34 | +startsecs=0 |
| 35 | +autostart=true |
| 36 | +autorestart=true |
| 37 | +process_name=%(program_name)s_%(process_num)02d |
| 38 | +stdout_logfile=/var/www/<USER>/.config/supervisor/log/messenger-consume.log |
| 39 | +stderr_logfile=/var/www/<USER>/.config/supervisor/log/messenger-consume.error.log |
| 40 | +``` |
| 41 | +**Note**: A config sample can also be found at `~/.config/supervisor/conf.d/00-sample.conf.sample`. |
| 42 | + |
| 43 | +### Enabling your services |
| 44 | +After creating your service file, you will now need to enable it. |
| 45 | +You can do so with the following commands: |
| 46 | +```bash |
| 47 | +supervisorctl reread |
| 48 | +supervisorctl update |
| 49 | +``` |
| 50 | +This will read all the config files in the conf.d directory and enable them. |
| 51 | + |
| 52 | +## Managing your services |
| 53 | +You can use the `supervisorctl` command to manage and troubleshoot your services. |
| 54 | + |
| 55 | +Display all processes and their status: |
| 56 | +```bash |
| 57 | +supervisorctl status |
| 58 | +``` |
| 59 | + |
| 60 | +Start a process: |
| 61 | +```bash |
| 62 | +supervisorctl start <process_name> |
| 63 | +``` |
| 64 | + |
| 65 | +Stop a process: |
| 66 | +```bash |
| 67 | +supervisorctl stop <process_name> |
| 68 | +``` |
| 69 | + |
| 70 | +Restart a process: |
| 71 | +```bash |
| 72 | +supervisorctl restart <process_name> |
| 73 | +``` |
| 74 | + |
| 75 | +Tail the logs of a process: |
| 76 | +```bash |
| 77 | +supervisorctl tail -f <process_name> |
| 78 | +``` |
0 commit comments