Skip to content

Instantly share code, notes, and snippets.

@pyghassen
Created September 19, 2014 10:57
Show Gist options
  • Save pyghassen/349391c562f3274643f1 to your computer and use it in GitHub Desktop.
Save pyghassen/349391c562f3274643f1 to your computer and use it in GitHub Desktop.
from os.path import dirname, abspath
from fabric.api import local, task, lcd
PROJECT_ROOT = dirname(abspath(__file__))
@task
def update_os():
"""Updates Ubuntu"""
local("sudo apt-get update")
@task
def upgrade_os():
"""Upgrades Ubuntu"""
local("sudo apt-get -y upgrade")
@task
def sync():
"""
"""
with lcd(PROJECT_ROOT):
local("git pull origin ghassen")
@task
def reinstall():
"""
"""
with lcd(PROJECT_ROOT):
local("sudo pip install -r requirements.txt")
local("python setup.py build")
local("sudo python setup.py install")
@task
def restart_server():
"""
"""
local("supervisorctl restart my_server")
local("supervisorctl restart celery_server")
@task
def update():
"""
"""
sync()
reinstall()
restart_server()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment