Skip to content

Commit

Permalink
Select package versions via meta-package by default.
Browse files Browse the repository at this point in the history
From: Diego da Silva Gomes <diego@cern.ch>


git-svn-id: svn+ssh://svn.cern.ch/reps/CMSDMWM/Infrastructure/trunk@15389 4525493e-7705-40b1-a816-d608a930855b
  • Loading branch information
geneguvo authored and diego committed Mar 13, 2012
1 parent c9e2698 commit ceb1f71
Show file tree
Hide file tree
Showing 30 changed files with 95 additions and 89 deletions.
25 changes: 18 additions & 7 deletions Deploy
Expand Up @@ -6,6 +6,7 @@
##H
##H Possible options:
##H -A ARCH Install platform ARCH instead of the default one.
##H -R RELEASE Take package versions from RELEASE meta-package.
##H -M Activate $MIGRATION commands.
##H -a Activate production installation under multiple accounts.
##H -r A=B Use repository B instead of A (e.g. comp=comp.pre).
Expand Down Expand Up @@ -36,6 +37,7 @@ nogroups=true
servicedir="$(cd $(dirname $0) && pwd)"
cfgversion=
privauthdir=
release=

case $(uname) in
Darwin ) arch=osx106_amd64_gcc461 xargsr="xargs" ;;
Expand All @@ -46,6 +48,7 @@ esac
while [ $# -ge 1 ]; do
case $1 in
-A ) arch="$2"; shift; shift ;;
-R ) release="$(echo $2 | tr @ +)"; shift; shift ;;
-M ) MIGRATION=true; shift ;;
-a ) nogroups=false; shift ;;
-r ) repoedit="s/${2%=*}/${2#*=}/; $repoedit"; shift; shift ;;
Expand Down Expand Up @@ -311,14 +314,27 @@ deploy_pkg()
local repo=$(echo $1 | sed -e "$repoedit")
local label=$(echo $repo | sed 's/^comp//; s/^\([^.]\)/.\1/; s/^/sw/; n')
local swarea=$root/$cfgversion/$label
local ver=${project_version_override:-$3}
local ver=${project_version_override:-${3:-auto}}
local pkg=$2

case $ver:$release in auto: )
note "ERROR: deploying '$pkg' version 'auto' requires -R META-RELEASE"
exit 4 ;;
esac

(set -e
inrepo $repo $swarea
[ X"$ver" != Xauto ] ||
ver=$(apt-cache depends "cms+$release" |
fgrep "Depends: $pkg+" | awk -F+ '{print $NF}')
apt-get update
apt-get -y install $(apt-cache pkgnames | grep fake)
apt-get -y install $pkg+$ver)
apt-get -y install $pkg+$ver

# Create application link.
[ X"$link" != X ] || link=${pkg#*+}
rm -f $root/current/apps/$link
ln -s ../$label/$arch/$(echo $pkg+$ver | tr + /) $root/current/apps/$link)
[ $? = 0 ]

(set -e
Expand All @@ -336,11 +352,6 @@ deploy_pkg()
find $swarea/$arch -type d ! -perm -660 -print0 | $xargsr -t -0 chmod ug+rw
find $swarea/$arch -type f ! -group _sw -print0 | $xargsr -t -0 chgrp _sw
fi

# Create application link.
[ X"$link" != X ] || link=${pkg#*+}
rm -f $root/current/apps/$link
ln -s ../$label/$arch/$(echo $pkg+$ver | tr + /) $root/current/apps/$link
fi

# Install configuration.
Expand Down
21 changes: 11 additions & 10 deletions admin/InstallDev
@@ -1,11 +1,11 @@
#!/bin/sh

### Usage: InstallDev -h
### Usage: InstallDev [-A arch] [-d DIR] -s image -v VER -p PKGS [-r A=B] [-a AUTH]
### Usage: InstallDev [-A arch] [-d DIR] -s post[:HOST] -v VER -p PKGS
### Usage: InstallDev [-A arch] [-d DIR] -s status[:what]
### Usage: InstallDev [-A arch] [-d DIR] -s start[:what]
### Usage: InstallDev [-A arch] [-d DIR] -s stop[:what]
### Usage: InstallDev [-A arch] [-R RELEASE] [-d DIR] -s image -v VER -p PKGS [-r A=B] [-a AUTH]
### Usage: InstallDev [-A arch] [-R RELEASE] [-d DIR] -s post[:HOST] -v VER -p PKGS
### Usage: InstallDev [-A arch] [-R RELEASE] [-d DIR] -s status[:what]
### Usage: InstallDev [-A arch] [-R RELEASE] [-d DIR] -s start[:what]
### Usage: InstallDev [-A arch] [-R RELEASE] [-d DIR] -s stop[:what]

usage()
{
Expand All @@ -19,11 +19,12 @@ help()
exit 0
}

STAGE= VER= REPO= ACFG= PKGS= ARCH=
STAGE= VER= REPO= ACFG= PKGS= ARCH= RELEASE=
for arg; do
case $arg in
-d) cd "$2" || exit $?; shift; shift ;;
-A) ARCH="-A $2"; shift; shift ;;
-R) RELEASE="-R $2"; shift; shift ;;
-s) STAGE="$2"; shift; shift ;;
-v) VER="$2"; shift; shift ;;
-r) REPO="-r $2"; shift; shift ;;
Expand Down Expand Up @@ -58,15 +59,15 @@ esac
case $STAGE in
image )
set -ex
$PWD/cfg/Deploy $ARCH $ACFG -t $VER -a -s prep $PWD $PKGS
$PWD/cfg/Deploy $ARCH $RELEASE $ACFG -t $VER -a -s prep $PWD $PKGS
$PWD/cfg/admin/ProxySeed -t dev -d $PWD/$VER/auth/proxy
sudo -H -u _sw bashs -lc "$PWD/cfg/Deploy $ARCH $ACFG $REPO -t $VER -a -s sw $PWD $PKGS"
$PWD/cfg/Deploy $ARCH $REPO -t $VER -a -s post $PWD $PKGS
sudo -H -u _sw bashs -lc "$PWD/cfg/Deploy $ARCH $RELEASE $ACFG $REPO -t $VER -a -s sw $PWD $PKGS"
$PWD/cfg/Deploy $ARCH $RELEASE $REPO -t $VER -a -s post $PWD $PKGS
;;

