-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdeploy-Ubuntu.sh
More file actions
executable file
·56 lines (43 loc) · 1.74 KB
/
deploy-Ubuntu.sh
File metadata and controls
executable file
·56 lines (43 loc) · 1.74 KB
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
#!/bin/bash
# This file contains stuff we can do every time we refine docent-learner code. (This is in contrast to the stuff we want to do only once, which is in the bootstrap file.)
#TODO: make apache restart optional
basedir="/var/www/html/docent-learner"
imagesdir="images"
tweetsdir="tweets"
textselectdir="textselect"
pydir="/var/www/docent-learner/"
arg1=$1
sudo mkdir -p $basedir
sudo mkdir "$basedir/boldtext"
sudo chmod a+rw "$basedir/boldtext"
sudo mkdir -p "$basedir/$imagesdir"
sudo cp images/* "$basedir/$imagesdir"
sudo chmod a+rw "$basedir/$imagesdir"
sudo mkdir -p "$basedir/$tweetsdir"
sudo cp tweets/* "$basedir/$tweetsdir"
sudo chmod a+rw "$basedir/$tweetsdir"
sudo mkdir -p "$basedir/$textselectdir"
sudo cp textselect/* "$basedir/$textselectdir"
sudo chmod a+rw "$basedir/$textselectdir"
# Copy python source
sudo mkdir -p "$pydir"
sudo cp -r src/* "$pydir"
# Copy var files (stuff that changes during runtime)
sudo mkdir -p "$basedir/var/"
sudo cp -r var/* "$basedir/var/"
sudo chmod a+rw "/var/www/html/docent-learner/var/config/config.json"
sudo chmod a+rw "/var/www/html/docent-learner/var/textselect-modelbuild.lock"
sudo chmod a+rw "/var/www/html/docent-learner/var/textselect-model-build-status.txt"
# Copy static files (stuff that should never change)
sudo mkdir -p "$basedir/static/"
sudo cp -r static/* "$basedir/static/"
# Copy html
sudo cp -r html/* "$basedir"
# Restart apache only if the configuration file has been updated
if ! diff -q /etc/apache2/sites-enabled/docent-learner-apache.conf sites-enabled/docent-learner-apache.conf
then
echo "restarting apache"
# Make directories, copy files, and check permissions
sudo cp sites-enabled/docent-learner-apache.conf /etc/apache2/sites-enabled/
sudo service apache2 restart
fi