Sunday, April 3, 2016

Supervisord and docker services

hi all,

I am working on docker container recently and find that supervisord is such a wonderful to start/stop and keep the services alive. So, I would like to share my steps on setting it up.

1. Installing supervisord.

wget http://peak.telecommunity.com/dist/ez_setup.py;python ez_setup.py \
&& easy_install supervisor

2. Once you are done. You are ready to define your services that will be governed by supervisord.

Here is the example of /etc/supervisord.conf


[supervisord]
nodaemon=true



[program:sshd]

command=/usr/sbin/sshd -D



[program:redis]

command=/etc/init.d/redis start



[program:rabbitmq-server]

command=/etc/init.d/rabbitmq-server start



[program:sensu-server]

command=/etc/init.d/sensu-server start



[program:uchiwa]

command=/etc/init.d/uchiwa start



[program:sensu-api]

command=/etc/init.d/sensu-api start


3. Then, after all may start your supervisord binary. 

/usr/bin/supervisord

If you are working on Dockerfile, it may sound like this.



#supervisord
RUN wget http://peak.telecommunity.com/dist/ez_setup.py;python ez_setup.py \

&& easy_install supervisor

ADD files/supervisord.conf /etc/supervisord.conf

#start command
CMD ["/usr/bin/supervisord"]



No comments: