I'm trying to get supervisor working to make sure my queue system is always running.
Here are the steps I took, which I pieced together from various sources: (Ran as root or super user)
1) $ easy_install supervisor
2) $ echo_supervisord_conf > /etc/supervisord.conf
3) $ sudo vi supervisord.conf
4) Pasted the following to end of file:
command=/usr/bin/php /path/to/AppName/artisan --env=production --timeout=240 queue:listen
5) $ supervisord -c /etc/supervisord.conf
6) $ supervisorctl
7) supervisor> status
supervisor>
It does not display anything.
supervisor doesn't know that you have added a program. This is answered on serverfault, do the following:
By the way, it's easier to maintain configuration files using the
conf.d
syntax. In other words, create a file called/etc/supervisor/conf.d/artisan.conf
. Everything else is the same, but it's easier to version control your configuration files and sync them to machines on setup.Here is the solution I went with. AWS AMI includes pip for installing Python applications. Here are the setup commands:
After you install supervisor you will need to manually build your start-up script to turn the service on and off.
This will vary with your Linux distro, Ubuntu will create an init script for you when you install, other distros like AMI will not. Here is a great resource for various Linux distro init-up scripts:
https://github.com/Supervisor/initscripts
You can then add supervisor to chkconfig to get started automatically on system reboot.
Here is one that works for me:
Path
Example Init Script for AWS-AMI or RedHat Linux
After you close and save, make it executable by all users:
You would next want to confirm that the supervisord process is in fact running by running the following command:
If you don't see /usr/bin/supervisord as a running process then you need to start it up manually:
Supervisord needs to be started up anytime that the server is rebooted. This can be done similar to how apache is turned on after reboot using chkconfig.
First add it to chkconfig, your start up process list
Then tell chkconfig to turn it on after boot