-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathcloud-provision.sh
More file actions
65 lines (57 loc) · 1.67 KB
/
Copy pathcloud-provision.sh
File metadata and controls
65 lines (57 loc) · 1.67 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
57
58
59
60
61
62
63
64
65
#!/bin/bash
# run this to set up the server
# only do this the first time
set -e
# set -o xtrace
REPOSITORY="git@github.com:iptq/easyctf-platform.git"
PROJECT_DIRECTORY="/var/easyctf/src"
PYTHON=python3
echo "installing system dependencies..."
if [ ! -f $HOME/.installdep.server.apt ]; then
apt-get update && apt-get install -y \
git \
libffi-dev \
libjpeg-dev \
libmysqlclient-dev \
libpng-dev \
libssl-dev \
mysql-client \
openssh-client \
python3 \
python3-dev \
python3-nose \
python3-pip \
realpath \
systemd
touch $HOME/.installdep.server.apt
fi
mkdir -p /var/easyctf
mkdir -p /var/log/easyctf
if [ ! -d $PROJECT_DIRECTORY ]; then
# why the fuck shoul i clone if i already hav this file LMAO
b=`realpath $(basename $0)`
c=`dirname $b`
d=`dirname $c`
# cp -r $d $PROJECT_DIRECTORY
ln -s $c $PROJECT_DIRECTORY
else
(cd $PROJECT_DIRECTORY; git pull origin master || true)
fi
echo "installing python dependencies..."
if [ ! -f $HOME/.installdep.server.pip ]; then
$PYTHON -m pip install -U pip
$PYTHON -m pip install gunicorn
$PYTHON -m pip install -r $PROJECT_DIRECTORY/requirements.txt
touch $HOME/.installdep.server.pip
fi
# dirty hack
KILL=/bin/kill
eval "echo \"$(< $PROJECT_DIRECTORY/systemd/easyctf.service)\"" > /etc/systemd/system/easyctf.service
echo "EasyCTF has been deployed!"
echo "Modify the env file at /var/easyctf/env."
echo "Then run"
echo
echo "systemctl --system daemon-reload && systemctl restart easyctf"
echo "gucci gang"
cp env.example /var/easyctf/env
systemctl --system daemon-reload && systemctl restart easyctf