Public Repository

Last pushed: 2 months ago
Short Description
Opensource Appliacion Server Wildfly based on Java 1.8.0_161
Full Description

Wildfly Docker container

This container contents the Wildfly community version of Wildfly. The Structure of the Wildfly installation is

Wildfly_HOME=/opt/Wildfly
Wildfly_BASE_DIR=${Wildfly_HOME}/standalone
Wildfly_CONFIG_DIR=${Wildfly_BASE_DIR}/configuration

WORKING_DIR=${Wildfly_BASE_DIR}

The Wildfly Docker image runs on base on Docker image docker-registry.paas.metro.cloud/asm/ubuntu_java8:16.04 - means, that the Wildfly is running on top of Java 8_161.

In this Wildfly instances, the following Database drivers are already installed:

  • Oracle RDBMS
  • Postgres
  • MS SQL Server
  • MySQL

To start the Wildfly container you have two different choices.

After the wildfly instance is up and running, you can access the admin URL it using

Username: admin
Password: default is "change_me1", but you can use your own by changing the ENV Parameter "JBOSS_PWD"

To store static files use the directory

/opt/data

Standard start

This way starts the container in a method, that all JVM parameters can be passed on command line call for the docker run.

docker run -d \
       --env JVM_PARAM=" -Xms2048m -Xmx2048m" \
       --env CONFIG_TYPE="standalone" \
       --env JBOSS_PWD="change_me1" \
       --name test-mk-1 \
       -p 9990:9990 \
       -p 8080:8080 \
       docker-registry.paas.metro.cloud/asm/wildfly:10.1

The environment parameter can include all JVM parameters and options needed.

The CONFIG_TYPE can be all possible standalone profiles like standalone, standalone-ha, standalone-full and standalone-full-ha.

Centralized configuration and classified start

To simplify the configuration of Wildfly instances, you can use the etcd container to store the Wildfly configuration and classification.
Here you can use the Docker container for etcd (stored here in our git repository too).

The values needed to configure your JVMs can be stored in the file jboss-config.yml. Read the description of the docker-registry.paas.metro.cloud/asm/etcd:2.3.1 docker container how to load these data.

After the data is loaded and the etcd is running in background, you can simply start your Wildfly containers by using a classification.
This is much more simplyfied and more comprehensive rather to configure the JVM Parameters in JVM_PARAM as mentioned above.

Simply start the the ectd docker container (named here etcd-1). Then start the Wildfly container and loading the config data from there by

docker run -d \
       --link etcd-1 \
       --env ETCD_NODES=etcd-1:4001  \
       -p 9990:9990 \
       -p 8080:8080 \
       --env CONFIG_TYPE="standalone-ha" \
       --env JBOSS_PWD="change_me_1" \
       --name test-mk-1 \
       docker-registry.paas.metro.cloud/asm/wildfly:10.1 \
       medium

You can store different values for each JVM Parameter for the classes small, medium and large to decide at containerstart, what kind of stored config yoiu want to use.

Example for a Wildfly-config.yml config file:

default:
  java_start_parameter:
    JAVA_ARG001: -Djava.net.preferIPv4Stack=true
    JAVA_ARG002: -Djava.awt.headless=true
    JAVA_ARG003: -Xmx512M
    JAVA_ARG004: -Xmx512M
    JAVA_ARG005: -XX:MaxMetaspaceSize=256m
    JAVA_ARG006: -Xss256k
    JAVA_ARG007: -XX:NewSize=330M
    JAVA_ARG010: -XX:+UseParNewGC
    JAVA_ARG011: -XX:+UseConcMarkSweepGC
    JAVA_ARG012: -XX:+CMSClassUnloadingEnabled
    JAVA_ARG013: -XX:+DisableExplicitGC
    JAVA_ARG014: -XX:+PrintGCDetails
    JAVA_ARG015: -XX:+PrintGCDateStamps
    JAVA_ARG016: -Xloggc:/opt/Wildfly/standalone/log/gc.log
    JAVA_ARG017: -XX:+UseGCLogFileRotation
    JAVA_ARG018: -XX:NumberOfGCLogFiles=10
    JAVA_ARG019: -XX:GCLogFileSize=10M
    JAVA_ARG020: -Duser.timezone=Europe/Berlin
    JAVA_ARG026: -Djava.io.tmpdir=/was/tmp

