Skip to main content
# 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 fabfile.py.

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\__.py - Basic configuration for deployment
* ./fabfile/deploy.py - Overridden tasks for your deployment

./fabfile/\__init\__.py

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

options.set('scm', 'git')
options.set('application', 'myapp')
options.set('repository', 'git@githum.com:yyuu/myapp.git')
options.set('supervisord_pid',
(lambda: '%(dir)s/tmp/pids/supervisord.pid' % dict(dir=options.fetch('current_path'))))
options.set('supervisord_conf',
(lambda: '%(dir)s/supervisord.conf' % dict(dir=options.fetch('current_path'))))

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

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


./fabfile/deploy.py

from fabric_deploy.deploy import *

@task
@roles('app')
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 <yamashita@geishatokyo.com>

Metadata

Release files for fabric_deploy 0.4.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fabric_deploy 0.4.6
File Size Uploaded Provenance
fabric_deploy-0.4.6.tar.gz 5.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fabric_deploy 0.4.6
File Interpreter ABI Platform
fabric_deploy-0.4.6-py2.7.egg Legacy Egg format - - Details

Total release size: 21.5 kB

Release files / fabric_deploy-0.4.6.tar.gz

Download URL fabric_deploy-0.4.6.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
72449481d3f57b393ff4761d621aa5b969a9d62b5307799b56adf103416c36e0
BLAKE2b-256 checksum
How to use checksums
7a35b5e6461224a3f96ee434870c27712c181d779b88cb6e8dfd76cb496a7cee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / fabric_deploy-0.4.6-py2.7.egg

Download URL fabric_deploy-0.4.6-py2.7.egg
Size 15.5 kB
Tags Egg
SHA-256 checksum
How to use checksums
75f2880c663e80e18a2fd0ec62937c2e124ba199ccd29cb9fe1db1ea69fa528d
BLAKE2b-256 checksum
How to use checksums
9d337b17ca599a242a479dcbd1e75ac472ce721545ec7a57228e73df0ff402b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for fabric_deploy 0.4.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page