Mercurial > lada > lada-server
changeset 753:5f6037a281fe
merged.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 30 Oct 2015 15:08:08 +0100 |
parents | 0cf9387c8da2 (current diff) 6a24f01bdaac (diff) |
children | 9d34aca4fb07 |
files | |
diffstat | 6 files changed, 211 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Dockerfile Fri Oct 30 15:08:08 2015 +0100 @@ -0,0 +1,80 @@ +# +# Dockerfile for jboss wildfly application server cutomized for usage in the +# BfS-Lada project +# +# Build with e.g. `docker build --force-rm=true -t koala/lada_wildfly .' +# Run with e.g. +# `docker run --name lada_wildfly --link lada_db:lada_db +# -dp 8181:8080 -p 1818:9990 koala/lada_wildfly' +# The linked container may be created from db_schema/Dockerfile. +# +# The LADA-server will be available under +# http://yourdockerhost:8181/lada-server-2.2.0 +# + +FROM java:7-jdk +MAINTAINER raimund.renkert@intevation.de + +# +# install packages +# +RUN apt-get update -y && \ + apt-get install -y libpostgresql-jdbc-java libpostgis-java libjts-java \ + maven + +# +# Set up Wildfly +# +RUN mkdir /opt/jboss + +RUN curl \ + https://download.jboss.org/wildfly/8.2.1.Final/wildfly-8.2.1.Final.tar.gz \ + | tar zx && mv wildfly-8.2.1.Final /opt/jboss/wildfly + +ENV JBOSS_HOME /opt/jboss/wildfly + +RUN $JBOSS_HOME/bin/add-user.sh admin secret --silent + +EXPOSE 8080 9990 + +# +# Add LADA-server repo +# +ADD . /usr/src/lada-server +WORKDIR /usr/src/lada-server + +# +# Wildfly setup specific for LADA +# +RUN mkdir -p $JBOSS_HOME/modules/org/postgres/main +RUN ln -s /usr/share/java/postgresql-jdbc4-9.2.jar \ + $JBOSS_HOME/modules/org/postgres/main/ +RUN ln -s /usr/share/java/postgis-jdbc-2.1.4.jar \ + $JBOSS_HOME/modules/org/postgres/main/ +RUN ln -s /usr/share/java/jts-1.11.jar \ + $JBOSS_HOME/modules/system/layers/base/org/hibernate/main/ +RUN curl \ + http://www.hibernatespatial.org/repository/org/hibernate/hibernate-spatial/4.3/hibernate-spatial-4.3.jar > \ + $JBOSS_HOME/modules/system/layers/base/org/hibernate/main/hibernate-spatial-4.3.jar + +RUN cp wildfly/postgres-module.xml \ + $JBOSS_HOME/modules/org/postgres/main/module.xml +RUN cp wildfly/hibernate-module.xml \ + $JBOSS_HOME/modules/system/layers/base/org/hibernate/main/module.xml + +RUN wildfly/execute.sh + +RUN rm $JBOSS_HOME/standalone/configuration/standalone_xml_history/current/* + +# +# Build and deploy LADA-server +# +RUN mvn clean compile package +RUN mv target/lada-server-2.2.0.war $JBOSS_HOME/standalone/deployments +RUN touch $JBOSS_HOME/standalone/deployments/lada-server-2.2.0.war.dodeploy + +# +# This will boot WildFly in the standalone mode and bind to all interface +# +CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", \ + "-bmanagement=0.0.0.0"]
--- a/README.markdown Fri Oct 30 15:07:22 2015 +0100 +++ b/README.markdown Fri Oct 30 15:08:08 2015 +0100 @@ -37,18 +37,20 @@ Installation ------------ -Zur Installation der Lada-Anwendung müssen folgende Schritte unternommen werden: +Die Installation des Lada-Servers erfolgt in einem Wildfly-Application-Server +(http://wildfly.org). Dazu müssen folgende Schritte unternommen werden: $ mvn clean compile package - $ cd /opt/wildfly8.2.Final/standalone/deployments - $ cp /path/where/the/war/file/is/lada-server.war . - $ touch lada-server.war.dodeploy + $ mv target/lada-server-$VERSION.war $JBOSS_HOME/standalone/deployments + $ touch $JBOSS_HOME/standalone/deployments/lada-server-$VERSION.war.dodeploy -Zum Aktualisieren der Anwendung genügt es, wenn die lada-server.war Datei aktualisiert -wird. +$JBOSS_HOME ist hierbei durch den Pfad zur Wildfly-Installation zu ersetzen, +$VERSION durch die aktuelle Versionsbezeichnung (entsprechend der Angabe in +pom.xml). -Die Anwendung ist dann unter dem Pfad "/lada-server" (abhängig vom Archivnamen) -erreichbar. +Zum Aktualisieren der Anwendung genügt es, das WAR-Archiv zu aktualisieren. + +Die Anwendung ist dann unter dem Pfad "/lada-server-$VERSION" erreichbar. Tests -----
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wildfly/commands.cli Fri Oct 30 15:08:08 2015 +0100 @@ -0,0 +1,6 @@ +batch +/subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgis.DriverWrapper) +data-source add --jndi-name=java:/jboss/lada-bund --name=lada-bund --connection-url=jdbc:postgresql_postGIS://lada_db:5432/lada?currentSchema=bund --driver-name=postgres --user-name=lada --password=lada +data-source add --jndi-name=java:/jboss/lada-land --name=lada-land --connection-url=jdbc:postgresql_postGIS://lada_db:5432/lada?currentSchema=land --driver-name=postgres --user-name=lada --password=lada +data-source add --jndi-name=java:/jboss/lada-stamm --name=lada-stamm --connection-url=jdbc:postgresql_postGIS://lada_db:5432/lada?currentSchema=stammdaten --driver-name=postgres --user-name=lada --password=lada +run-batch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wildfly/execute.sh Fri Oct 30 15:08:08 2015 +0100 @@ -0,0 +1,39 @@ +#!/bin/bash + +if [ -z $JBOSS_HOME ] +then + JBOSS_HOME=/opt/jboss/wildfly +fi +JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh +JBOSS_MODE=${1:-"standalone"} +JBOSS_CONFIG=${2:-"$JBOSS_MODE.xml"} + +function wait_for_server() { + until `$JBOSS_CLI -c "ls /deployment" &> /dev/stdout`; do + sleep 1 + done +} + +function wait_for_shutdown() { + until `$JBOSS_CLI -c "ls /deployment" &> /dev/stdout`; do + sleep 1 + done +} + +echo "=> Starting WildFly server" +$JBOSS_HOME/bin/$JBOSS_MODE.sh -c $JBOSS_CONFIG & + +echo "=> Waiting for the server to boot" +wait_for_server + +echo "=> Executing the commands" +$JBOSS_CLI -c --user=admin --password=secret --file=`dirname "$0"`/commands.cli + +echo "=> Shutting down WildFly" +if [ "$JBOSS_MODE" = "standalone" ]; then + $JBOSS_CLI -c ":shutdown" + sleep 10 + echo "=> done." +else + $JBOSS_CLI -c "/host=*:shutdown" +fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wildfly/hibernate-module.xml Fri Oct 30 15:08:08 2015 +0100 @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + ~ JBoss, Home of Professional Open Source. + ~ Copyright 2011, Red Hat, Inc., and individual contributors + ~ as indicated by the @author tags. See the copyright.txt file in the + ~ distribution for a full listing of individual contributors. + ~ + ~ This is free software; you can redistribute it and/or modify it + ~ under the terms of the GNU Lesser General Public License as + ~ published by the Free Software Foundation; either version 2.1 of + ~ the License, or (at your option) any later version. + ~ + ~ This software is distributed in the hope that it will be useful, + ~ but WITHOUT ANY WARRANTY; without even the implied warranty of + ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + ~ Lesser General Public License for more details. + ~ + ~ You should have received a copy of the GNU Lesser General Public + ~ License along with this software; if not, write to the Free + ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. + --> + +<!-- Represents the Hibernate 4.3.x module--> +<module xmlns="urn:jboss:module:1.3" name="org.hibernate"> + <resources> + <resource-root path="hibernate-core-4.3.7.Final.jar"/> + <resource-root path="hibernate-envers-4.3.7.Final.jar"/> + <resource-root path="hibernate-entitymanager-4.3.7.Final.jar"/> + <resource-root path="hibernate-infinispan-4.3.7.Final.jar"/> + <resource-root path="jipijapa-hibernate4-3-1.0.1.Final.jar"/> + <resource-root path="hibernate-spatial-4.3.jar"/> + <resource-root path="jts-1.11.jar"/> + </resources> + + <dependencies> + <module name="asm.asm"/> + <module name="com.fasterxml.classmate"/> + <module name="javax.api"/> + <module name="javax.annotation.api"/> + <module name="javax.enterprise.api"/> + <module name="javax.persistence.api"/> + <module name="javax.transaction.api"/> + <module name="javax.validation.api"/> + <module name="javax.xml.bind.api"/> + <module name="org.antlr"/> + <module name="org.apache.commons.collections"/> + <module name="org.dom4j"/> + <module name="org.infinispan" services="import"/> + <module name="org.javassist"/> + <module name="org.jboss.as.clustering.common"/> + <module name="org.jboss.as.clustering.jgroups"/> + <module name="org.jboss.as.clustering.infinispan"/> + <module name="org.jboss.as.jpa.spi"/> + <module name="org.jboss.jandex"/> + <module name="org.jboss.logging"/> + <module name="org.jboss.vfs"/> + <module name="org.hibernate.commons-annotations"/> + <module name="org.postgres"/> + </dependencies> +</module>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wildfly/postgres-module.xml Fri Oct 30 15:08:08 2015 +0100 @@ -0,0 +1,14 @@ +<?xml version="1.0" ?> + +<module xmlns="urn:jboss:module:1.1" name="org.postgres"> + + <resources> + <resource-root path="postgis-jdbc-2.1.4.jar"/> + <resource-root path="postgresql-jdbc4-9.2.jar"/> + </resources> + + <dependencies> + <module name="javax.api"/> + <module name="javax.transaction.api"/> + </dependencies> +</module>