-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy pathdeploy
151 lines (137 loc) · 5.77 KB
/
deploy
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# vim: set ft=sh sw=2 ts=8 et :
deploy_phedex_deps()
{
deploy $stage backend
}
deploy_phedex_prep()
{
mkproj sessions cache/phedex-datasvc
mkproj cric-json
}
deploy_phedex_sw()
{
deploy_pkg comp cms+PHEDEX-datasvc
deploy_pkg comp cms+PHEDEX-webapp
deploy_pkg -a phedex/DBParam -a phedex/DBGraph comp cms+PHEDEX-web
(set -e
for app in PHEDEX-{web,webapp,datasvc}; do
. $root/$cfgversion/apps.$glabel/$app/etc/profile.d/init.sh
done
perl -p -i -e "
s|\@ROOT\@|$root/|g; \
s|\@WEB_VERSION\@|$PHEDEX_WEB_VERSION|g; \
s|\@DATASVC_VERSION\@|$PHEDEX_DATASVC_VERSION|g; \
s|\@WEBAPP_VERSION\@|$PHEDEX_WEBAPP_VERSION|g; \
s|\@WEBAPP_BASEURL\@|/phedex/datasvc/app|g; \
s|\@WEBAPP_DATASERVICEURL\@|/phedex/datasvc/json/|g;" \
$root/$cfgversion/config/$project/{app-*.conf,*.xml} \
$PHEDEX_WEBAPP_ROOT/PhEDExWeb/ApplicationServer/js/phedex-base{,-loader}{,-min}.js)
[ $? = 0 ]
}
deploy_phedex_post()
{
case $host in
vocms013[89] | vocms073[89] | vocms0143 | vocms074[0123456] | vocms0307 | vocms0318 | vocms076[123456] | vocms084[1234] | vocms016[135] )
disable
opts="" ;;
* )
enable
opts="-DPHEDEX_DATASVC -DPHEDEX_WEBAPP -DPHEDEX_WEB" ;;
esac
rm -fr $PWD/{htdocs,etc}
(set -e
for app in PHEDEX-{web,webapp,datasvc}; do
. $root/current/apps/$app/etc/profile.d/init.sh
done
export YUI_ROOT
export PROTOVIS_ROOT
mkserver \
-r $PWD \
-l $project_logs \
-a $APACHE2_ROOT \
-o "$opts" \
-p $project_config/httpd-mpm.conf \
-c $project_config/httpd-phedex.conf \
-d $PHEDEX_WEB_ROOT/Documentation \
-d $PHEDEX_WEBAPP_ROOT/PhEDExWeb \
-d $PHEDEX_DATASVC_ROOT/PhEDExWeb \
-e "$APACHE_SETUP_ROOT/etc/env.d/*.sh" \
-e "$PHEDEX_WEB_ROOT/etc/env.d/*.sh" \
-e "$PHEDEX_WEBAPP_ROOT/etc/env.d/*.sh" \
-e "$PHEDEX_DATASVC_ROOT/etc/env.d/*.sh" \
-x "$project_config/{app,cherrypy}-*.conf" \
-x "$project_config/graphs_*.xml" \
-m perl_module:$MOD_PERL2_ROOT/modules/mod_perl.so \
-m cache_module:$APACHE2_ROOT/modules/mod_cache.so \
-m disk_cache_module:$APACHE2_ROOT/modules/mod_disk_cache.so)
[ $? = 0 ]
setgroup -R ugo+r,go-w _config $PWD/{*.conf,etc,htdocs}
setgroup ug+rw,o-w _phedex $PWD/var
(mkcrontab; sysboot
cmd="$project_config/trim-cache $PWD/cache/phedex-datasvc 1G"
api1="$project_config/mkauthmap -c $project_config/mkauth.conf -o $PWD/cric-json/group-responsibilities.json --cert /etc/robots/robotcert.pem --key /etc/robots/robotkey.pem --ca-cert /etc/ssl/certs/CERN-bundle.pem"
api2="$project_config/mkauthmap -c $project_config/mkauth.conf -o $PWD/cric-json/people.json --cert /etc/robots/robotcert.pem --key /etc/robots/robotkey.pem --ca-cert /etc/ssl/certs/CERN-bundle.pem"
api3="$project_config/mkauthmap -c $project_config/mkauth.conf -o $PWD/cric-json/site-names.json --cert /etc/robots/robotcert.pem --key /etc/robots/robotkey.pem --ca-cert /etc/ssl/certs/CERN-bundle.pem"
api4="$project_config/mkauthmap -c $project_config/mkauth.conf -o $PWD/cric-json/site-responsibilities.json --cert /etc/robots/robotcert.pem --key /etc/robots/robotkey.pem --ca-cert /etc/ssl/certs/CERN-bundle.pem"
$nogroups || cmd="sudo -H -u _phedex bashs -c '$cmd'"
[ ! -f $root/enabled/$project ] || echo "0 */3 * * * $cmd"
[ ! -f $root/enabled/$project ] || echo "*/4 * * * * sudo -H -u _phedex bashs -c '$api1'"
[ ! -f $root/enabled/$project ] || echo "*/4 * * * * sudo -H -u _phedex bashs -c '$api2'"
[ ! -f $root/enabled/$project ] || echo "*/4 * * * * sudo -H -u _phedex bashs -c '$api3'"
[ ! -f $root/enabled/$project ] || echo "*/4 * * * * sudo -H -u _phedex bashs -c '$api4'"
) | crontab -
if $nogroups; then
rm -fr cache/phedex-datasvc/*
else
sudo -H -u _phedex bashs -lc "rm -fr cache/phedex-datasvc/*"
fi
}
deploy_phedex_auth()
{
case $1 in
*/DBGraph )
perl -p -e 'exit(0) if /SecurityModule/' < $project_auth/DBParam ;;
*/DBParam )
cat <<-EOF
Section Prod/WebSite
Interface Oracle
Database cms_transfermgmt__IN_DEV_VM__
AuthDBUsername cms_transfermgmt_writer__IN_DEV_VM__
AuthDBPassword __FILL_ME_IN__
AuthRole phedex_website_prod
AuthRolePassword __FILL_ME_IN__
ConnectionLife 86400
LogConnection off
LogSQL off
Section Debug/WebSite
Interface Oracle
Database cms_transfermgmt_sc__IN_DEV_VM__
AuthDBUsername cms_transfermgmt_sc_writer__IN_DEV_VM__
AuthDBPassword __FILL_ME_IN__
AuthRole phedex_website_debug
AuthRolePassword __FILL_ME_IN__
ConnectionLife 86400
LogConnection off
LogSQL off
Section Dev/WebSite
Interface Oracle
Database cms_transfermgmt_test__IN_DEV_VM__
AuthDBUsername cms_transfermgmt_test_writer__IN_DEV_VM__
AuthDBPassword __FILL_ME_IN__
AuthRole phedex_website_dev
AuthRolePassword __FILL_ME_IN__
ConnectionLife 86400
LogConnection off
LogSQL off
Section SecurityModule
Interface Oracle
Database cms_sitedb__IN_DEV_VM__
AuthDBUsername cms_sitedb_writer__IN_DEV_VM__
AuthDBPassword __FILL_ME_IN__
ConnectionLife 86400
LogConnection off
LogSQL off
EOF
;;
esac
}