-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcattle_prod.bash
More file actions
executable file
·67 lines (52 loc) · 2.6 KB
/
cattle_prod.bash
File metadata and controls
executable file
·67 lines (52 loc) · 2.6 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
66
67
#!/bin/bash
TO_PROD=${1:-1}
if [ $TO_PROD != 0 ]
then
# replace all 127.0.0.1:444 with um.adoodleydo.dev
REP_STR="s/127.0.0.1:444/um.adoodleydo.dev/g;s/127.0.0.1/adoodleydo.dev/g"
for file in $(tree -fi -P *.js --noreport './main/js/' | grep -P '^.*\.js$')
do
sed -i $REP_STR $file
done
sed -i $REP_STR 'main/index.html'
# replace all 127.0.0.1 with adoodleydo.dev
for file in $(tree -fi -I 'public|env|Hello World' -P '*.html|*.js|views.py|*.php|*.conf' --noreport --prune \
| grep -P '\.html$|\.js$|\.py$|\.php$|\.conf$')
do
sed -i $REP_STR $file
done
# update settings.py
sed -i "s/config_name = '..\/config\/debug.toml'/config_name = '..\/config\/prod.toml'/g;" "./um/proj/settings.py"
#sed -i "s/^#if sys.executable != INTERP/if sys.executable != INTERP/g" "./um/wsgi.py" # only needed for passenger
sed -i "s/ssl\/certs\/ssl-cert-snakeoil/apache2\/sslfullchain/g;
s/ssl\/private\/ssl-cert-snakeoil/apache2\/sslkey/g" "./config/999-main.conf"
sed -i "s/ssl\/certs\/ssl-cert-snakeoil/apache2\/sslfullchain/g;
s/ssl\/private\/ssl-cert-snakeoil/apache2\/sslkey/g;
s/VirtualHost \*:444/VirtualHost \*:443/g;" "./config/001-um.conf"
sed -i "s/^\Redirect/\t#Redirect/g;" "./config/000-default.conf"
else
# replace all um.adoodleydo.dev with 127.0.0.1:444
REP_STR="s/um.adoodleydo.dev/127.0.0.1:444/g;s/adoodleydo.dev/127.0.0.1/g"
for file in $(tree -fi -P *.js --noreport './main/js/' | grep -P '^.*\.js$')
do
sed -i $REP_STR $file
done
sed -i $REP_STR 'main/index.html'
# replace all adoodleydo.dev with https://127.0.0.1
for file in $(tree -fi -I 'public|env|Hello World' -P '*.html|*.js|views.py|*.php|*.conf' --noreport --prune \
| grep -P '\.html$|\.js$|\.py$|\.php$|\.conf$')
do
sed -i $REP_STR $file
done
# update settings.py
sed -i "s/config_name = '..\/config\/prod.toml'/config_name = '..\/config\/debug.toml'/g;" './um/proj/settings.py'
#sed -i "s/^if sys.executable != INTERP/#if sys.executable != INTERP/g" "./um/wsgi.py" # only needed for passenger
sed -i "s/apache2\/sslfullchain/ssl\/certs\/ssl-cert-snakeoil/g;
s/apache2\/sslkey/ssl\/private\/ssl-cert-snakeoil/g;" "./config/999-main.conf"
sed -i "s/apache2\/sslfullchain/ssl\/certs\/ssl-cert-snakeoil/g;
s/apache2\/sslkey/ssl\/private\/ssl-cert-snakeoil/g;
s/VirtualHost \*:443/VirtualHost \*:444/g;" "./config/001-um.conf"
sed -i "s/^\Redirect/\t#Redirect/g;" "./config/000-default.conf"
fi
# tell server to update apps
# touch 'um/tmp/restart.txt'