post )
set -ex
$PWD/cfg/Deploy $ARCH -H $WHAT $REPO -t $VER -a -s post $PWD $PKGS
$PWD/cfg/Deploy $ARCH $RELEASE -H $WHAT $REPO -t $VER -a -s post $PWD $PKGS
;;

start | status | stop )
Expand Down
51 changes: 26 additions & 25 deletions admin/InstallProd
@@ -1,26 +1,26 @@
#!/bin/sh

### Usage: InstallProd -h
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -s image -v VER -p PKGS -u PXUSER [-r A=B] [-a AUTH]
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -s kstart
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s state:maintenance -u USER
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s dnswait:ALIAS
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s shutdown
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s checkprocs
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s backup:save
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s sysprep:{image|backend|frontend}
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s sync -v VER
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s backup:restore
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s post -v VER -p PKGS
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s migrate -p PKGS
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s reboot
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s status[:what]
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s start[:what]
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s stop[:what]
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s check -v VER
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s state:check
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -t HOSTS -s state:production -u USER
### Usage: InstallProd [-A arch] [-d DIR] -x PROD -s kstop
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -s image -v VER -p PKGS -u PXUSER [-r A=B] [-a AUTH]
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -s kstart
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s state:maintenance -u USER
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s dnswait:ALIAS
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s shutdown
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s checkprocs
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s backup:save
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s sysprep:{image|backend|frontend}
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s sync -v VER
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s backup:restore
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s post -v VER -p PKGS
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s migrate -p PKGS
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s reboot
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s status[:what]
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s start[:what]
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s stop[:what]
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s check -v VER
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s state:check
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -t HOSTS -s state:production -u USER
### Usage: InstallProd [-A arch] [-R RELEASE] [-d DIR] -x PROD -s kstop

usage()
{
Expand All @@ -46,13 +46,14 @@ confirm()
esac
}

STAGE= VER= REPO= ACFG= PKGS= HOSTS= PXUSER= STEM= ARCH=
eval set -- $(getopt -n $0 -o hs:d:v:r:a:p:t:u:x: -- ${1+"$@"})
STAGE= VER= REPO= ACFG= PKGS= HOSTS= PXUSER= STEM= ARCH= RELEASE=
eval set -- $(getopt -n $0 -o A:R:hs:d:v:r:a:p:t:u:x: -- ${1+"$@"})
[ $? = 0 ] || usage
for arg; do
case $arg in
-d) cd "$2" || exit $?; shift; shift ;;
-A) ARCH="-A $2"; shift; shift ;;
-R) RELEASE="-R $2"; shift; shift ;;
-t) HOSTS="$2"; shift; shift ;;
-s) STAGE="$2"; shift; shift ;;
-v) VER="$2"; shift; shift ;;
Expand Down Expand Up @@ -134,12 +135,12 @@ case $STAGE in
rm -f srv
ln -s srv-$STEM srv
mkdir -p srv-$STEM
$PWD/cfg/Deploy $ARCH $ACFG -t $VER -a -s prep $PWD/srv $PKGS
$PWD/cfg/Deploy $ARCH $RELEASE $ACFG -t $VER -a -s prep $PWD/srv $PKGS
case $VER in hg* | be* )
ssh -o PubkeyAuthentication=no -t $PXUSER@$(hostname) $PWD/cfg/admin/ProxySeed \
-t prod -d cmsweb@$(hostname -f):$PWD/srv/$VER/auth/proxy ;;
esac
sudo -H -u _sw bashs -lc "$PWD/cfg/Deploy $ARCH $ACFG $REPO -t $VER -a -s sw $PWD/srv $PKGS"
sudo -H -u _sw bashs -lc "$PWD/cfg/Deploy $ARCH $RELEASE $ACFG $REPO -t $VER -a -s sw $PWD/srv $PKGS"
;;

