uwsgi-manager

Python tool for controling the uWSGI instances.


Keywords
uwsgi
License
BSD-3-Clause
Install
pip install uwsgi-manager==0.1.1

Documentation

Copyright (c) Adam Strauch
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.
   
    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


#####################################################################

uWSGI Manager

This is small python script for uWSGI instances. It can read your XML configuration and stop/reload/restart/start/what ever with your uWSGI processes. Originaly it was delevoped for Python hosting Rosti.cz, but parts of administration and tools are open now or will be opened soon. Script works only under root privileges.

Using:

	$ mkdir /etc/uwsgi
	$ vim /etc/uwsgi/config.xml
	[copy modified configuration below]
	$ uwsgi-manager.py -l
	$ uwsgi-manager.py -R 1

Config file /etc/uwsgi/config.xml:

	<your_server>
	<uwsgi id="48">
	        <pythonpath>/home/user/django/</pythonpath>
	        <master/>
	        <no-orphans/>
	        <processes>1</processes>
	        <optimize>0</optimize>
	        <home>/home/user/virtualenvs/default</home>
	        <limit-as>128</limit-as>
	        <chmod-socket>660</chmod-socket>
	        <uid>user</uid>
	        <gid>user</gid>
	        <pidfile>/home/user/uwsgi/django.pid</pidfile>
	        <socket>/home/user/uwsgi/django.sock</socket>
	        <wsgi-file>/home/user/django/django.wsgi</wsgi-file>
	        <daemonize>/home/user/uwsgi/django.log</daemonize>
	        <chdir>/home/user/django/</chdir>
	</uwsgi>
	</your_server>

I assume, you use same paths of uwsgi binaries as I:

	* /usr/bin/uwsgi
	* /usr/local/bin/uwsgi25
	* /usr/local/bin/uwsgi27
	* /usr/local/bin/uwsgi31
	* /usr/local/bin/uwsgi32

If you want to use another paths, you have to go into code.

If you are lost, try -h:

	$ ./uwsgi-manager.py -h
	Usage: uwsgi-manager.py [options]

	Options:
	  -h, --help            show this help message and exit
	  -s ID, --start=ID     Start app
	  -S ID, --stop=ID      Stop app (sig 9)
	  -r ID, --reload=ID    Reload app (sig 1)
	  -b ID, --brutal-reload=ID
	                        Brutal reload app (sig 15)
	  -R ID, --restart=ID   Restart app
	  -c ID, --check=ID     Check state of app
	  -a, --start-all       Start all apps
	  -A, --stop-all        Stop all apps
	  -w, --reload-all      Reload all apps
	  -W, --restart-all     Restart all apps
	  -B, --brutal-reload-all
	                        Brutal reload all apps
	  -l, --list            Print state of all apps


Or send me e-mail.

Adam Strauch <cx@initd.cz>

Feel free send some useful patch too :-)