-
Notifications
You must be signed in to change notification settings - Fork 1
/
fabfile.py
42 lines (34 loc) · 1.1 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
from fabric.api import *
from fabric.contrib.files import *
import os
from copy import copy
import time
"""
Call this with fab -H <hostname> TASK to deploy THREDDS
Note: SSH public key must be in /home/thredds/.ssh/authorized_keys
"""
env.user = "thredds"
code_dir = "/home/thredds/maracoos_catalog"
prod_dir = "/var/tomcat/THREDDS_PROD"
def deploy_thredds():
git_pull()
copy_catalog()
copy_styles()
restart_tomcat()
def git_pull():
if not exists(code_dir):
git_clone()
with cd(code_dir):
run("git pull origin master")
def git_clone():
with cd("~"):
run("rm -rf maracoos_catalog")
run("git clone https://github.com/asascience-open/maracoos_catalog.git")
def copy_catalog():
sudo("rsync -av %s/TDS/* %s/content/thredds/" % (code_dir, prod_dir))
sudo("chown -R tomcat:tomcat %s/content/thredds/*" % prod_dir)
def copy_styles():
sudo("rsync -av %s/thredds_styles/* %s/webapps/thredds/" % (code_dir, prod_dir))
sudo("chown -R tomcat:tomcat %s/webapps/thredds/*" % prod_dir)
def restart_tomcat():
sudo("/etc/init.d/tomcat_thredds restart")