kstart | kstop )
Expand Down Expand Up @@ -325,7 +326,7 @@ case $STAGE in
set -e
for host in $HOSTS; do
(echo "exec 2>&1; set -ex; hostname -f; cd $PWD; klist -s"
echo "\$PWD/cfg/Deploy $ARCH $REPO -t $VER -a -s post $PWD/srv $PKGS") |
echo "\$PWD/cfg/Deploy $ARCH $RELEASE $REPO -t $VER -a -s post $PWD/srv $PKGS") |
ssh cmsweb@$host bashs -l
done

Expand Down
4 changes: 2 additions & 2 deletions admin/deploy
Expand Up @@ -14,11 +14,11 @@ deploy_admin_sw()
{
local p pkgs="rotatelogs pystack"
case $variant in devtools )
deploy_pkg comp cms+wmcore-devtools 1.0
deploy_pkg comp cms+wmcore-devtools
pkgs="$pkgs wmcore-devtools"
;;
esac
deploy_pkg -a proxy/.turd comp external+rotatelogs 2.2.19-comp
deploy_pkg -a proxy/.turd comp external+rotatelogs
(for p in $pkgs; do
echo ". $root/current/apps/$p/etc/profile.d/init.sh"
done) > $project_config/init.sh
Expand Down
3 changes: 1 addition & 2 deletions asyncstageout/deploy
Expand Up @@ -11,8 +11,7 @@ deploy_asyncstageout_prep()

deploy_asyncstageout_sw()
{
ASYNCSTAGEOUT_VERSION="0.0.1"
deploy_pkg comp cms+asyncstageout $ASYNCSTAGEOUT_VERSION
deploy_pkg comp cms+asyncstageout
}

deploy_asyncstageout_post()
Expand Down
2 changes: 1 addition & 1 deletion backend/deploy
Expand Up @@ -6,7 +6,7 @@ deploy_backend_prep()

deploy_backend_sw()
{
deploy_pkg comp cms+pystack 1.0b-comp2
deploy_pkg comp cms+pystack
rm -f $root/current/bin/{pystack,gdb}
ln -s ../apps/pystack/bin/{pystack,gdb} $root/current/bin/
}
Expand Down
2 changes: 1 addition & 1 deletion base/deploy
Expand Up @@ -11,7 +11,7 @@ deploy_base_prep()

deploy_base_sw()
{
deploy_pkg comp cms+webtools-base 0.1.21-comp2
deploy_pkg comp cms+webtools-base
}

deploy_base_post()
Expand Down
2 changes: 1 addition & 1 deletion cmstc/deploy
Expand Up @@ -6,7 +6,7 @@ deploy_cmstc_prep()

deploy_cmstc_sw()
{
deploy_pkg comp cms+CmsTC 0.0.1
deploy_pkg comp cms+CmsTC
}

