-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
33 lines (26 loc) · 865 Bytes
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# As close to Python3 as 2.7 can get
from __future__ import absolute_import, division, print_function, unicode_literals
from future_builtins import * # ascii, filter, hex, map, oct, zip
from fabric.api import *
from os.path import join as oj
from os.path import dirname as up
env.hosts = ['mattias@mattias.linnap.com']
REMOTE_DIR = '/home/mattias/webapps/yousense_ping/latencyping'
@task
def push_tarball():
local('tar czf tarball.tar.gz *')
run('rm -rf ' + REMOTE_DIR)
run('mkdir ' + REMOTE_DIR)
put('tarball.tar.gz', oj(REMOTE_DIR, 'tarball.tar.gz'))
local('rm tarball.tar.gz')
with cd(REMOTE_DIR):
run('tar xzf tarball.tar.gz')
run('rm tarball.tar.gz')
@task
def restart_apache():
run(oj(up(REMOTE_DIR), 'apache2/bin/restart'))
@task
def deploy():
push_tarball()
restart_apache()