Skip to content

Instantly share code, notes, and snippets.

@rubenestevao
Forked from mozillazg/supervisord.service
Last active July 21, 2019 16:37
Show Gist options
  • Save rubenestevao/826c9fc5230aa5a46876f2a847796ae5 to your computer and use it in GitHub Desktop.
Save rubenestevao/826c9fc5230aa5a46876f2a847796ae5 to your computer and use it in GitHub Desktop.
install and configure supervisord on centos 7.
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/slingshotdev/code/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=slingshotdev
numprocs=1
redirect_stderr=true
stdout_logfile=/home/slingshotdev/code/storage/logs/worker.log
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/bin/supervisord -c /etc/supervisord.conf
ExecReload=/bin/supervisorctl reload
ExecStop=/bin/supervisorctl shutdown
User=root
[Install]
WantedBy=multi-user.target
  1. install: pip install supervisor
  2. configure:
    1. mkdir -p /etc/supervisord/conf.d
    2. echo_supervisord_conf > /etc/supervisord/supervisord.conf
    3. echo "files = conf.d/*.conf" >> /etc/supervisord/supervisord.conf
  3. setup as service: wget supervisord.service -O /usr/lib/systemd/system/supervisord.service
  4. start service systemctl start supervisord
  5. view service status: systemctl status supervisord
  6. auto start service on system startup: systemctl enable supervisord

other

  1. yum install python-setuptools
  2. easy_install supervisor
  3. echo_supervisord_conf > supervisord.conf && mv supervisord.conf /etc/supervisord.conf
  4. mkdir /etc/supervisord.d/
  5. nano /etc/supervisord.conf 6. Please add text “files = /etc/supervisord.d/*.conf” to configuration file under [include] section 7. Remove comment from [inet_http_server] and port= 8. Change port to *:9001
  6. /usr/bin/python /usr//bin/supervisord --pidfile /var/run/supervisord.pid -c /etc/supervisord.conf
  7. touch /etc/supervisord.d/laravel-worker.conf && nano /etc/supervisord.d/laravel-worker.conf
  8. wget https://gist.githubusercontent.com/mozillazg/6cbdcccbf46fe96a4edd/raw/2f5c6f5e88fc43e27b974f8a4c19088fc22b1bd5/supervisord.service -O /usr/lib/systemd/system/supervisord.service
  9. systemctl start supervisord
  10. systemctl status supervisord
  11. systemctl enable supervisord
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment