diff contrib/make_flys_release/make_release.sh @ 4484:7e82d51c5a27

Improved build script
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 13 Nov 2012 19:03:59 +0100
parents 0182916dcb01
children b51f6bb188d7
line wrap: on
line diff
--- a/contrib/make_flys_release/make_release.sh	Tue Nov 13 16:52:01 2012 +0100
+++ b/contrib/make_flys_release/make_release.sh	Tue Nov 13 19:03:59 2012 +0100
@@ -1,10 +1,9 @@
-#!/bin/sh
-HG_USER=YOURNAME
+#!/bin/bash
 
 echo "INFO: define required variables"
-ARTIFACTS_HG_REPO="ssh://$HG_USER@hg.wald.intevation.org/hg/dive4elements/artifacts"
-HTTPCLIIENT_HG_REPO="ssh://$HG_USER@hg.wald.intevation.org/hg/dive4elements/http-client"
-FLYS_HG_REPO="ssh://$HG_USER@hg.wald.intevation.org/hg/dive4elements/flys"
+ARTIFACTS_HG_REPO="http://wald.intevation.org/hg/dive4elements/artifacts"
+HTTPCLIIENT_HG_REPO="http://wald.intevation.org/hg/dive4elements/http-client"
+FLYS_HG_REPO="http://wald.intevation.org/hg/dive4elements/flys"
 
 ARTIFACTS_HG="hg.artifacts"
 HTTPCLIENT_HG="hg.http-client"
@@ -15,6 +14,9 @@
 RELEASE_DATE=`date +'%Y-%m-%d'`
 DIRECTORY=$PREFIX$RELEASE_DATE
 
+ARTEFACT_PORT=9002
+TOMCAT_PORT=8005
+
 echo "INFO: create server directories"
 mkdir -p $DIRECTORY/server/bin/lib/own
 mkdir $DIRECTORY/server/shapefiles
@@ -22,20 +24,27 @@
 
 echo "INFO: checkout sources"
 echo " ... checkout $ARTIFACTS_HG_REPO"
+
+rm -rf $ARTIFACTS_HG
 hg clone $ARTIFACTS_HG_REPO $ARTIFACTS_HG
 (cd $ARTIFACTS_HG && hg co $RELEASE)
 
 echo " ... checkout $HTTPCLIIENT_HG_REPO"
+rm -rf $HTTPCLIENT_HG
 hg clone $HTTPCLIIENT_HG_REPO $HTTPCLIENT_HG
 (cd $HTTPCLIENT_HG && hg co $RELEASE)
 
 echo " ... checkout $FLYS_HG_REPO"
+rm -rf $FLYS_HG
 hg clone $FLYS_HG_REPO $FLYS_HG
 (cd $FLYS_HG && hg co $RELEASE)
 
 # adapt client configuration
 echo "INFO: prepare configuration of web client"
-cp confs/web.xml $FLYS_HG/flys-client/src/main/webapp/WEB-INF/web.xml
+
+sed -i -e "s@http://localhost:8181@http://localhost:$ARTEFACT_PORT@g " \
+       -e "a@http://localhost:8888@http://localhost:$TOMCAT_PORT@g" \
+    $FLYS_HG/flys-client/src/main/webapp/WEB-INF/web.xml
 
 echo "INFO: download OpenLayers-2.11 for client"
 curl -O http://openlayers.org/download/OpenLayers-2.11.tar.gz
@@ -48,8 +57,8 @@
 
 # compile and build our code stuff
 echo "INFO: compile and build sources"
-mvn -f $ARTIFACTS_HG/pom.xml clean compile package
-mvn -f $FLYS_HG/flys-backend/pom.xml clean compile package
+mvn -f $ARTIFACTS_HG/pom.xml clean compile package install
+mvn -f $FLYS_HG/flys-backend/pom.xml clean compile package install
 mvn -f $FLYS_HG/flys-artifacts/pom.xml clean compile package dependency:copy-dependencies
 mvn -f $HTTPCLIENT_HG/pom.xml clean compile package install
 mvn -f $FLYS_HG/flys-client/pom.xml clean compile package
@@ -61,7 +70,7 @@
 cp $ARTIFACTS_HG/artifacts-common/target/artifacts-common-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/
 cp $FLYS_HG/flys-backend/target/flys-backend-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/
 cp $FLYS_HG/flys-artifacts/target/flys-artifacts-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/
-cp $FLYS_HG/flys-client/target/FLYS-1.0-SNAPSHOT.war $DIRECTORY/client/
+cp $FLYS_HG/flys-client/target/FLYS-1.0-SNAPSHOT.war $DIRECTORY/client/flys-${RELEASE}.war
 cp $FLYS_HG/flys-artifacts/target/dependency/* $DIRECTORY/server/bin/lib/
 
 echo "INFO: copy scripts and libraries to target destination"
@@ -80,7 +89,28 @@
 # fetch the configuration stuff
 echo "INFO: copy default configuration to target destination"
 cp -R $FLYS_HG/flys-artifacts/doc/conf $DIRECTORY/server/
-cp confs/* $DIRECTORY/server/conf/
+
+#cp confs/* $DIRECTORY/server/conf/
+mkdir -o $DIRECTORY/server/conf
+
+sed "s/8999/$ARTEFACT_PORT/g" \
+    confs/rest-server.xml \
+    > $DIRECTORY/server/conf/rest-server.xml
+
+sed "s@http://czech-republic.intevation.de/@http://flys-devel.intevation.de/@g" \
+    "s@flys-default@flys-$RELEASE@g" \
+    confs/floodmap.xml \
+    > $DIRECTORY/server/conf/floodmap.xml
+
+sed "s@/tmp/flys-server-default.log@/tmp/flys-server-${RELEASE}.log" \
+    confs/log4j.properties \
+    > $DIRECTORY/server/conf/log4j.properties
+
+# TODO: Use templating here
+cp confs/seddb-db.xml $DIRECTORY/server/conf/seddb-db.xml
+cp confs/backend-db.xml $DIRECTORY/server/conf/backend-db.xml
+cp confs/artifact-db.xml $DIRECTORY/server/conf/artifact-db.xml
+cp confs/datacage-db.xml $DIRECTORY/server/conf/datacage-db.xml
 
 cp $ARTIFACTS_HG/artifact-database/doc/schema-h2.sql h2/artifacts-h2.sql
 cp $FLYS_HG/flys-artifacts/doc/conf/datacage.sql h2/datacage.sql

http://dive4elements.wald.intevation.org