[9666] | 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 |
|
---|
[9780] | 12 | env.hosts = ['sunfire.wirelessleiden.nl']
|
---|
| 13 |
|
---|
[9666] | 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")
|
---|
[9749] | 22 | local("./manage.py syncdb")
|
---|
[9666] | 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 -")
|
---|
[9780] | 28 |
|
---|
| 29 | def refresh():
|
---|
| 30 | code_dir = '/usr/local/django_gheat'
|
---|
| 31 | with cd(code_dir):
|
---|
[9817] | 32 | sudo("svn up", user='wlrobot')
|
---|
| 33 | sudo("./manage.py collectstatic --noinput", user='wlrobot')
|
---|
[9780] | 34 | sudo("apachectl -k graceful")
|
---|
[9666] | 35 |
|
---|
| 36 | def deploy():
|
---|
| 37 | code_dir = '/usr/local/django_gheat'
|
---|
| 38 | with cd(code_dir):
|
---|
[9817] | 39 | sudo("svn up", user='wlrobot')
|
---|
[9666] | 40 | sudo("apachectl -k graceful")
|
---|
| 41 | run("./manage.py sqlreset gheat | ./manage.py dbshell")
|
---|
[9817] | 42 | sudo("./import_scan_data.sh", user='wlrobot')
|
---|
[9823] | 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')
|
---|
[9666] | 46 | run("../genesis/tools/gformat.py full-export | ./manage.py import_nodes -")
|
---|