comparison contrib/make_flys_release/make_release.sh @ 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 5096b4ed230d
comparison
equal deleted inserted replaced
8494:76994a0187fa 8495:dc0351c5d098
54 # --seddb-port Sediment db port. Default: $SEDDBPORT 54 # --seddb-port Sediment db port. Default: $SEDDBPORT
55 # --seddb-user Sediment db user. Default: $SEDDBUSER 55 # --seddb-user Sediment db user. Default: $SEDDBUSER
56 # --seddb-pass Sediment db password. Default: $SEDDBPASS 56 # --seddb-pass Sediment db password. Default: $SEDDBPASS
57 # --seddb-back Sediment db backend. Default: $SEDDBBACK 57 # --seddb-back Sediment db backend. Default: $SEDDBBACK
58 TOMCAT_PORT=${TOMCAT_PORT:-8282} 58 TOMCAT_PORT=${TOMCAT_PORT:-8282}
59 MAPSERVER_URL=${MAPSERVER_URL:-http://flys-devel.intevation.de/cgi-bin/flys}
60 WIKI_URL=${WIKI_URL:-https://flys3-devel.bafg.de/wiki} 59 WIKI_URL=${WIKI_URL:-https://flys3-devel.bafg.de/wiki}
61 # Prefix to FreeSans.ttf 60 # Prefix to FreeSans.ttf
62 FONT_PATH=${FONT_PATH:-/opt/flys} 61 FONT_PATH=${FONT_PATH:-/opt/flys}
63 62
64 # Seddb Configuration
65 SEDDBURL=${SEDDBURL:-czech-republic.atlas.intevation.de}
66 SEDDBPORT=${SEDDBPORT:-5432}
67 SEDDBBACK=${SEDDBBACK:-seddb}
68 SEDDBUSER=${SEDDBUSER:-flys}
69 SEDDBPASS=${SEDDBPASS:-flys}
70 SEDINITSQLS=${SEDINITSQLS:-}
71
72
73 # Backend configuration 63 # Backend configuration
74 BACKENDURL=${BACKENDURL:-czech-republic.atlas.intevation.de}
75 BACKENDPORT=${BACKENDPORT:-5432}
76 BACKENDBACK=${BACKENDBACK:-flys_devel}
77 BACKENDUSER=${BACKENDUSER:-flys_dami}
78 BACKENDPASS=${BACKENDPASS:-flys_dami}
79 INITSQLS=${INITSQLS:-}
80 DGM_PATH=${DGM_PATH:-/vol1/projects/Geospatial/flys-3.0/testdaten/dami_dgms/}
81 LOG_DIR=/var/log/flys 64 LOG_DIR=/var/log/flys
82 65
83 # Client configuration 66 # Client configuration
84 AUTH=${AUTH:-GGinA} 67 AUTH=${AUTH:-GGinA}
85 ELBE_MODEL_UUID=${ELBE_MODEL_UUID:-1a4825f6-925f-11e3-8165-001f29e71d12} 68 ELBE_MODEL_UUID=${ELBE_MODEL_UUID:-1a4825f6-925f-11e3-8165-001f29e71d12}
236 fi 219 fi
237 220
238 sed -i -e "s@/usr/share/fonts/truetype/freefont@${FONT_PATH}@g" \ 221 sed -i -e "s@/usr/share/fonts/truetype/freefont@${FONT_PATH}@g" \
239 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/config.yaml 222 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/config.yaml
240 223
241 if [ -r "$RIVERMAP_XML" ]; then
242 cp "$RIVERMAP_XML" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/rivermap.xml
243 fi
244
245 if [ -r "$FLOODMAP_XML" ]; then
246 cp "$FLOODMAP_XML" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/floodmap.xml
247 fi
248
249 if [ -r "$METADATA_XML" ]; then
250 cp "$METADATA_XML" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/meta-data.xml
251 fi
252
253 if [ -r "$MODULES_XML" ]; then
254 cp "$MODULES_XML" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/modules.xml
255 fi
256
257 if [ -r "$ZOOMSCALES_XML" ]; then
258 cp "$ZOOMSCALES_XML" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/zoom-scales.xml
259 fi
260
261 if [ -r "$SERVER_LOG4J" ]; then
262 cp "$SERVER_LOG4J" $FLYS_SOURCE_DIR/river/artifacts/doc/conf/log4j.properties
263 fi
264 224
265 if [ ! -f $FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz ]; then 225 if [ ! -f $FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz ]; then
266 echo "INFO: download OpenLayers-2.11 for client" 226 echo "INFO: download OpenLayers-2.11 for client"
267 cd $FLYS_SOURCE_DIR 227 cd $FLYS_SOURCE_DIR
268 curl -O http://openlayers.org/download/OpenLayers-2.11.tar.gz 228 curl -O http://openlayers.org/download/OpenLayers-2.11.tar.gz
330 echo "INFO: remove Oralce libraries" 290 echo "INFO: remove Oralce libraries"
331 rm -f $WORK_DIR/server/bin/lib/hibernate-spatial-oracle-1.1.jar 291 rm -f $WORK_DIR/server/bin/lib/hibernate-spatial-oracle-1.1.jar
332 rm -f $WORK_DIR/server/bin/lib/ojdbc* 292 rm -f $WORK_DIR/server/bin/lib/ojdbc*
333 fi 293 fi
334 294
335 # fetch the configuration stuff 295
336 echo "INFO: copy default configuration to target destination" 296 echo "INFO: copy default configuration to target destination"
337 cp -R $FLYS_SOURCE_DIR/river/artifacts/doc/conf $WORK_DIR/server/ 297 cp -R $FLYS_SOURCE_DIR/river/artifacts/doc/conf $WORK_DIR/server/
338 298
339 sed -i "s/8181/$ARTIFACT_PORT/g" \ 299 sed -i "s/8181/$ARTIFACT_PORT/g" \
340 $WORK_DIR/server/conf/rest-server.xml 300 $WORK_DIR/server/conf/rest-server.xml
341 301
342 sed -i -e "s@http://yourhost:8081/cgi-bin@${MAPSERVER_URL}-${VERSION}@g" \ 302 if [ -n $DGM_PATH ]; then
343 $WORK_DIR/server/conf/floodmap.xml 303 sed -i -e "s@<dgm-path>/path/to/rivers/</dgm-path>@<dgm-path>${DGM_PATH}</dgm-path>@g" \
344 304 $WORK_DIR/server/conf/conf.xml
345 sed -i -e "s@http://yourhost:8081/cgi-bin@${MAPSERVER_URL}-${VERSION}@g" \ 305 fi
346 $WORK_DIR/server/conf/rivermap.xml 306
347 307 if [ -n $WIKI_URL ]; then
348 sed -i -e "s@/usr/share/fonts/truetype/freefont@${FONT_PATH}@g" \ 308 sed -i -e "s@<help-url>http://example.com</help-url>@<help-url>${WIKI_URL}</help-url>@g" \
349 $WORK_DIR/server/conf/mapserver/fontset.txt 309 $WORK_DIR/server/conf/conf.xml
350 310 fi
351 sed -i -e "s@/tmp/flys-rivers-wms.log@${LOG_DIR}/rivers-wms-${VERSION}.log@g" \ 311
352 $WORK_DIR/server/conf/mapserver/river-mapfile.vm 312 if [ -d $SERVER_CONF ]; then
353 313 echo "INFO: copy custom configuration to target destination"
354 sed -i -e "s@/tmp/flys-user-wms.log@${LOG_DIR}/user-wms-${VERSION}.log@g" \ 314 cp -R $SERVER_CONF/* $WORK_DIR/server/conf/
355 $WORK_DIR/server/conf/mapserver/mapfile.vm 315 for file in `find $WORK_DIR/server/conf -type f`; do
356 316 sed -i -e "s@D4E_VERSION@${VERSION}@g" $file
357 sed -i -e "s@/var/log/d4e-river/d4e-server.log@${LOG_DIR}/server-${VERSION}.log@" \ 317 done
358 $WORK_DIR/server/conf/log4j.properties 318 fi
359 319
360 sed -i -e "s@<dgm-path>/path/to/rivers/</dgm-path>@<dgm-path>${DGM_PATH}</dgm-path>@g" \ 320
361 -e "s@<help-url>http://example.com</help-url>@<help-url>${WIKI_URL}</help-url>@g" \ 321 echo "INFO: create h2 database for artifacts and datacage"
362 $WORK_DIR/server/conf/conf.xml
363
364
365 if [ "$BUILD_ORACLE" = "TRUE" ]; then
366 # Oracle backend configuration
367 cat > $WORK_DIR/server/conf/backend-db.xml << EOF
368 <?xml version="1.0" encoding="UTF-8" ?>
369 <backend-database>
370 <user>$BACKENDUSER</user>
371 <password>$BACKENDPASS</password>
372 <dialect>org.hibernatespatial.oracle.OracleSpatial10gDialect</dialect>
373 <driver>oracle.jdbc.driver.OracleDriver</driver>
374 <url>jdbc:oracle:thin:@//$BACKENDURL:$BACKENDPORT/$BACKENDBACK</url>
375 <validation-query>select 1 from rivers</validation-query>
376 <max-wait>30000</max-wait>
377 <connection-init-sqls>$INITSQLS</connection-init-sqls>
378 </backend-database>
379 EOF
380
381 cat > $WORK_DIR/server/conf/seddb-db.xml << EOF
382 <?xml version="1.0" encoding="UTF-8" ?>
383 <seddb-database>
384 <user>$SEDDBUSER</user>
385 <password>$SEDDBPASS</password>
386 <dialect>org.hibernate.dialect.Oracle9iDialect</dialect>
387 <driver>oracle.jdbc.driver.OracleDriver</driver>
388 <url>jdbc:oracle:thin:@//$SEDDBURL:$SEDDBPORT/$SEDDBBACK</url>
389 <validation-query>select 1 from gewaesser</validation-query>
390 <max-wait>30000</max-wait>
391 <connection-init-sqls>$SEDINITSQLS</connection-init-sqls>
392 </seddb-database>
393 EOF
394
395 else
396 #Postgresql backend configuration
397 cat > $WORK_DIR/server/conf/backend-db.xml << EOF
398 <?xml version="1.0" encoding="UTF-8" ?>
399 <backend-database>
400 <user>$BACKENDUSER</user>
401 <password>$BACKENDPASS</password>
402 <dialect>org.hibernate.dialect.PostgreSQLDialect</dialect>
403 <driver>org.postgresql.Driver</driver>
404 <url>jdbc:postgresql://$BACKENDURL:$BACKENDPORT/$BACKENDBACK</url>
405 <validation-query>select 1 from rivers</validation-query>
406 <connection-init-sqls>$INITSQLS</connection-init-sqls>
407 </backend-database>
408 EOF
409
410 cat > $WORK_DIR/server/conf/seddb-db.xml << EOF
411 <?xml version="1.0" encoding="UTF-8" ?>
412 <seddb-database>
413 <user>$SEDDBUSER</user>
414 <password>$SEDDBPASS</password>
415 <dialect>org.hibernate.dialect.PostgreSQLDialect</dialect>
416 <driver>org.postgresql.Driver</driver>
417 <url>jdbc:postgresql://$SEDDBURL:$SEDDBPORT/$SEDDBBACK</url>
418 <validation-query>select 1 from gewaesser</validation-query>
419 </seddb-database>
420 EOF
421
422 fi
423
424 mkdir $WORK_DIR/artifactsdb 322 mkdir $WORK_DIR/artifactsdb
425 mkdir $WORK_DIR/datacagedb 323 mkdir $WORK_DIR/datacagedb
426 324
427 cp $FLYS_SOURCE_DIR/framework/artifact-database/doc/schema-h2.sql $WORK_DIR/artifactsdb/artifacts-h2.sql 325 cp $FLYS_SOURCE_DIR/framework/artifact-database/doc/schema-h2.sql $WORK_DIR/artifactsdb/artifacts-h2.sql
428 cp $FLYS_SOURCE_DIR/river/artifacts/doc/conf/datacage.sql $WORK_DIR/datacagedb/datacage.sql 326 cp $FLYS_SOURCE_DIR/river/artifacts/doc/conf/datacage.sql $WORK_DIR/datacagedb/datacage.sql
429 327
430 echo "INFO: create h2 database for artifacts and datacage"
431 cd $WORK_DIR 328 cd $WORK_DIR
432 $SCRIPT_DIR/h2/createArtifacts.sh $WORK_DIR/artifactsdb/artifacts-h2.sql 329 $SCRIPT_DIR/h2/createArtifacts.sh $WORK_DIR/artifactsdb/artifacts-h2.sql
433 $SCRIPT_DIR/h2/createDatacage.sh $WORK_DIR/datacagedb/datacage.sql 330 $SCRIPT_DIR/h2/createDatacage.sh $WORK_DIR/datacagedb/datacage.sql
434 cd - 331 cd -
435 332
436 mv $WORK_DIR/artifactsdb $WORK_DIR/server/ 333 mv $WORK_DIR/artifactsdb $WORK_DIR/server/
437 mv $WORK_DIR/datacagedb $WORK_DIR/server/ 334 mv $WORK_DIR/datacagedb $WORK_DIR/server/
438 335
439 if [ -n $INSTALL ]; then 336 if [ -f $INSTALL ]; then
440 echo "INFO: prepare custom installation script" 337 echo "INFO: prepare custom installation script"
441 cp $INSTALL $WORK_DIR 338 cp $INSTALL $WORK_DIR
442 sed -i "s/VERSION/$VERSION/g" $WORK_DIR/`basename $INSTALL` 339 sed -i "s/D4E_VERSION/$VERSION/g" $WORK_DIR/`basename $INSTALL`
443 fi 340 fi
444 341
445 echo "INFO: create tarball" 342 echo "INFO: create tarball"
446 if [ -d "$WORK_DIR/flys-$VERSION" ]; then 343 if [ -d "$WORK_DIR/flys-$VERSION" ]; then
447 echo "INFO: removing old directory" 344 echo "INFO: removing old directory"

http://dive4elements.wald.intevation.org