changeset 8495:dc0351c5d098

Artifact-server config in release script: remove installation specific defaults and give the possibility to overwrite any config-file.
author Tom Gottfried <tom@intevation.de>
date Thu, 04 Dec 2014 18:15:05 +0100
parents 76994a0187fa
children 1314d876a7e5
files contrib/make_flys_release/README contrib/make_flys_release/make_release.sh
diffstat 2 files changed, 32 insertions(+), 135 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/make_flys_release/README	Thu Dec 04 13:00:23 2014 +0100
+++ b/contrib/make_flys_release/README	Thu Dec 04 18:15:05 2014 +0100
@@ -6,26 +6,26 @@
 Wichtige variablen sind:
 FLYS_SOURCE_DIR
 TOMCAT_PORT
-MAPSERVER_URL
 FONT_PATH
 WIKI_URL
 LOG_DIR
 DEVELOPER
 DEFAULT_WD
 
-# Seddb Configuration
-SEDDBURL
-SEDDBPORT
-SEDDBBACK
-SEDDBUSER
-SEDDBPASS
+Artefakt-Server-Konfiguration:
+SERVER_CONF: Pfad zu einem Verzeichnis, dessen Inhalt in das 'conf'-Verzeichnis
+             des Artefakt-Servers kopiert wird um Default-Konfigurations-
+             Dateien zu überschreiben. Die Zeichenkette 'D4E_VERSION' wird in
+             den so gegebenen Konfigurationsdateien durch die beim Aufruf des
+             Skriptes angegebene Version ersetzt.
 
-# Backend configuration
-BACKENDURL
-BACKENDPORT
-BACKENDBACK
-BACKENDUSER
-BACKENDPASS
+Mit folgenden Umgebungsvariablen können auch einzelne Teile der Artefakt-
+Server-Konfiguration angepasst werden (die geschieht bevor die Default-
+Konfigurations-Dateien überschrieben werden!):
+ARTIFACT_PORT: Port für den Artefakt-Server.
+DGM_PATH:      Prefix für die in der Backend-Datenbank gespeicherten Pfade zu
+               den digitalen Gelände-Modellen.
+WIKI_URL:      URL für die Online-Hilfe (auch für Client-Konfiguration)
 
 FEATURES_XML (Wenn gesetzt pfad zu einer zu verwendenden features.xml)
 
--- a/contrib/make_flys_release/make_release.sh	Thu Dec 04 13:00:23 2014 +0100
+++ b/contrib/make_flys_release/make_release.sh	Thu Dec 04 18:15:05 2014 +0100
@@ -56,28 +56,11 @@
 #   --seddb-pass                    Sediment db password. Default: $SEDDBPASS
 #   --seddb-back                    Sediment db backend. Default: $SEDDBBACK
 TOMCAT_PORT=${TOMCAT_PORT:-8282}
