Skip to content

cwick/hello_fabric

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project demonstrates how to use Fabric to deploy a typical Django web application running on nginx and Gunicorn.

Features include:
    * Isolated deployment environments. Each deploy builds a Python virtualenv from scratch, installing the dependencies listed in requirements.txt. Dependencies are cached so subsequent deploys don't have to download anything.
    * Allows multiple versions to be kept on the server, and allows rollback to a previously-deployed version.
    * Old versions are automatically purged from the server (configurable).
    * Config files for server processes such as nginx are stored as templates. When deployed, templates are automatically filled with appropriate values.
    * Deployments are atomic. The entire deploy process must succeed, or else the server configuration is not modified.
    * Detection of concurrent deploys. Deploy will fail if somebody is already in the process of deploying


Initial server setup:
    Not automated right now. You should use 'apt' to install the following packages:
        * nginx
        * supervisor
        * gcc
        * python

    You will also need a user called 'deploy', who has read and write access to '/srv/<project name>/'.
    You need to set up public key authentication with SSH so you can run commands as the 'deploy' user
    without having to enter a password.


Deploy:
    fab deploy

    Deploy a new version to the server.
    
Rollback:
    The server keeps an archive of the last 'MAX_DEPLOYED_VERSIONS' deploys. Through manipulation of
    symlinks, the server can change which one is currently the 'live' version. Use these
    commands to switch between versions.
    
    Rollback to the previously-deployed version. Good for those oh-shit-I-just-broke-the-site moments:
        fab rollback
    Additional invocations of 'rollback' will go back one more version, until you are at the oldest version.

    Rollback to the most recently deployed version:
        fab rollback:current
    Rollback to the specified version:
        fab rollback:<version number>
    
TODO:
    - 

About

Hello world example using fabric, nginx, supervisor and gunicorn

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published