- SSH should be activated and working
- Python 3.9 should be installed from Package Center
- supervisord
Connect to the NAS with SSH, then log as root:
sudo su
Test if python3 is accessible from root command line:
python3 -V
If python is not accessible from root, complete your ~/.bashrc
.
export PATH="/var/packages/Python3.9/target/usr/bin:PATH"
Install or upgrade pip
python3.9 -m ensurepip --upgrade
// or force upgrade
python3.9 -m pip install --upgrade pip
Install supervisor from pip
python3.9 -m pip install supervisor
- supervisord & supervisorctl are now accessible from command line in root
Configure supervisor
cd /var/packages/Python3.9/target/usr/etc
// create worker directory
mkdir supervisor.d
// create supervisord configuration
vi supervisord.conf
Copy/paste supervisord.conf gist file to supervisord.conf
.
Run supervisord with systemd
cd /etc/systemd/system
vi supervisor.service
Copy/paste supervisor.service gist file to supervisor.service
To manage service, the cheat sheet
// Enable/disable service
systemctl enable supervisor.service
systemctl disable supervisor.service
// Start/reload/stop/status the service
systemctl start supervisor.service
systemctl reload supervisor.service
systemctl stop supervisor.service
systemctl status supervisor.service
If you make any change in supervisor.service after enabled it
systemctl daemon-reload
Workers should be placed in /volume1/@appstore/Python3.9/usr/etc/supervisor.d/
with .ini
extension.
Following, a worker to run Laravel artisan queue worker with php 8.0 (installed from Package Center)
- Project is installed in
/volume1/web/www
- 3 queues are setup
high,default,low
fromdatabase
configuration - Logs are drop to
/volume1/web/www
->storage/logs/worker.log
[program:www-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/bin/php80 /volume1/web/www/artisan queue:work database --sleep=3 --tries=3 --max-time=3600 --queue=high,default,low
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/volume1/web/www/storage/logs/worker.log
stopwaitsecs=3600
alias supervisor="/opt/homebrew/opt/supervisor/bin/supervisord -c /opt/homebrew/etc/supervisord.conf --nodaemon"