-MAPSERVER_URL=${MAPSERVER_URL:-http://flys-devel.intevation.de/cgi-bin/flys}
 WIKI_URL=${WIKI_URL:-https://flys3-devel.bafg.de/wiki}
 # Prefix to FreeSans.ttf
 FONT_PATH=${FONT_PATH:-/opt/flys}
 
-# Seddb Configuration
-SEDDBURL=${SEDDBURL:-czech-republic.atlas.intevation.de}
-SEDDBPORT=${SEDDBPORT:-5432}
-SEDDBBACK=${SEDDBBACK:-seddb}
-SEDDBUSER=${SEDDBUSER:-flys}
-SEDDBPASS=${SEDDBPASS:-flys}
-SEDINITSQLS=${SEDINITSQLS:-}
-
-
 # Backend configuration
-BACKENDURL=${BACKENDURL:-czech-republic.atlas.intevation.de}
-BACKENDPORT=${BACKENDPORT:-5432}
-BACKENDBACK=${BACKENDBACK:-flys_devel}
-BACKENDUSER=${BACKENDUSER:-flys_dami}
-BACKENDPASS=${BACKENDPASS:-flys_dami}
-INITSQLS=${INITSQLS:-}
-DGM_PATH=${DGM_PATH:-/vol1/projects/Geospatial/flys-3.0/testdaten/dami_dgms/}
 LOG_DIR=/var/log/flys
 
 # Client configuration
@@ -238,29 +221,6 @@
 sed -i -e "s@/usr/share/fonts/truetype/freefont@${FONT_PATH}@g" \
     $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/config.yaml
 
-if [ -r "$RIVERMAP_XML" ]; then
-    cp "$RIVERMAP_XML" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/rivermap.xml
-fi
-
-if [ -r "$FLOODMAP_XML" ]; then
-    cp "$FLOODMAP_XML" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/floodmap.xml
-fi
-
-if [ -r "$METADATA_XML" ]; then
-    cp "$METADATA_XML" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/meta-data.xml
-fi
-
-if [ -r "$MODULES_XML" ]; then
-    cp "$MODULES_XML" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/modules.xml
-fi
-
-if [ -r "$ZOOMSCALES_XML" ]; then
-    cp "$ZOOMSCALES_XML" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/zoom-scales.xml
-fi
-
-if [ -r "$SERVER_LOG4J" ]; then
-    cp "$SERVER_LOG4J" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/log4j.properties
-fi
 
 if [ ! -f $FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz ]; then
     echo "INFO: download OpenLayers-2.11 for client"
@@ -332,102 +292,39 @@
     rm -f $WORK_DIR/server/bin/lib/ojdbc*
 fi
 
-# fetch the configuration stuff
+
 echo "INFO: copy default configuration to target destination"
 cp -R $FLYS_SOURCE_DIR/river/artifacts/doc/conf $WORK_DIR/server/
 
 sed -i "s/8181/$ARTIFACT_PORT/g" \
     $WORK_DIR/server/conf/rest-server.xml
 
-sed -i -e "s@http://yourhost:8081/cgi-bin@${MAPSERVER_URL}-${VERSION}@g" \
-    $WORK_DIR/server/conf/floodmap.xml
-
-sed -i -e "s@http://yourhost:8081/cgi-bin@${MAPSERVER_URL}-${VERSION}@g" \
-    $WORK_DIR/server/conf/rivermap.xml
-
-sed -i -e "s@/usr/share/fonts/truetype/freefont@${FONT_PATH}@g" \
-    $WORK_DIR/server/conf/mapserver/fontset.txt
+if [ -n $DGM_PATH ]; then
+    sed -i -e "s@<dgm-path>/path/to/rivers/</dgm-path>@<dgm-path>${DGM_PATH}</dgm-path>@g" \
+        $WORK_DIR/server/conf/conf.xml
+fi
 
-sed -i -e "s@/tmp/flys-rivers-wms.log@${LOG_DIR}/rivers-wms-${VERSION}.log@g" \
-    $WORK_DIR/server/conf/mapserver/river-mapfile.vm
-
-sed -i -e "s@/tmp/flys-user-wms.log@${LOG_DIR}/user-wms-${VERSION}.log@g" \
-    $WORK_DIR/server/conf/mapserver/mapfile.vm
+if [ -n $WIKI_URL ]; then
+    sed -i -e "s@<help-url>http://example.com</help-url>@<help-url>${WIKI_URL}</help-url>@g" \
+        $WORK_DIR/server/conf/conf.xml
+fi
 
-sed -i -e "s@/var/log/d4e-river/d4e-server.log@${LOG_DIR}/server-${VERSION}.log@" \
-    $WORK_DIR/server/conf/log4j.properties
-
-sed -i -e "s@<dgm-path>/path/to/rivers/</dgm-path>@<dgm-path>${DGM_PATH}</dgm-path>@g" \
-       -e "s@<help-url>http://example.com</help-url>@<help-url>${WIKI_URL}</help-url>@g" \
-    $WORK_DIR/server/conf/conf.xml
+if [ -d $SERVER_CONF ]; then
+    echo "INFO: copy custom configuration to target destination"
+    cp -R $SERVER_CONF/* $WORK_DIR/server/conf/
+    for file in `find $WORK_DIR/server/conf -type f`; do
+        sed -i -e "s@D4E_VERSION@${VERSION}@g" $file
+    done
+fi
 
 
-if [ "$BUILD_ORACLE" = "TRUE" ]; then
-    # Oracle backend configuration
-    cat > $WORK_DIR/server/conf/backend-db.xml << EOF
-<?xml version="1.0" encoding="UTF-8" ?>
-<backend-database>
-    <user>$BACKENDUSER</user>
-    <password>$BACKENDPASS</password>
-    <dialect>org.hibernatespatial.oracle.OracleSpatial10gDialect</dialect>
-    <driver>oracle.jdbc.driver.OracleDriver</driver>
-    <url>jdbc:oracle:thin:@//$BACKENDURL:$BACKENDPORT/$BACKENDBACK</url>
-    <validation-query>select 1 from rivers</validation-query>
-    <max-wait>30000</max-wait>
-    <connection-init-sqls>$INITSQLS</connection-init-sqls>
-</backend-database>
-EOF
-
-cat > $WORK_DIR/server/conf/seddb-db.xml << EOF
-<?xml version="1.0" encoding="UTF-8" ?>
-<seddb-database>
-    <user>$SEDDBUSER</user>
-    <password>$SEDDBPASS</password>
-    <dialect>org.hibernate.dialect.Oracle9iDialect</dialect>
-    <driver>oracle.jdbc.driver.OracleDriver</driver>
-    <url>jdbc:oracle:thin:@//$SEDDBURL:$SEDDBPORT/$SEDDBBACK</url>
-    <validation-query>select 1 from gewaesser</validation-query>
-    <max-wait>30000</max-wait>
-    <connection-init-sqls>$SEDINITSQLS</connection-init-sqls>
-</seddb-database>
-EOF
-
-else
-    #Postgresql backend configuration
-    cat > $WORK_DIR/server/conf/backend-db.xml << EOF
-<?xml version="1.0" encoding="UTF-8" ?>
-<backend-database>
-    <user>$BACKENDUSER</user>
-    <password>$BACKENDPASS</password>
-    <dialect>org.hibernate.dialect.PostgreSQLDialect</dialect>
-    <driver>org.postgresql.Driver</driver>
-    <url>jdbc:postgresql://$BACKENDURL:$BACKENDPORT/$BACKENDBACK</url>
-    <validation-query>select 1 from rivers</validation-query>
-    <connection-init-sqls>$INITSQLS</connection-init-sqls>
-</backend-database>
-EOF
-
-cat > $WORK_DIR/server/conf/seddb-db.xml << EOF
-<?xml version="1.0" encoding="UTF-8" ?>
-<seddb-database>
-    <user>$SEDDBUSER</user>
-    <password>$SEDDBPASS</password>
-    <dialect>org.hibernate.dialect.PostgreSQLDialect</dialect>
-    <driver>org.postgresql.Driver</driver>
-    <url>jdbc:postgresql://$SEDDBURL:$SEDDBPORT/$SEDDBBACK</url>
-    <validation-query>select 1 from gewaesser</validation-query>
-</seddb-database>
-EOF
-
-fi
-
+echo "INFO: create h2 database for artifacts and datacage"
 mkdir $WORK_DIR/artifactsdb
 mkdir $WORK_DIR/datacagedb
 
 cp $FLYS_SOURCE_DIR/framework/artifact-database/doc/schema-h2.sql $WORK_DIR/artifactsdb/artifacts-h2.sql
 cp $FLYS_SOURCE_DIR/river/artifacts/doc/conf/datacage.sql $WORK_DIR/datacagedb/datacage.sql
 
-echo "INFO: create h2 database for artifacts and datacage"
 cd $WORK_DIR
 $SCRIPT_DIR/h2/createArtifacts.sh $WORK_DIR/artifactsdb/artifacts-h2.sql
 $SCRIPT_DIR/h2/createDatacage.sh $WORK_DIR/datacagedb/datacage.sql
@@ -436,10 +333,10 @@
 mv $WORK_DIR/artifactsdb $WORK_DIR/server/
 mv $WORK_DIR/datacagedb $WORK_DIR/server/
 
-if [ -n $INSTALL ]; then
+if [ -f $INSTALL ]; then
     echo "INFO: prepare custom installation script"
     cp $INSTALL $WORK_DIR
-    sed -i "s/VERSION/$VERSION/g" $WORK_DIR/`basename $INSTALL`
+    sed -i "s/D4E_VERSION/$VERSION/g" $WORK_DIR/`basename $INSTALL`
 fi
 
 echo "INFO: create tarball"

http://dive4elements.wald.intevation.org