-
Notifications
You must be signed in to change notification settings - Fork 3
/
fabfile.py
65 lines (50 loc) · 2.26 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from fabric.api import cd, env, execute, local, prefix, put, run, sudo, task
from fabric.operations import put
from fabric.context_managers import settings, hide
from fabric.contrib.files import sed
from subprocess import Popen, PIPE
# This is a fabric file to automate common tasks.
# Before running make sure you have fabric installed (```pip install fabric```)
# To run a command, navigate to this files parent folder and run: fab <task> -H host -u <user> -p <password>
# To ignore known-hosts use the -D option
# See http://docs.fabfile.org/en/1.4.0/usage/fab.html for all fabric options
# Run a task with arguments
# http://docs.fabfile.org/en/latest/usage/fab.html#per-task-arguments
# fab <task>:kwarg=value -H host -u <user> -p <password>
# for example 'fab map_loom_django_dev -H 192.168.10.154 -D -u rogue -p <pass>'
def map_loom_django_dev():
"""
Creates symlinks need to develop MapLoom in our Django environment
"""
sudo('rm -rf /var/www/rogue/maploom/*')
sudo('ln -s /MapLoom/build/* /var/www/rogue/maploom/')
sudo('rm /var/lib/geonode/lib/python2.7/site-packages/maploom/templates/maps/maploom.html')
sudo('ln -s /MapLoom/build/maploom.html /var/lib/geonode/lib/python2.7/site-packages/maploom/templates/maps/maploom.html')
def map_loom_django_dev_old():
"""
Creates symlinks need to develop MapLoom in our Django environment
"""
sudo('rm -rf /var/www/rogue/maploom/*')
sudo('ln -s /MapLoom/build/* /var/www/rogue/maploom/')
sudo('rm /var/lib/geonode/rogue_geonode/geoshape/templates/maps/maploom.html')
sudo('ln -s /MapLoom/build/maploom.html /var/lib/geonode/rogue_geonode/geoshape/templates/maps/maploom.html')
def uninstall_django_16():
"""
Uninstalls Django 1.6 and installs Django 1.5.5
"""
sudo('/var/lib/geonode/bin/pip uninstall Django')
sudo('/var/lib/geonode/bin/pip install Django==1.5.5')
def restart_tomcat():
"""
Restarts tomcat on the host machine.
"""
sudo('service tomcat7 restart')
def reprovision(remove_geoserver_data=False, reboot=False):
"""
Re-provisions a server (runs /opt/chef-run/run.sh)
"""
if remove_geoserver_data:
sudo('rm -rf /var/lib/geoserver_data')
sudo('/bin/bash /opt/chef-run/run.sh')
if reboot:
sudo('reboot')