forked from dmwm/deployment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy
107 lines (95 loc) · 3.19 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
# vim: set ft=sh sw=2 ts=8 et :
deploy_reqmgr_variants="default prod preprod dev offsite"
deploy_reqmgr_deps()
{
deploy $stage backend
deploy $stage wmcore-auth
case $variant in
offsite )
deploy $stage couchdb offsite
deploy $stage wmcore ;;
* )
deploy $stage couchdb ;;
esac
deploy $stage reqmon $variant
deploy $stage acdcserver $variant
}
deploy_reqmgr_prep()
{
case $variant in offsite ) extra=install ;; * ) extra= ;; esac
mkproj $extra
}
deploy_reqmgr_sw()
{
case $variant in
offsite )
deploy_pkg comp external+cherrypy
deploy_pkg comp external+py2-cheetah
deploy_pkg comp external+py2-openid
deploy_pkg comp external+py2-cjson
deploy_pkg comp cms+dls-client
deploy_pkg comp cms+dbs-client
local wmcore_etc=$root/$cfgversion/apps.$glabel/wmcore/etc
local couchdb_ini=$root/$cfgversion/config/couchdb/local.ini
local mysql_config=$root/$cfgversion/config/mysql/my.cnf
# get manage script from wmcore
cp $wmcore_etc/deploy/wmagent-manage $root/$cfgversion/config/reqmgr/manage
# override the webtools couch config
cp $wmcore_etc/deploy/wmagent-couch.ini $couchdb_ini
perl -p -i -e "s{deploy_project_root}{$root/projects}g" $couchdb_ini
# grab the WMAgent MySQL config
cp $wmcore_etc/deploy/wmagent-mysql.cnf $mysql_config
;;
* )
case $variant in prod ) secrets= ;; preprod ) secrets=Preprod ;; * ) secrets=Dev ;; esac
deploy_pkg \
-a dmwm-service-cert.pem:wmcore/dmwm-service-cert.pem \
-a dmwm-service-key.pem:wmcore/dmwm-service-key.pem \
-a ReqMgrSecrets.py:reqmgr/ReqMgrSecrets${secrets}.py comp cms+reqmgr
if grep -rq "replace me" $project_auth; then
note "WARNING: replace certificates in $project_auth with real ones"
else :; fi
;;
esac
}
deploy_reqmgr_post()
{
case $host in vocms013[89] ) disable ;; * ) enable ;; esac
case $variant in
offsite )
;;
* )
# Tell couch to pick up reqmgr on the next restart
local reqmgrapp=$root/current/apps/reqmgr
for couch in couchdb:5984; do
echo "couchapp push $reqmgrapp/data/couchapps/ReqMgr" \
"http://localhost:${couch##*:}/reqmgr_workload_cache" \
> $root/state/${couch%%:*}/stagingarea/reqmgr
echo "couchapp push $reqmgrapp/data/couchapps/ConfigCache" \
"http://localhost:${couch##*:}/reqmgr_config_cache" \
>> $root/state/${couch%%:*}/stagingarea/reqmgr
done
# Setup ReqMgr cronjobs
(mkcrontab
sysboot
case $variant:$host in
prod:vocms0140 | preprod:vocms0131 | dev:vocms0127 | dev:vocms0126 | default:* )
local cmd="$project_config/manage updateversions 'I did read documentation'"
$nogroups || cmd="sudo -H -u _reqmgr bashs -l -c \"${cmd}\""
echo "58 * * * * $cmd" ;;
* ) ;;
esac) | crontab -
;;
esac
}
deploy_reqmgr_auth()
{
case $1 in
*/*-cert.pem )
echo "replace me with your dmwm service certificate" ;;
*/*-key.pem )
echo "replace me with your dmwm service key" ;;
*/ReqMgrSecrets*.py )
echo 'connectUrl = "oracle://FOO:BAR@ZOINKS"' ;;
esac
}