How to install supervisor on Debian

Post Reply
User avatar
isscbta
Team Member
Posts: 129
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 14 times
Been thanked: 3 times

Supervisor is a client-server system that provides its users the ability to keep an eye on and manage multiple processes on UNIX-based operating systems.

It shares a similar objective with programs such as launchd, daemontools, and runit. However, unlike these programs, it is not designed to replace the init process as the primary process (process ID 1). Instead, it is intended to be utilized for controlling processes that are related to a specific project or customer and can be initiated just like any other program during boot time.

In the following steps, we will guide you through the installation process of supervisor on a Debian server.

In your SSH, as root, run:

Code: Select all

apt update
apt-get install supervisor
mcedit /etc/supervisor/conf.d/PROJECTNAME.conf
Put there the following config example:

Code: Select all

[program:PROJECTNAME]
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php8.1 /home/SOMEUSER/web/DOMAIN.COM/public_html/artisan queue:work --timeout=0
autostart=true
autorestart=true
numprocs=8
user=SOMEUSER
redirect_stderr=true
stdout_logfile=/home/SOMEUSER/worker.log
stopwaitsecs=3600
In this example adapt PROJECTNAME, SOMEUSER, DOMAIN.COM and eventually path to public_html/ folder to your case.
Also addapt 'command' line, maybe you are not using 'artisan' as presented in previous example.
Also check what PHP version you are using, maybe it's not php8.1 as presented in previous example.

At the end reload supervisor by running the following in your SSH:

Code: Select all

supervisorctl reread
supervisorctl update
Post Reply