Skip to content

Instantly share code, notes, and snippets.

@mgax
Last active October 13, 2015 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgax/4266737 to your computer and use it in GitHub Desktop.
Save mgax/4266737 to your computer and use it in GitHub Desktop.
fabfile for sarge deployment
import os
import subprocess
from StringIO import StringIO
from fabric.api import *
_host, _directory = os.environ['TARGET'].split(':')
env['hosts'] = [_host]
env['target_directory'] = _directory
env['use_ssh_config'] = True
@task
def deploy():
tarball = subprocess.check_output(['git', 'archive', 'HEAD'])
with cd(env['target_directory']):
put(StringIO(tarball), '_app.tar')
try:
run('bin/airship deploy _app.tar')
finally:
run('rm _app.tar')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment