6

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. Ran:

    # easy_install supervisor
    # echo_supervisord_conf > /etc/supervisord.conf
    # vi supervisord.conf
    
  2. Pasted the following to end of file:

    command=/usr/bin/php /path/to/AppName/artisan --env=production --timeout=240 queue:listen
    
  3. Ran:

    # supervisord -c /etc/supervisord.conf
    # supervisorctl
    supervisor> status
    supervisor>
    

    It does not display anything.

  4. Ran:

    # service supervisord reload
    supervisord: unrecognized service
    
Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
zeros-and-ones
  • 315
  • 1
  • 3
  • 10
  • Which version of CentOS? Why did you use easy_install? – Michael Hampton Mar 04 '15 at 04:52
  • It is Amazon's AMI Linux http://aws.amazon.com/amazon-linux-ami/ I am trying to find which Centos they used to build it. – zeros-and-ones Mar 04 '15 at 04:53
  • Found this from 2010, "...The Amazon Linux AMI is based on RHEL 5.x and parts of RHEL6. One of our goals is binary compatibility with RHEL 5.x, and therefore CentOS5.x. Astute users will note that our kernel is based on 2.6.34, and we have engineered the image to conform to a cloud environment. For example, the lack of Xorg support helps to keep the images small and lean. The goal of the Amazon Linux AMI is to provide an image for use in the cloud and to serve as reference image of EC2 best practices..." – zeros-and-ones Mar 04 '15 at 04:56
  • I used Easy Install, because that seemed like the easiest way. – zeros-and-ones Mar 04 '15 at 05:02
  • They _forked_ from CentOS, and did not maintain compatibility. If you are using Amazon Linux, you should not mention CentOS or assume that it will act in any way similarly to CentOS. And if that was meant to be a showcase of best practices, they failed miserably. Amazon Linux is one of the least stable and most unreliable Linux distributions I have ever seen. Not to mention thoroughly undocumented. – Michael Hampton Mar 04 '15 at 05:04
  • My apologies, thanks for the info I'll edit my question and keep my fingers crossed for a working solution. Which free distro do you recommend for the task at hand? (Supervisord with Redis and Laravel) – zeros-and-ones Mar 04 '15 at 05:08
  • I wouldn't bother with supervisord at all. In recent distributions (such as the real CentOS 7) systemd is perfectly capable of handling that. – Michael Hampton Mar 04 '15 at 05:12

2 Answers2

5

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/

mARK bLOORE
  • 66
  • 1
  • 1
  • Thanks for the tip. For now I was able to get supervisord working locally on my Ubuntu workstation with no problems. Since it is so much more hassle free on Ubuntu and I won't need to scale out my Queue server, I am going to setup a new instance for my development/queue system on Ubuntu. – zeros-and-ones Jul 07 '15 at 19:17
  • Ok I had to return to this for another App we have running on AMI. I was able to modify the start up script to match the paths like you mentioned and added to chkconfig. Its working now even on forced reboot. – zeros-and-ones Sep 14 '16 at 21:38
4

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)
Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
Russ Matney
  • 101
  • 4