Skip to content

Latest commit

 

History

History
119 lines (90 loc) · 3.84 KB

README.supervisor.markdown

File metadata and controls

119 lines (90 loc) · 3.84 KB

Supervisor: A Process Control System

Backend workers can be started using supervisor.

Installation

You can install supervisor via pip.

pip install supervisor

Starting up

supervisord by default looks up in current working directory for supervisord.conf file first. This file is generated by configure script. Make sure you executed configure script before running supervisord.

supervisord starts programs defined in configuration immediately.

Using supervisorctl

You can interact with supervisor via supervisorctl program. It reads configuration file in current working directory like supervisord.

supervisorctl provides two interfaces, one is classic command line options and the other is an interactive REPL.

REPL mode can be entered by executing supervisorctl without any commands.

supervisorctl

If supervisord is not running then following error output will be printed:

error: <class 'xmlrpclib.Fault'>, <Fault 6: 'SHUTDOWN_STATE'>: file: /usr/lib/python2.7/xmlrpclib.py line: 794

By default, supervisorctl prints output of status command.

Example output during startup:

environment:kloud                     STARTING
environment:kontrol                   STARTING
environment:terraformer               STARTING
socialapi:algoliaconnector            STARTING
socialapi:collaboration               STARTING
socialapi:dispatcher                  STARTING
socialapi:gatekeeper                  STARTING
socialapi:mailsender                  STARTING
socialapi:realtime                    STARTING
socialapi                             STARTING
socialapi:team                        STARTING
webserver:socialworker                STARTING
webserver                             STARTING

Same command executed through command line options.

$ supervisorctl status
environment:kloud                     RUNNING   pid 3276, uptime 0:00:15
environment:kontrol                   RUNNING   pid 3271, uptime 0:00:15
environment:terraformer               RUNNING   pid 3274, uptime 0:00:15
socialapi:algoliaconnector            RUNNING   pid 3327, uptime 0:00:15
socialapi:collaboration               RUNNING   pid 3382, uptime 0:00:15
socialapi:dispatcher                  RUNNING   pid 3391, uptime 0:00:15
socialapi:gatekeeper                  RUNNING   pid 3277, uptime 0:00:15
socialapi:mailsender                  RUNNING   pid 3292, uptime 0:00:15
socialapi:realtime                    RUNNING   pid 3312, uptime 0:00:15
socialapi                             RUNNING   pid 3280, uptime 0:00:15
socialapi:team                        RUNNING   pid 3417, uptime 0:00:15
webserver:socialworker                RUNNING   pid 3482, uptime 0:00:15
webserver                             RUNNING   pid 3449, uptime 0:00:15

Commands listed below are useful during development

  • start [all|program-name]
  • stop [all|program-name]
  • restart [all|program-name]
  • reread
  • reload
  • shutdown
  • exit

start, stop, and restart commands work on programs run by supervisord.

You can execute supervisorctl restart all after pulling changes to update workers running on your development environment.

reread command reads configuration file and updates supervisord accordingly. reload command, additional to reread, restarts all programs which is useful when supervisor configuration is changed.

shutdown command kills supervisord process which is parent of programs defined in configuration. You do not need to kill supervisor daemon during development cycle. Stopping workers via stop all command is probably serve you well for most of the cases.

exit command exits from interactive mode of supervisorctl.

Logs

You can tail logs via following command after running supervisord.

tail -fq .logs/*