Supervisor setup on AWS AMI Linux

to get supervisord running as a service you need an /etc/init.d/supervisord file. i used https://raw.githubusercontent.com/Supervisor/initscripts/master/redhat-init-equeffelec with mods to match the path which easy_install put the binaries at (/usr/local/bin/) and to find the pid and logs in /var/run/ and /var/log/


I just spent a couple hours on this, trying to get supervisor and Amazon Linux AMI to play nice. I was experiencing exactly the symptoms you mentioned.

Some quirks:

  • go ahead and include -c /etc/supervisord.conf (or whatever your path) on any supervisord or supervisorctl command, and make sure you run from the same user every time.
  • in your /etc/supervisord.conf, when you append the command, make sure you prefix the name with 'program:', like so:

    [program:queue]
    command=/usr/bin/php /path/to/AppName/artisan --env=production --timeout=240 queue:listen
    

Once I did the above, supervisorctl FINALLY recognized the queue process/program.

I still haven't gotten sudo service supervisor restart to recognize supervisor as a service - I suspect it's because I don't have an upstart script that I've seen mentioned in a handful of places. Not sure I need one at this point.

Some debugging techniques I used:

  • ps aux | grep super to see if it's running
  • sudo vim to edit the /etc/supervisord.conf and sudo /usr/local/bin/supervisorctl -c /etc/supervisord.conf then avail, reload, update etc. to update (rather than editing .ebextensions and pushing to elastic beanstalk everytime)