Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

capistrano like deploy recipe for fabric

Project description

# fabric_deploy

## Overview

Capistrano like deploy recipe for Fabric.

## Requirements

* Fabric

## Usage

This recipe is just a template for basic deploy procedures.
You may need to override your own tasks in your

Initialize directory structure for "development" stage.

% fab development deploy.setup

Deploy application to "development" stage.

% fab development deploy

Rollback to previously deployed application.

% fab development deploy.rollback

Clean up old applications.

% fab development deploy.cleanup

## Privilege configurations

This recipe assumes that you can ssh by user named "deploy" and "app" by default.

* deploy (user)
** Used for application deployment.
** Belongs same group as app.
** sudo(8) should be granted without password.
* app (runner)
** Used for running applications
** Belongs same group as deploy.
** No sudo(8) required.

You can change these names by overriding "user" and "runner" options.

## Examples

Following is a sample tasks for multistage deployment ("development" and "production").
Uses "supervisord" for service management. This exapmle consists from 2 files.

* ./fabfile/\__init\ - Basic configuration for deployment
* ./fabfile/ - Overridden tasks for your deployment


from fabric.api import *
from fabric_deploy import options
import deploy

options.set('scm', 'git')
options.set('application', 'myapp')
options.set('repository', '')
(lambda: '%(dir)s/tmp/pids/' % dict(dir=options.fetch('current_path'))))
(lambda: '%(dir)s/supervisord.conf' % dict(dir=options.fetch('current_path'))))

def development():
options.set('current_stage', 'development')
env.roledefs.update({'app': [ 'alpha' ] })

def production():
options.set('current_stage', 'production')
env.roledefs.update({ 'app': [ 'zulu' ] })


from fabric_deploy.deploy import *

def restart():
with cd(fetch('current_path')):
result = sudo("""
(test -f %(supervisord_pid)s && kill -HUP `cat %(supervisord_pid)s`) || %(virtualenv)s/bin/supervisord -c %(supervisord_conf)s
""" % var('virtualenv', 'supervisord_pid', 'supervisord_conf'), user=fetch('runner'))

## Author

Yamashita, Yuu <>

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
fabric_deploy-0.4.6-py2.7.egg (15.5 kB) Copy SHA256 hash SHA256 Egg 2.7
fabric_deploy-0.4.6.tar.gz (5.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page