Changeset 1105 for misc/scripts/deploy.sh
- Timestamp:
- Nov 9, 2010, 12:55:32 PM (10 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
misc/scripts/deploy.sh
r1081 r1105 1 1 #!/bin/sh 2 # Continuous integration buildscript2 # deploy script 3 3 # 4 4 # What it does: … … 27 27 # $Rev$ 28 28 29 # set the project 29 30 if [ $1 ]; then 30 # set project31 31 PROJECT=$1 32 32 else 33 echo "Usage: $0 <projectname>" 33 echo "Usage: $0 <projectname> <type>" 34 echo " where type is on of ci, test or www" 35 exit; 36 fi 37 38 # set the type 39 if [ $2 ]; then 40 TYPE=$2 41 else 42 echo "Usage: $0 <projectname> <type>" 43 echo " where type is on of ci, test or www" 44 exit; 45 fi 46 47 # check if we got a proper release type 48 if [ ! -d /home/tomcat/apache-tomcat-$TYPE ]; then 49 echo "$TYPE is an invalid type" 50 echo "" 51 echo "Usage: $0 <projectname> <type>" 52 echo " where type is on of ci, test or www" 34 53 exit; 35 54 fi … … 49 68 export JAVA_HOME=/usr/lib/jvm/java-6-sun 50 69 GRAILS_INSTALL_PATH=/app 51 PATH_TOMCAT_WEBAPPS=/home/tomcat/apache-tomcat /webapps52 APACHE_VHOST_FILES=/etc/apache2/sites-available/nmcdsp.org_$PROJECT- ci.conf53 TOMCAT_STOP="/home/tomcat/apache-tomcat /bin/shutdown.sh"54 TOMCAT_START="/home/tomcat/apache-tomcat /bin/startup.sh"70 PATH_TOMCAT_WEBAPPS=/home/tomcat/apache-tomcat-$TYPE/webapps 71 APACHE_VHOST_FILES=/etc/apache2/sites-available/nmcdsp.org_$PROJECT-$TYPE.conf 72 TOMCAT_STOP="/home/tomcat/apache-tomcat-$TYPE/bin/shutdown.sh" 73 TOMCAT_START="/home/tomcat/apache-tomcat-$TYPE/bin/startup.sh" 55 74 APACHE_RESTART="sudo /etc/init.d/apache2 restart" 56 75 else … … 70 89 TEMP=$HOME/tmp 71 90 SVN=`which svn` 72 DEV_PLUGINS=( db-utilnadd-neutralizer )73 MANAGER_URL=http:// manager.nmcdsp.org/manager/html/undeploy?path=91 DEV_PLUGINS=( nadd-neutralizer ) 92 MANAGER_URL=http://$TYPE.manager.nmcdsp.org/manager/html/undeploy?path= 74 93 MANAGER_USER=ci 75 94 MANAGER_PASSWORD=berterni3 … … 105 124 #SVN_REVISION=`$SVN update .| sed -n 's/At revision \(.*\)\./\1/p'` 106 125 SVN_REVISION=`$SVN update|sed -n 's/At revision \(.*\)\./\1/p'` 107 RUNNING_REVISION=`cat $TEMP/$PROJECT.revision` 126 RUNNING_REVISION=`cat $TEMP/$PROJECT-$TYPE.revision` 127 128 # only use this for CI builds 129 if [ "$TYPE" != "ci" ]; then 130 # we don't want manual test and production 131 # builds to stop building because they have 132 # the same revision... 133 RUNNING_REVISION=0 134 fi 108 135 109 136 # got an SVN revision? … … 208 235 echo $STAMP setting build information variables in application.properties 209 236 TIMESTAMP=`date +'%s'` 210 sed -i 's/app\.build\.type=\w\+/app.build.type=ci/gi' application.properties 211 sed -i 's/app\.build\.display\.info=\w\+/app.build.display.info=1/gi' application.properties 237 sed -i 's/app\.build\.type=\w\+/app.build.type=$TYPE/gi' application.properties 212 238 sed -i 's/app\.build\.timestamp=\w\+/app.build.timestamp='$TIMESTAMP'/gi' application.properties 213 239 sed -i 's/app\.build\.svn\.revision=\w\+/app.build.svn.revision='$SVN_REVISION'/gi' application.properties 214 240 241 # only display build information on non-production instances 242 if [ "$TYPE" != "www" ]; then 243 sed -i 's/app\.build\.display\.info=\w\+/app.build.display.info=1/gi' application.properties 244 fi 245 215 246 # patch datasource.groovy 216 echo $STAMP patching datasource for ci instance 217 sed -i 's/5432\/'$PROJECT'/5432\/'$PROJECT'-ci/g' grails-app/conf/DataSource.groovy 247 echo $STAMP patching datasource for $TYPE instance 248 sed -i 's/5432\/'$PROJECT'/5432\/'$PROJECT'-$TYPE/g' grails-app/conf/DataSource.groovy 249 250 # patch Searchable 251 if [ -f grails-app/conf/Searchable.groovy ]; then 252 echo $STAMP patching searchable configuration for $TYPE instance 253 sed -i 's/$PROJECT/$PROJECT-$TYPE/gi' grails-app/conf/Searchable.groovy 254 fi 218 255 219 256 # adding patch for OAuth configuration file (consumer key and consumer secret generated by myExperiment). … … 238 275 # deploying new build 239 276 echo $STAMP deploying new production WAR 240 cp target/$PROJECT-$APP_VERSION.war $PATH_TOMCAT_WEBAPPS/$PROJECT-$APP_VERSION- ci.war277 cp target/$PROJECT-$APP_VERSION.war $PATH_TOMCAT_WEBAPPS/$PROJECT-$APP_VERSION-$TYPE.war 241 278 242 279 # fix virtual host files … … 252 289 253 290 # update revision file 254 echo $SVN_REVISION > $TEMP/$PROJECT .revision291 echo $SVN_REVISION > $TEMP/$PROJECT-$TYPE.revision 255 292 256 293 # remove lock file
Note: See TracChangeset
for help on using the changeset viewer.