1 | #
|
---|
2 | # Fabric files for deployment and management of django_gheat application
|
---|
3 | #
|
---|
4 | # Rick van der Zwet - <info@rickvanderzwet.nl>
|
---|
5 | #
|
---|
6 | from __future__ import with_statement
|
---|
7 | from fabric.api import local, settings, abort, run, cd, env, sudo
|
---|
8 | from fabric.contrib.console import confirm
|
---|
9 |
|
---|
10 | env.shell = "/bin/sh -c"
|
---|
11 |
|
---|
12 | env.hosts = ['sunfire.wirelessleiden.nl']
|
---|
13 |
|
---|
14 | def hello():
|
---|
15 | print("Hello World!")
|
---|
16 |
|
---|
17 | def test():
|
---|
18 | local("./manage.py runserver 0.0.0.0:8000")
|
---|
19 |
|
---|
20 | def reset():
|
---|
21 | local("./manage.py sqlreset gheat | ./manage.py dbshell")
|
---|
22 | local("./manage.py syncdb")
|
---|
23 |
|
---|
24 | def import_nodes():
|
---|
25 | local("../genesis/tools/genesis-to-yaml.pl")
|
---|
26 | local("../genesis/tools/gformat.py cleanup")
|
---|
27 | local("../genesis/tools/gformat.py full-export | ./manage.py import_nodes -")
|
---|
28 |
|
---|
29 | def refresh():
|
---|
30 | code_dir = '/usr/local/django_gheat'
|
---|
31 | with cd(code_dir):
|
---|
32 | sudo("svn up", user='wlrobot')
|
---|
33 | sudo("./manage.py collectstatic --noinput", user='wlrobot')
|
---|
34 | sudo("apachectl -k graceful")
|
---|
35 |
|
---|
36 | def deploy():
|
---|
37 | code_dir = '/usr/local/django_gheat'
|
---|
38 | with cd(code_dir):
|
---|
39 | sudo("svn up", user='wlrobot')
|
---|
40 | sudo("apachectl -k graceful")
|
---|
41 | run("./manage.py sqlreset gheat | ./manage.py dbshell")
|
---|
42 | sudo("./import_scan_data.sh", user='wlrobot')
|
---|
43 | sudo("svn up ../genesis", user='www')
|
---|
44 | sudo("../genesis/tools/genesis-to-yaml.pl", user='www')
|
---|
45 | sudo("../genesis/tools/gformat.py cleanup", user='www')
|
---|
46 | run("../genesis/tools/gformat.py full-export | ./manage.py import_nodes -")
|
---|