Installing Supervisor on CentOS or OL9

Installing Supervisor on OL9 or CentOS , with default configuration and service daemon script

 · 1 min read

Install and configure Redis, Supervisor and Worker for Faveo on Alma Linux  - Faveo Installation Guide

sudo dnf install python3.12

sudo alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2

sudo alternatives --config python3



This is for OL9--

------------------

vim /etc/yum.repos.d/my-add.repo

[Supervisor]

name=Supervisor for Oracle Linux 9 ($basearch)

baseurl=http://yum.oracle.com/repo/OracleLinux/OL9/developer/EPEL/x86_64

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

gpgcheck=0

enabled=1


dnf install supervisor ( For oracle Linux )

--yum install supervisor ( for CentOS , Fedora, or AlmaLinux ) --


sudo dnf install python3-pip

python3.12 -m ensurepip

pip3 install --upgrade pip

python3.12 -m pip install --upgrade pip

pip install supervisor


export PYTHONPATH=/usr/local/lib/python3.12/site-packages

echo 'export PYTHONPATH=/usr/local/lib/python3.12/site-packages' | sudo tee -a /etc/environment

source /etc/environment



sudo vim /etc/supervisord.conf


[unix_http_server]

file=/var/run/supervisor.sock ; (the path to the socket file)

chmod=0700           ; sockef file mode (default 0700)


[supervisord]

logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)

pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)

childlogdir=/var/log/supervisor      ; ('AUTO' child log dir, default $TEMP)

user=root


; the below section must remain in the config file for RPC

; (supervisorctl/web interface) to work, additional interfaces may be

; added by defining them in separate rpcinterface: sections

[rpcinterface:supervisor]

supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface


[supervisorctl]

serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket

user=root



You may need a restart at this stage , sudo init 6

Test command  

/usr/bin/supervisord -c /etc/supervisord.conf

Once you do the testing , you have to kill the process before starting service ( ps -ef | grep sup ) then kill that work.


vim /etc/systemd/system/supervisord.service

( add this , check the correct python folder )


[Unit]

Description=Supervisor process control system

Documentation=http://supervisord.org

After=network.target


[Service]

Type=forking

ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf

ExecStop=/usr/bin/supervisorctl shutdown

ExecReload=/usr/bin/supervisorctl reload

KillMode=process

Restart=on-failure

User=root

Environment="PYTHONPATH=/usr/local/lib/python3.12/site-packages"


[Install]

WantedBy=multi-user.target


sudo systemctl daemon-reload


chkconfig supervisord on

sudo service supervisord restart


Logs can be seen below

sudo cat /var/log/supervisor/supervisord.log


-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

**found some errors while restarting bench or supervisor - because it take site-package from wrong folder

add this line inside the problematic section

vim /etc/supervisord.d/frappe-bench.conf

environment=PYTHONPATH="/opt/bench/frappe-bench/env/lib64/python3.12/site-packages"


like

[program:frappe-bench-frappe-schedule]

command=/home/erpgulf/.local/bin/bench schedule

priority=3

autostart=true

autorestart=true

stdout_logfile=/opt/bench/frappe-bench/logs/schedule.log

stderr_logfile=/opt/bench/frappe-bench/logs/schedule.error.log

user=erpgulf

directory=/opt/bench/frappe-bench

startretries=10

environment=PYTHONPATH="/opt/bench/frappe-bench/env/lib64/python3.12/site-packages"


After that

sudo service supervisord restart

bench restart


Cloud support

Cloud support team provides hosting related support and technology updates. Cover technology like cloud printing, Cloud PBAX, VoIP, Kubernetes, Ubuntu, Linux etc. Contact us on support@ERPGulf.com

No comments yet

No comments yet. Start a new discussion.

Add Comment