Giter VIP home page Giter VIP logo

fabric-gunicorn's Introduction

fabric-gunicorn

Control your gunicorn process with fabric.

http://files.thelabmill.de/fabric-gunicorn/fabric-gunicorn-status-start-stop.png

Install

The installation is thanks to the Python Package Index and pip really simple.

$ pip install fabric-gunicorn

First steeps

Add import fabric_gunicorn as gunicorn to your new or existing fabfile.py. After this you should go in your termianl and run fab -l in your project directory. You will see something like this:

Available commands:

gunicorn.add_worker     Increase the number of your gunicorn workers
gunicorn.reload         Reload gracefully the gunicorn process and the wsgi application
gunicorn.remove_worker  Decrease the number of your gunicorn workers
gunicorn.restart        Restart hard the gunicorn process
gunicorn.start          Start the gunicorn process
gunicorn.status         Show the current status of your gunicorn process
gunicorn.stop           Stop the gunicorn process

Befor you can start a gunicorn process on your server you must set the gunicorn_wsgi_app env variable. Edit your fabfile.py and add something like: env.gunicorn_wsgi_app = 'hello.wsgi:app'. The default workdir is the home directory of the connected user. You can also change this path with the env variable env.remote_workdir.

Normaly you should now able to run fab gunicorn.start and the gunicorn server should start on your remote machine. Gunicorn must be installed. Your wsgi app is now avaiable under http://127.0.0.1:8000.

Configuration

fabric-gunicorn take all configuration from the fabric env variable. For gunicorn I added some variables:

env.remote_workdir
This is normaly your project path.
env.virtualenv_dir
If you want to use a virtualenv than you can here define the path to your env directory.
env.gunicorn_wsgi_app
There you set your wsgi app import path. Example: mydjangoproject.wsgi:application
env.gunicorn_bind
Define on which port or socket gunicorn should bind. Default: 127.0.0.1:8000
env.gunicorn_pidpath
The path for the pidfile of the gunicorn master process. Default: remote_workdir/gunicorn.pid
env.gunicorn_workers
The number of gunicorn worker processes by start. Default: 1
env.gunicorn_worker_class
The class of worker you want to use. Normal the default sync worker should run fine. More under: http://gunicorn.org/design.html
env.django_settings_module
This is special for django to set the DJANGO_SETTINGS_MODULE path. Example: mydjangoproject.settings
env.paster_config_file
This should point to your application.ini paster deploy settings file. Setting this will cause gunicorn to execute using gunicorn_paster instead of gunicorn. Example: config/application.ini

fabric-gunicorn's People

Contributors

jarus avatar rpicard avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.