Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CLC-1220 Move upgrade function from calcentral into its own script, a…

…nd use it from deploy.rb
  • Loading branch information...
commit 41f6584fc0294d69d117285911172273041136c6 1 parent 66a9452
@ctweney ctweney authored
View
16 config/deploy.rb
@@ -22,21 +22,7 @@
task :update, :roles => :calcentral_dev_host do
# Take everything offline first.
script_folder = project_root + ("/script")
- run "cd #{script_folder}; ./stop-trinidad.sh"
- # Run db migrate on the first app server
- servers = find_servers_for_task(current_task)
- run "cd #{script_folder}; ./update-build.sh"
- transaction do
- servers.each_with_index do |server, index|
- if (index == 0)
- logger.debug "---- Server: #{server.host} running migrate in transaction on offline app servers"
- run "cd #{script_folder}; ./migrate.sh", :hosts => server
- end
- end
- end
- servers.each do |server|
- run "cd #{script_folder}; ./start-trinidad.sh", :hosts => server
- end
+ run "cd #{script_folder}; ./upgrade.sh"
end
end
View
5 script/downgrade.sh
@@ -12,5 +12,6 @@ echo | $LOGIT
echo "------------------------------------------" | $LOGIT
echo "`date`: Downgrading CalCentral to $LAST_VERSION on app node: `hostname -s`" | $LOGIT
-cd script
-./migrate.sh $LAST_VERSION
+./script/init.d/calcentral stop
+
+./script/migrate.sh $LAST_VERSION
View
23 script/init.d/calcentral
@@ -11,8 +11,6 @@ START_SCRIPT="$CC_BASE/script/start-trinidad.sh"
STOP_SCRIPT="$CC_BASE/script/stop-trinidad.sh"
BG_START_SCRIPT="$CC_BASE/script/start-backstage.sh"
BG_STOP_SCRIPT="$CC_BASE/script/stop-backstage.sh"
-UPDATE_SCRIPT="$CC_BASE/script/update-build.sh"
-MIGRATE_SCRIPT="$CC_BASE/script/migrate.sh"
DOCROOT="/var/www/html/calcentral"
OFFLINE_FILE="$DOCROOT/calcentral-in-maintenance"
NIGHTLY_HTML="$DOCROOT/index_nightly.html"
@@ -65,24 +63,6 @@ emergency () {
offline
}
-upgrade () {
- if [ ! -x "$UPDATE_SCRIPT" ]; then
- echo "$UPDATE_SCRIPT doesn't exist or is not executable"
- exit 1
- fi
- echo "Updating CalCentral code to current version on $REMOTE:$BRANCH"
- $UPDATE_SCRIPT
- if [ "X$NODEONE" != "X" ]; then
- if [ ! -x "$MIGRATE_SCRIPT" ]; then
- echo "$MIGRATE_SCRIPT doesn't exist or is not executable"
- exit 1
- fi
- echo "Migrating database..."
- $MIGRATE_SCRIPT
- start
- fi
-}
-
start() {
if [ "X$NODEONE" != "X" ]; then
if [ ! -x "$BG_START_SCRIPT" ]; then
@@ -157,9 +137,6 @@ case "$1" in
emergency)
emergency
;;
- upgrade)
- upgrade
- ;;
*)
echo "Usage: $0 {start|stop|restart|status|online|offline|nightly|maint|emergency}"
esac
View
17 script/upgrade.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# Script to upgrade a shared deployment of CalCentral, include code update, build, db migration, and restart.
+
+cd $( dirname "${BASH_SOURCE[0]}" )/..
+
+HOSTNAME=`uname -n`
+if [[ "${HOSTNAME}" = ets-calcentral-*-01\.ist.berkeley.edu ]]; then
+ NODEONE="yes"
+fi
+
+./script/update-build.sh
+
+if [ "X$NODEONE" != "X" ]; then
+ ./script/migrate.sh
+fi
+
+./script/init.d/calcentral start
Please sign in to comment.
Something went wrong with that request. Please try again.