-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathdeploy.sh
50 lines (46 loc) · 1.48 KB
/
deploy.sh
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
#!/usr/bin/env bash
command_exists()
{
command -v "$1" >/dev/null 2>&1
}
if [ $(command_exists git) ] && \
[ $(command_exists python) ] && \
[ $(command_exists pip) ]; then
echo "Dependency Check OK";
else
echo 'Warning: whether python or pip or git is not installed.';
echo 'Try installing automaticly...';
# Ask for sudo privileges
[ "$UID" -eq 0 ] || exec sudo "$0" "$@";
if [ -n "$(uname -a | grep Ubuntu)" ]; then
sudo apt-get update && sudo apt-get install git python python-pip;
elif [ -n "$(uname -a | grep CentOS)" ]; then
sudo yum update && sudo yum install git python python-pip;
else
echo 'Error: Not a supported platform, please install dependencies by yourself!';
exit 1;
fi
fi
pip install fabric
git clone https://github.com/cn-matsuri/matsuri_translation
cd matsuri_translation
python deploy.py
domain = ''
echo 'Input your domain to configured nginx, or you shall edit /etc/nginx/conf.d/1-matsuri_translation.conf'
read domain
sudo echo"server {
listen 80;
server_name $domain;
location ^~ /api/ {
proxy_pass http://127.0.0.1:8082;
proxy_redirect off;
proxy_set_header Host $host:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / {
root /home/$USER/matsuri_translation/Matsuri_translation/frontend;
index index.html;
}
}" > /etc/nginx/conf.d/1-matsuri_translation.conf
echo 'Everything has done!'