small:
  java_start_parameter:
    JAVA_ARG003: -Xmx1024m
    JAVA_ARG004: -Xms1024m
    JAVA_ARG005: -XX:MaxMetaspaceSize=256m

medium:
  java_start_parameter:
    JAVA_ARG003: -Xmx2048m
    JAVA_ARG004: -Xms2048m
    JAVA_ARG005: -XX:MaxMetaspaceSize=512m

large:
  java_start_parameter:
    JAVA_ARG003: -Xmx4096m
    JAVA_ARG004: -Xms4096m
    JAVA_ARG005: -XX:MaxMetaspaceSize=1024m

Deployment of an application in a Wildfly container

use the sample Dockerfile and create a new application container, where the application and it's used resources will be deployed. For this, the warfile/earfile must be named and needed datasources must be defined in a file called data-source.yml. If you do not need datasources, create an empty file with this name in your working directory or delete the ARG and COPY line for the datasource of the sample Dockerfile.

Example of a data-source.yml file:

DSName:
  dbtype: "[DBType]"      # required
  minConnections: "20"
  maxConnections: "50" 
  username: "USERNAME"   # required
  password: "PASSWORD"   # required
  url: "URL depending on DBType"

It is possible to define more than one database using aditionally yml sections.

The Following DBTypes are supported and have the following urls:

MySql    :  jdbc:mysql://[IP Address or Nodename]:[Port]/[DBName]
Postgres :  jdbc:postgresql://[IP Address or Nodename]:[Port]/[DBName]
Oracle   :  jdbc:oracle:thin:@[IP Address or Nodename]:[Port]:[SID or ServiceName]

The connection configuration parameters are not required. If none of the following parametes is set in the yml file, the default values below are used:

minConnections="10"
maxConnections="30"

The application archive file (war-file or ear-file) will be deployed after the datasources are created in the JEE application server.

Example Dockerfile:

FROM docker-registry.paas.metro.cloud/asm/wildfly:11.0

MAINTAINER manfred.koellges@metrosystems.net

ARG earfile=sample.war
ARG datasource=data-source.yml

COPY $earfile /tmp
COPY $datasource /tmp/data-source.yml

EXPOSE 8080 9990

RUN standalone.sh -c standalone-ha.xml -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0 & \
    sleep 5 && \
    sed -i s/___HOSTNAME___/$HOSTNAME/ /tmp/base.cli && \
    sed -i s/___EARFILE___/$earfile/ /tmp/deploy.cli && \
    echo "" && \
    /opt/jboss/bin/insert-datasource.sh && \
    echo "set base settings ......." && \
    /opt/jboss/bin/jboss-cli.sh --connect --file=/tmp/base.cli && \
    echo "Deploy datasources ......." && \
    /opt/jboss/bin/jboss-cli.sh --connect --file=/tmp/datasource.cli && \
    echo "Deploy application ......." && \
    /opt/jboss/bin/jboss-cli.sh --connect --file=/tmp/deploy.cli && \
    echo "Shutting down JBoss Instance........." && \
    /opt/jboss/bin/jboss-cli.sh --connect ":shutdown" && \
    echo "Deleting current subdirectory ..... " && \
    rm -rf /opt/jboss/standalone/configuration/standalone_xml_history/current

Now build the application docker image like

docker build -t sampleapp --build-arg earfile=APPLICATION_ARCHIVE.ear --build-arg datasource=data-source.yml .
Docker Pull Command
Owner
mkoellges