Skip to content

Instantly share code, notes, and snippets.

@mrkurt
Created April 17, 2009 21:25
Show Gist options
  • Save mrkurt/97270 to your computer and use it in GitHub Desktop.
Save mrkurt/97270 to your computer and use it in GitHub Desktop.
import os
def civis():
config.fab_hosts = ['[email protected]']
config.path = '/var/web-apps/civis.ars/'
config.package_name = "civis.tar.gz"
def copy_files():
if config.package_name == "civis.tar.gz":
put("output/$(package_name)", "$(path)tmp/$(package_name)", fail=abort)
def extract_build():
run("mkdir $(path)releases/$(extraction_target); cd $(path)releases/$(extraction_target); mv ../../tmp/$(package_name) ./; tar zxvf $(package_name); rm $(package_name)")
def swap_symlinks():
run("cd $(path); rm current; ln -s releases/$(extraction_target) current;")
def restart_apache():
#sudo("apache2ctl reload")
def deploy():
require('fab_hosts', provided_by = [civis])
config.extraction_target = int(os.path.getmtime("output/" + config.package_name))
invoke(copy_files)
invoke(extract_build)
invoke(swap_symlinks)
invoke(restart_apache)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment