supervisorclusterctl’s documentation¶
supervisorclusterctl is a cmd line tool that allows to control a cluster of processes by utilizing Supervisor and Ansible.
The tool uses Ansible and Supervisor’s supervisorctl to control remote Supervisor daemons (supervisord). The primary goal of supervisorclusterctl is to simplify the use of Ansible and Supervisor’s supervisorctl by focusing on the most commonly used supervisorctl actions. The tool only works with Python 2.6 or 2.7, since Ansible does not work with Python 3 yet.
Installation¶
Topics
Control Machine Requirements¶
supervisorclusterctl requires Ansible to be installed on the control machine. You only need to install Ansible on one machine and it can control an entire fleet of remote nodes from that central point.
Currently Ansible can be run from any machine with Python 2.6 installed (Windows isn’t supported for the control machine). This includes Red Hat, Debian, CentOS, OS X, any of the BSDs, and so on.
Ansible can be installed via “pip”, the Python package manager. If ‘pip’ isn’t already available in your version of Python, you can get pip by:
$ sudo easy_install pip
Then install Ansible with:
$ sudo pip install ansible
Note
Some Linux distributions offer a version of Ansible that is installable through the system package manager. Use the package management tools of your distribution to check availability.
Managed Node Requirements¶
supervisorclusterctl requires Supervisor to be installed on the remote nodes.
Supervisor can be installed via “pip”:
$ sudo pip install supervisor
Note
Some Linux distributions offer a version of Supervisor that is installable through the system package manager. Use the package management tools of your distribution to check availability.
Installing supervisorclusterctl¶
Installing via pip¶
supervisorclusterctl can be installed via “pip”:
$ sudo pip install supervisorclusterctl
Installing from source¶
supervisorclusterctl is trivially easy to install from source. No daemons or database setup are required.
To install from source:
$ git clone https://github.com/RobWin/supervisorclusterctl.git
$ cd ./supervisorclusterctl
$ sudo python setup.py install
Create RPM package¶
You can create a RPM package which can be used by many of popular Linux distributions, including Red Hat, SuSE:
$ sudo python setup.py bdist_rpm
Installing from tarball or zipball¶
A zipball or tarball of the source are available on the Project page.
User Guide¶
Running supervisorclusterctl¶
Now that you’ve installed supervisorclusterctl, it’s time to get started with some basics.
Run help to see all available command-line commands, arguments and options
$ supervisorclusterctl -h
usage: supervisorclusterctl [-h] [-v] [-s] [-V]
host-pattern
{status,reread,reload,update,start,stop,restart,remove}
...
supervisorclusterctl is a cmd line tool that allows to control a cluster of
processes by utilizing Supervisor and Ansible.
positional arguments:
host-pattern A host-pattern usually refers to a group of hosts. For
more details, see Ansible documentation about
Patterns.
{status,reread,reload,update,start,stop,restart,remove}
One of the available supervisorctl actions.
status Get status info of all processes.
reread Reread the configuration files of supervisord
reload Restart remote supervisord
update Reload the configuration files of supervisord and
add/remove processes as necessary
start Start a process by name
stop Stop a process by name
restart Restart a process by name
remove Remove a process by name
optional arguments:
-h, --help show this help message and exit
-v, --verbose run in verbose mode (-vvv for more, -vvvv to enable
connection debugging)
-s, --sudo run supervisorctl actions with sudo (nopasswd))
-V, --version show program's version number and exit
Run subcommand help to see all available arguments and options of the subcommand
$ supervisorclusterctl production restart -h
usage: supervisorclusterctl host-pattern start [-h] process-name
positional arguments:
process-name Name of the process
optional arguments:
-h, --help show this help message and exit
Now edit /etc/ansible/hosts and put one or more remote systems in it, for which you have your SSH key in authorized_keys:
[production]
192.168.0.11
192.168.0.12
[development]
192.168.0.10
This is an inventory file, which is explained in greater detail in Ansible’s documentation
Run the supervisorclusterctl <host-pattern> status command to get the status of all Supervisor managed processes on all of your configured production nodes:
$ supervisorclusterctl production status
192.168.0.11 | success | rc=0 >>
managed_service RUNNING pid 12136, uptime 21:50:02
192.168.0.12 | success | rc=0 >>
managed_service RUNNING pid 12261, uptime 21:50:02
Now you are able to restart the managed_service process on all of your configured production nodes:
$ supervisorclusterctl production restart managed_service
192.168.0.11 | success | rc=0 >>
managed_service: stopped
managed_service: started
192.168.0.12 | success | rc=0 >>
managed_service: stopped
managed_service: started
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/RobWin/supervisorclusterctl/issues.
If you are reporting a bug, please include:
- Your operating system name and python version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
supervisorclusterctl could always use more documentation, whether as part of the official supervisorclusterctl docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/RobWin/supervisorclusterctl/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up supervisorclusterctl for local development.
Fork the supervisorclusterctl repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/supervisorclusterctl.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv supervisorclusterctl $ cd supervisorclusterctl/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes are working:
$ python setup.py test
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated.
- The pull request should work for Python 2.6 and 2.7. Check https://travis-ci.org/RobWin/supervisorclusterctl/pull_requests and make sure that the tests pass for all supported Python versions.
Authors¶
Development Lead¶
- Robert Winkler <rbrtwnklr@gmail.com>
Contributors¶
None yet. Why not be the first?