6 if [[ "$IDENTIFIER" == '' ]]; then
7 echo "Syntax: $0 <identifier> <deploy_repo_name>"
11 if [[ "$DEPLOY_REPO" == '' ]]; then
12 echo "Syntax: $0 <identifier> <deploy_repo_name>"
21 printf "\n%*s\n\n" $(((${#title}+$COLUMNS)/2)) "********** $1 **********"
24 # We only install capistrano in dev mode
25 export RAILS_ENV=development
27 source /etc/profile.d/rvm.sh
30 # Weirdly, jenkins/rvm ties itself in a knot.
33 # Just say what version of ruby we're running
36 function ensure_symlink() {
37 if [[ ! -L $WORKSPACE/$1 ]]; then
38 ln -s $WORKSPACE/$DEPLOY_REPO/$1 $WORKSPACE/$1
42 # Check out/update the $DEPLOY_REPO repository
43 if [[ ! -d $DEPLOY_REPO ]]; then
45 git clone git@git.curoverse.com:$DEPLOY_REPO.git
51 # Make sure the necessary symlinks are in place
53 ensure_symlink "apps/workbench/Capfile.workbench.$IDENTIFIER"
54 ensure_symlink "apps/workbench/config/deploy.common.rb"
55 ensure_symlink "apps/workbench/config/deploy.curoverse.rb"
56 ensure_symlink "apps/workbench/config/deploy.workbench.$IDENTIFIER.rb"
58 ensure_symlink "services/api/Capfile.$IDENTIFIER"
59 ensure_symlink "services/api/config/deploy.common.rb"
60 ensure_symlink "services/api/config/deploy.$IDENTIFIER.rb"
63 title "Deploying API server"
67 bundle install --deployment
69 # make sure we do not print the output of config:check
70 sed -i'' -e "s/RAILS_ENV=production #{rake} config:check/RAILS_ENV=production QUIET=true #{rake} config:check/" $WORKSPACE/$DEPLOY_REPO/services/api/config/deploy.common.rb
72 bundle exec cap deploy -f Capfile.$IDENTIFIER
76 # restore unaltered deploy.common.rb
77 cd $WORKSPACE/$DEPLOY_REPO
78 git checkout services/api/config/deploy.common.rb
80 if [[ "$ECODE" != "0" ]]; then
81 title "!!!!!! DEPLOYING API SERVER FAILED !!!!!!"
82 EXITCODE=$(($EXITCODE + $ECODE))
86 title "Deploying API server complete"
88 # Install updated debian packages
89 title "Deploying updated arvados debian packages"
91 ssh -p2222 $IDENTIFIER.arvadosapi.com -C "apt-get update && apt-get install arvados-src python-arvados-fuse python-arvados-python-client"
93 if [[ "$ECODE" != "0" ]]; then
94 title "!!!!!! DEPLOYING DEBIAN PACKAGES FAILED !!!!!!"
95 EXITCODE=$(($EXITCODE + $ECODE))
99 title "Deploying updated arvados debian packages complete"
102 title "Deploying workbench"
105 bundle install --deployment
107 # make sure we do not print the output of config:check
108 sed -i'' -e "s/RAILS_ENV=production #{rake} config:check/RAILS_ENV=production QUIET=true #{rake} config:check/" $WORKSPACE/$DEPLOY_REPO/apps/workbench/config/deploy.common.rb
110 bundle exec cap deploy -f Capfile.workbench.$IDENTIFIER
114 # restore unaltered deploy.common.rb
115 cd $WORKSPACE/$DEPLOY_REPO
116 git checkout apps/workbench/config/deploy.common.rb
118 if [[ "$ECODE" != "0" ]]; then
119 title "!!!!!! DEPLOYING WORKBENCH FAILED !!!!!!"
120 EXITCODE=$(($EXITCODE + $ECODE))
124 title "Deploying workbench complete"