-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·43 lines (34 loc) · 1.47 KB
/
build
File metadata and controls
executable file
·43 lines (34 loc) · 1.47 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
#!/bin/bash
if [[ -z "$ENV" ]] ; then
echo "Environment should be set on startup with one of the below values"
echo "ENV must be one of - dev, qa, prod or local"
exit
fi
rm -rf /data/nginx/dist
mkdir -p /data/nginx/dist/sites-enabled
mkdir -p /data/nginx/dist/includes
cp /data/nginx/src/sites-enabled/*conf /data/nginx/dist/sites-enabled/
cp /data/nginx/src/includes/*conf /data/nginx/dist/includes/
cp /data/nginx/src/*conf /data/nginx/dist/
if [[ "$ENV" == dev ]]; then
cp -rf /data/nginx/src/dev/* /data/nginx/dist/
fi
if [[ "$ENV" == qa ]]; then
cp -rf /data/nginx/src/qa/* /data/nginx/dist/
fi
if [[ "$PROVIDER" == local ]]; then
cp -rf /data/nginx/src/local/includes/*.conf /data/nginx/dist/includes/
echo "8.8.8.8 dns01.topcoder.com" >> /etc/hosts
fi
if [[ "$ENV" != prod ]]; then
perl -pi -e "s/\{\{ENV_TLD\}\}/topcoder-$ENV\.com/g" /data/nginx/dist/sites-enabled/*conf
perl -pi -e "s/\{\{ENV_TLD\}\}/topcoder-$ENV\.com/g" /data/nginx/dist/includes/*conf
perl -pi -e "s/\{\{ENV_WWWTC\}\}/www\.topcoder.com\.com/g" /data/nginx/dist/sites-enabled/*conf
else
perl -pi -e "s/\{\{ENV_TLD\}\}/topcoder\.com/g" /data/nginx/dist/sites-enabled/*conf
perl -pi -e "s/\{\{ENV_TLD\}\}/topcoder\.com/g" /data/nginx/dist/includes/*conf
perl -pi -e "s/\{\{ENV_WWWTC\}\}/www\.topcoder\.com/g" /data/nginx/dist/sites-enabled/*conf
fi
perl -pi -e "s/\{\{ENV\}\}/$ENV/g" /data/nginx/dist/sites-enabled/*conf
perl -pi -e "s/\{\{ENV\}\}/$ENV/g" /data/nginx/dist/includes/*conf
/root/init_logentries.sh