-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy
66 lines (49 loc) · 1.55 KB
/
deploy
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
62
63
64
65
66
BASEDIR="/home/easyctf/easyctf"
HTTPDIR="/srv/http/ctf"
echo "Starting the EasyCTF Platform."
echo "Grabbing latest updates..."
cd $BASEDIR
git reset --hard
git pull origin master
echo "Transpiling Coffeescript"
# USE THIS ONE TO MINIFY
coffeebar -s -m -o $BASEDIR/web/js $BASEDIR/web/coffee
# coffeebar -s -o $BASEDIR/web/js $BASEDIR/web/coffee
echo "Compiling LESS"
cd $BASEDIR/web
# USE THIS ONE TO MINIFY
lessc less/easyctf.less css/easyctf.css
lessc less/less_halloween/easyctf.less css/easyctf_halloween.css
# lessc less/easyctf.less css/easyctf.css
echo "Shutting down nginx"
sudo service nginx stop
echo "Copying nginx config file"
sudo cp $BASEDIR/ctf.nginx /etc/nginx/sites-enabled/ctf
echo "Removing old files"
sudo rm -rf $HTTPDIR/*
echo "Generating page with Jekyll"
sudo jekyll build --source $BASEDIR/web
echo "Copying files to server"
mkdir -p $BASEDIR/problem_static
sudo mkdir -p $HTTPDIR/static/problems
sudo cp -r $BASEDIR/problem_static $HTTPDIR/static/problems
# sudo cp -r $BASEDIR/web/_site/* $HTTPDIR
echo "Enabling writing to static folder..."
sudo chmod -R 755 $HTTPDIR
sudo chmod -R 757 $HTTPDIR/static
echo "Make sure everything is in UNIX format"
sudo dos2unix -q $HTTPDIR/*.html
echo "Restarting the server"
sudo service nginx start
# echo "Clearing API cache"
# $BASEDIR/api/api_manager.py database clear cache
echo "Loading all the problems..."
cd $BASEDIR
sudo python3 api/load_problems.py
sudo chmod -R 755 $HTTPDIR/*
chmod +x $BASEDIR/deplo*
sh deploy_api
# sh deploy_irc
echo "Starting extras..."
chmod +x extras/init.sh
./extras/init.sh