Skip to content

Instantly share code, notes, and snippets.

@brylor
Created July 18, 2014 13:44
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 brylor/7297c95d552683994517 to your computer and use it in GitHub Desktop.
Save brylor/7297c95d552683994517 to your computer and use it in GitHub Desktop.
import time
from fabric.api import *
#env.hosts = ['ubuntu@chef-server-01:22']
env.roledefs = {"test":["chef-client-01"],
"production":["production-server"]}
@roles("test")
def test():
env.user="ubuntu"
run("uname -a")
deploy()
@roles("production")
def production():
env.user="deploy"
run("uname -a")
deploy()
def webserver():
"Use the actual webserver"
env.hosts = ['Some VARIABLE HERE '] # Change to your server name!
env.requirements = 'webserver'
# env.user = env.prj_name
# env.paith = '/var/www/%(prj_name)s' % env
# env.virtualhost_path = env.path
env.path = '/var/www/html'
env.pysp = '%(virtualhost_path)s/lib/python2.7/site-packages' % env
env.tmppath = '/var/tmp/django_cache/%(prj_name)s' % env
def deploy():
code_dir = '~/RTV/'
with settings(warn_only=True):
if run("test -d %s" % code_dir).failed:
run("git clone user@{some variable here fooo ddfdfd}:/var/www/html/ %s" % code_dir)
with cd(code_dir):
run("git pull")
run("touch app.wsgi")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment