-
Notifications
You must be signed in to change notification settings - Fork 6
/
deployer.sh
52 lines (44 loc) · 1.44 KB
/
deployer.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
51
52
#!/bin/bash
aftp(){
echo "---> Configure nginx-globals automatically (provision)"
echo "---> Checking that we have required software installed"
for cli in curl; do
if ! type "$cli" > /dev/null 2>&1; then
echo "ERROR: $cli is not installed and in the PATH. Aborting."
exit 1
fi
done
curl --silent -Lk https://github.com/philcryer/nginx-globals/archive/master.tar.gz | tar xz
sudo cp -R nginx-globals-master/globals /etc/nginx/
rm -rf nginx-globals-master
}
local(){
echo "---> Configure nginx-globals on local nginx"
echo "---> Checking that we have required software installed"
for cli in sudo; do
if ! type "$cli" > /dev/null 2>&1; then
echo "ERROR: $cli is not installed and in the PATH. Aborting."
exit 1
fi
done
if [ -d '/etc/nginx' ]; then
sudo cp -R nginx-globals/globals /etc/nginx/
else
echo "ERROR: Nginx config dir not found in /etc/nginx, bailing."
exit 1
fi
echo "---> Testing that nginx-globals runs without errors on local nginx"
test=`sudo /usr/sbin/nginx -t -q|wc -l`
if [ ${test} -gt '1' ]; then
echo " [FAIL] test was not successful. Aborting"
sudo rm -rf /etc/nginx/globals
exit 1
else
echo " > test was successful"
echo " > reloading nginx with new config"
sudo service nginx reload
fi
}
local
echo "---> Done"
exit 0