deploy_cmstc_post()
Expand Down
2 changes: 1 addition & 1 deletion couchdb/deploy
Expand Up @@ -16,7 +16,7 @@ deploy_couchdb_prep()
deploy_couchdb_sw()
{
rm -f $project_auth/hmackey.ini
deploy_pkg -a couchdb/hmackey.ini comp external+couchdb 1.1.0-comp5
deploy_pkg -a couchdb/hmackey.ini comp external+couchdb
perl -p -i -e "s|{ROOT}|$root|g" $project_config/local.ini

case $variant in
Expand Down
4 changes: 1 addition & 3 deletions crabserver/deploy
Expand Up @@ -12,9 +12,7 @@ deploy_crabserver_prep()

deploy_crabserver_sw()
{
SERVER_VERSION="3.0.2"

deploy_pkg comp cms+crab-server3 $SERVER_VERSION
deploy_pkg comp cms+crab-server3

mkdir -p $root/current/install/crabserver

Expand Down
2 changes: 1 addition & 1 deletion das/deploy
Expand Up @@ -15,7 +15,7 @@ deploy_das_prep()

deploy_das_sw()
{
deploy_pkg comp cms+das 1.1.12
deploy_pkg comp cms+das
perl -p -i -e "s|{ROOT}|$root|" $project_config/analytics_cfg.py
}

Expand Down
2 changes: 1 addition & 1 deletion dbs/deploy
Expand Up @@ -15,7 +15,7 @@ deploy_dbs_prep()

deploy_dbs_sw()
{
deploy_pkg -a dbs/DBSSecrets.py -l dbs comp cms+dbs3 3.0.15
deploy_pkg -a dbs/DBSSecrets.py -l dbs comp cms+dbs3
cp -p $project_config/DBS-${variant}.py $project_config/DBS.py
}

Expand Down
2 changes: 1 addition & 1 deletion dbsweb/deploy
Expand Up @@ -12,7 +12,7 @@ deploy_dbsweb_prep()
deploy_dbsweb_sw()
{
app=$root/current/apps/dbs-web
deploy_pkg comp cms+dbs-web V06_00_52-comp2
deploy_pkg comp cms+dbs-web
perl -p -i -e "s|{ROOT}|$root|g" $project_config/DBSDD.conf
setgroup ug+r,g-w,o-rwx _config $project_config/DBSDD.conf
chmod g-w,o-rwx $project_config/DBSDD.conf
Expand Down
2 changes: 1 addition & 1 deletion dqmgui/deploy
Expand Up @@ -40,7 +40,7 @@ deploy_dqmgui_prep()

deploy_dqmgui_sw()
{
deploy_pkg comp cms+dqmgui 6.1.4
deploy_pkg comp cms+dqmgui
}

deploy_dqmgui_post()
Expand Down
2 changes: 1 addition & 1 deletion filemover/deploy
Expand Up @@ -16,7 +16,7 @@ deploy_filemover_prep()

deploy_filemover_sw()
{
deploy_pkg comp cms+filemover 1.1.3
deploy_pkg comp cms+filemover

case $variant in dev | preprod | prod ) ;; * )
perl -p -i -e "s|cleaner.url = 'https://cmsweb.cern.ch/filemover'|cleaner.url = 'https://\\\$\(hostname -f\)/filemover'|g" \
Expand Down
2 changes: 1 addition & 1 deletion frontend/deploy
Expand Up @@ -13,7 +13,7 @@ deploy_frontend_prep()

deploy_frontend_sw()
{
deploy_pkg -a frontend/sitedbread.py comp cms+frontend 4.3
deploy_pkg -a frontend/sitedbread.py comp cms+frontend

if grep -q Oracle $project_auth/sitedbread.py; then :; else
deploy_frontend_fakeauth $project_auth/users.db
Expand Down
2 changes: 1 addition & 1 deletion mongodb/deploy
Expand Up @@ -11,7 +11,7 @@ deploy_mongodb_prep()

deploy_mongodb_sw()
{
deploy_pkg comp external+mongo 2.0.1
deploy_pkg comp external+mongo
}

deploy_mongodb_post()
Expand Down
2 changes: 1 addition & 1 deletion mysql/deploy
Expand Up @@ -6,5 +6,5 @@ deploy_mysql_prep()

deploy_mysql_sw()
{
deploy_pkg comp external+mysql 5.1.58
deploy_pkg comp external+mysql
}
2 changes: 1 addition & 1 deletion overview/deploy
Expand Up @@ -11,7 +11,7 @@ deploy_overview_prep()

deploy_overview_sw()
{
deploy_pkg -a overview/dbparam.py comp cms+overview 6.0.7-comp2
deploy_pkg -a overview/dbparam.py comp cms+overview
}

deploy_overview_post()
Expand Down
6 changes: 3 additions & 3 deletions phedex/deploy
Expand Up @@ -11,9 +11,9 @@ deploy_phedex_prep()

deploy_phedex_sw()
{
deploy_pkg comp cms+PHEDEX-datasvc 2.3.7
deploy_pkg comp cms+PHEDEX-webapp 1.3.7
deploy_pkg -a phedex/DBParam -a phedex/DBGraph comp cms+PHEDEX-web 4.2.3
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
Expand Down
14 changes: 7 additions & 7 deletions reqmgr/deploy
Expand Up @@ -24,12 +24,12 @@ deploy_reqmgr_sw()
{
case $variant in
offsite )
deploy_pkg comp external+cherrypy 3.1.2-cmp6
deploy_pkg comp external+py2-cheetah 2.4.0-cmp6
deploy_pkg comp external+py2-openid 2.2.4-cmp6
deploy_pkg comp external+py2-cjson 1.0.5-cmp5
deploy_pkg comp cms+dls-client DLS_1_1_2-cmp6
deploy_pkg comp cms+dbs-client DBS_2_1_1_patch1_1
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/current/apps/wmcore/etc
local couchdb_ini=$root/current/config/couchdb/local.ini
Expand All @@ -50,7 +50,7 @@ deploy_reqmgr_sw()
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 0.8.11-comp4
-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"
Expand Down

0 comments on commit ceb1f71

Please sign in to comment.