Changeset 1105


Ignore:
Timestamp:
Nov 9, 2010, 12:55:32 PM (6 years ago)
Author:
work@…
Message:
  • refactored ci script to allow other (test, www) deployments
  • refactored ci script to allow different tomcat instances
  • renamed ci script to generic deploy script
Location:
misc/scripts
Files:
1 deleted
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • misc/scripts/check_tomcat.sh

    r1079 r1105  
    1010# $Rev$
    1111
     12if [ $1 ]; then
     13        # set type
     14        TYPE=$1
     15else
     16        echo "Usage: $0 <type>"
     17        echo "       where type is ci, test or www"
     18        exit;
     19fi
     20
    1221STAMP=`date +'%Y%m%d%H%M'`
    1322export JAVA_HOME=/usr/lib/jvm/java-6-sun
     
    1928export PATH=$HOME/grails/bin:$PATH
    2029
    21 if [ `ps ax|grep -i tomcat/bin/bootstrap.jar|grep -vi grep|wc -l` -lt 1 ]; then
    22         echo $STAMP tomcat seems down, restarting...
    23         cd /home/tomcat/apache-tomcat/bin
     30if [ `ps ax|grep -i tomcat-$TYPE/bin/bootstrap.jar|grep -vi grep|wc -l` -lt 1 ]; then
     31        echo $STAMP tomcat-$TYPE seems down, restarting...
     32        cd /home/tomcat/apache-tomcat-$TYPE/bin
    2433        ./startup.sh > /dev/null
    2534fi
    26 
  • misc/scripts/deploy.sh

    r1081 r1105  
    11#!/bin/sh
    2 # Continuous integration build script
     2# deploy script
    33#
    44# What it does:
     
    2727# $Rev$
    2828
     29# set the project
    2930if [ $1 ]; then
    30 # set project
    3131        PROJECT=$1
    3232else
    33         echo "Usage: $0 <projectname>"
     33        echo "Usage: $0 <projectname> <type>"
     34        echo "       where type is on of ci, test or www"
     35        exit;
     36fi
     37
     38# set the type
     39if [ $2 ]; then
     40        TYPE=$2
     41else
     42        echo "Usage: $0 <projectname> <type>"
     43        echo "       where type is on of ci, test or www"
     44        exit;
     45fi
     46
     47# check if we got a proper release type
     48if [ ! -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"
    3453        exit;
    3554fi
     
    4968        export JAVA_HOME=/usr/lib/jvm/java-6-sun
    5069        GRAILS_INSTALL_PATH=/app
    51         PATH_TOMCAT_WEBAPPS=/home/tomcat/apache-tomcat/webapps
    52         APACHE_VHOST_FILES=/etc/apache2/sites-available/nmcdsp.org_$PROJECT-ci.conf
    53         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"
    5574        APACHE_RESTART="sudo /etc/init.d/apache2 restart"
    5675else
     
    7089TEMP=$HOME/tmp
    7190SVN=`which svn`
    72 DEV_PLUGINS=( db-util nadd-neutralizer )
    73 MANAGER_URL=http://manager.nmcdsp.org/manager/html/undeploy?path=
     91DEV_PLUGINS=( nadd-neutralizer )
     92MANAGER_URL=http://$TYPE.manager.nmcdsp.org/manager/html/undeploy?path=
    7493MANAGER_USER=ci
    7594MANAGER_PASSWORD=berterni3
     
    105124#SVN_REVISION=`$SVN update .| sed -n 's/At revision \(.*\)\./\1/p'`
    106125SVN_REVISION=`$SVN update|sed -n 's/At revision \(.*\)\./\1/p'`
    107 RUNNING_REVISION=`cat $TEMP/$PROJECT.revision`
     126RUNNING_REVISION=`cat $TEMP/$PROJECT-$TYPE.revision`
     127
     128# only use this for CI builds
     129if [ "$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
     134fi
    108135
    109136# got an SVN revision?
     
    208235echo $STAMP setting build information variables in application.properties
    209236TIMESTAMP=`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
     237sed -i 's/app\.build\.type=\w\+/app.build.type=$TYPE/gi' application.properties
    212238sed -i 's/app\.build\.timestamp=\w\+/app.build.timestamp='$TIMESTAMP'/gi' application.properties
    213239sed -i 's/app\.build\.svn\.revision=\w\+/app.build.svn.revision='$SVN_REVISION'/gi' application.properties
    214240
     241# only display build information on non-production instances
     242if [ "$TYPE" != "www" ]; then
     243        sed -i 's/app\.build\.display\.info=\w\+/app.build.display.info=1/gi' application.properties
     244fi
     245
    215246# 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
     247echo $STAMP patching datasource for $TYPE instance
     248sed -i 's/5432\/'$PROJECT'/5432\/'$PROJECT'-$TYPE/g' grails-app/conf/DataSource.groovy
     249
     250# patch Searchable
     251if [ -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
     254fi
    218255
    219256# adding patch for OAuth configuration file (consumer key and consumer secret generated by myExperiment).
     
    238275# deploying new build
    239276echo $STAMP deploying new production WAR
    240 cp target/$PROJECT-$APP_VERSION.war $PATH_TOMCAT_WEBAPPS/$PROJECT-$APP_VERSION-ci.war
     277cp target/$PROJECT-$APP_VERSION.war $PATH_TOMCAT_WEBAPPS/$PROJECT-$APP_VERSION-$TYPE.war
    241278
    242279# fix virtual host files
     
    252289
    253290# update revision file
    254 echo $SVN_REVISION > $TEMP/$PROJECT.revision
     291echo $SVN_REVISION > $TEMP/$PROJECT-$TYPE.revision
    255292
    256293# remove lock file
Note: See TracChangeset for help on using the changeset viewer.