Skip to content

Instantly share code, notes, and snippets.

@danielcharrua
Forked from ibrunotome/supervisord.service
Last active July 4, 2024 18:56
Show Gist options
  • Save danielcharrua/8e21751a3f9ec143eb6c6fd6dfb95560 to your computer and use it in GitHub Desktop.
Save danielcharrua/8e21751a3f9ec143eb6c6fd6dfb95560 to your computer and use it in GitHub Desktop.
Install and configure supervisord on centos 7.
[program:app1-laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=<your-php-path> <your-artisan-path> queue:work --tries=3
autostart=true
autorestart=true
numprocs=2
redirect_stderr=true
stdout_logfile=<your-logfile-path>
[program:app2-laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=<your-php-path> <your-artisan-path> queue:work --tries=3
autostart=true
autorestart=true
numprocs=2
redirect_stderr=true
stdout_logfile=<your-logfile-path>
[program:app3-laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=<your-php-path> <your-artisan-path> queue:work --tries=3
autostart=true
autorestart=true
numprocs=2
redirect_stderr=true
stdout_logfile=<your-logfile-path>
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/bin/supervisord -c /etc/supervisor/supervisord.conf
ExecReload=/bin/supervisorctl reload
ExecStop=/bin/supervisorctl shutdown
User=root
[Install]
WantedBy=multi-user.target
  1. install: easy_install supervisor
  2. configure:
    1. mkdir -p /etc/supervisor/conf.d
    2. echo_supervisord_conf > /etc/supervisor/supervisord.conf
    3. echo "files = conf.d/*.conf" >> /etc/supervisor/supervisord.conf
  3. setup as service:
    1. vi /usr/lib/systemd/system/supervisord.service
    2. paste supervisord.service content
  4. start service systemctl start supervisord
  5. view service status: systemctl status supervisord
  6. auto start service on system startup: systemctl enable supervisord
  7. create your program into /etc/supervisor/supervisord.conf (more at http://supervisord.org/introduction.html)
    1. paste laravelworker content
    2. remember to fill the 3 paths between <your-php-path> <your-artisan-path> <your-logfile-path>
  8. restart supervisor: systemctl restart supervisord
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment