Skip to content

Configurable Wildfly base Docker image and setup scripts

License

Notifications You must be signed in to change notification settings

JeffersonLab/wildfly

Repository files navigation

wildfly CI Docker (demo)

Configurable Wildfly base Docker image and bash setup scripts.



Overview

This Jefferson Lab Wildfly template assumes apps are authenticated with Keycloak and use an Oracle or MariaDB database. It is generally expected that only one database will be configured at a time. Optionally an SMTP mail server can be configured. The full EE Wildfly distribution is used as a starting point and a few libraries are added including:

  • JLog: JLab logbook client
  • Keycloak admin client
  • Apache POI (Excel doc API)
  • Tuckey URL rewrite

Configure

Wildfly must be pre-configured before the first deployment of an app. The bash scripts located in the scripts directory are used with the following environment variables:

Create a .env file for your environment and call the bash scripts server-setup.sh (example: docker config) and app-setup.sh (example: demo docker config) to do the initial Wildfly configuration. Bash can be executed on Linux, Windows (WSL2), and Mac with some perseverance. See bash setup scripts.

Note: If you are using Windows and WSL2 you may need to run dos2unix on .env and .sh files

Server Setup

Only needs to be executed once per permanent installation of Wildfly.

Name Description
ACCESS_LOG If defined, enable access logging
ADD_JBOSS_MODULES JBoss Modules to install, if any
APPLY_ELYTRON_PATCH If defined, apply patch
EMAIL_FROM Default from address for the mail/jlab resource
EMAIL_HOST Host for the mail/jlab resource
EMAIL_PORT Port for the mail/jlab resource
GZIP If defined, enable gzip
KEYSTORE_NAME If defined, set TLS keystore name (file must be inside configuration dir and of type PKS12)
KEYSTORE_PASS Keystore password
ORACLE_DRIVER_URL Path to ORACLE Driver for Wildfly to use
MARIADB_DRIVER_URL Path to MariaDB Driver for Wildfly to use
WILDFLY_HOME Path to Wildfly home dir
WILDFLY_PASS Admin password (if empty no admin user is created)
WILDFLY_RUN_USER User for running Wildfly
WILDFLY_USER Admin username (if empty no admin user is created)

Note: There is a self-signed test certificate installed, but you can override with your own cert by mounting a custom PKS12 keystore file to /opt/jboss/wildfly/standalone/configuration/server.p12

App Setup

Must be executed once per app installed in Wildfly.

Name Description Runtime Overridable
KEYCLOAK_REALM Keycloak realm to configure YES
KEYCLOAK_RESOURCE Keycloak resource to configure YES
KEYCLOAK_SECRET Keycloak Secret YES
KEYCLOAK_SERVER_URL Scheme, host name, and port of Keycloak authentication server YES
KEYCLOAK_WAR Name of war file to secure with Keycloak (app key) NO
ORACLE_DATASOURCE Name of Oracle datasource (app key) NO
ORACLE_SERVER Host name and port of Oracle server to use to connect to DB from Wildfly YES
ORACLE_SERVICE Oracle Service name to use to connect to DB from Wildfly YES
ORACLE_USER Username to use to connect to DB from Wildfly YES
ORACLE_PASS Password to use to connect to DB from Wildfly YES
MARIADB_DATASOURCE Name of MariaDB datasource (app key) NO
MARIADB_SERVER Host name and port of MariaDB server used to connect to DB from Wildfly NO
MARIADB_DB_NAME Name of MariaDB database name to use to connect from Wildfly NO
MARIADB_USER Username to use to connect to DB from Wildfly NO
MARIADB_PASS Password to use to connect to DB from Wildfly NO
WILDFLY_HOME Path to Wildfly home dir NO
WILDFLY_RUN_USER User for running Wildfly NO

Note: Runtime Overridable parameters only make sense for Wildfly instances used for a single app (such as in a Container). Providing runtime overrides to a multi-app configuration would overwrite all app configs of the same name. See

config_keycloak_client_dynamic() {

Note: As an alternative to the bash scripts The docker image configures Wildfly for use in the compose environment and that's a good starting point to copy from. Outside a compose environment you may need to tweak the standalone.xml configuration to use different host names and ports (For example Oracle and Keycloak host names would need to be updated to localhost:1521 and localhost:8081 respectively when using the deps.yaml and running Wildfly outside the compose network):

docker compose up
docker exec -it demo /opt/jboss/wildfly/bin/jboss-cli.sh --connect -c "undeploy smoothness-demo.war"
docker exec -it demo /opt/jboss/wildfly/bin/jboss-cli.sh --connect -c shutdown
docker cp demo:/opt/jboss/wildfly .

Docker Runtime

These environment variables are Docker specific and are used by the docker-entrypoint.sh script to wait on the Oracle database to start.

Name Description
ORACLE_DATASOURCE Oracle Datasource name to use to connect to DB from TestOracleConnection utility
ORACLE_SERVER Host name and port of Oracle server to use to connect to DB from TestOracleConnection utility
ORACLE_USER Username to use to connect to DB from TestOracleConnection utility
ORACLE_PASS Password to use to connect to DB from TestOracleConnection utility
ORACLE_SERVICE Oracle Service name to use to connect to DB from TestOracleConnection utility
MARIADB_DATASOURCE MariaDB datasource name to use to connect to DB from TestMariaDBConnection utility
MARIADB_SERVER Host name and port of MariaDB server used to connect to DB from TestMariaDBConnection utility
MARIADB_USER Username to use to connect to DB from TestMariaDBConnection utility
MARIADB_PASS Password to use to connect to DB from TestMariaDBConnection utility
MARIADB_DB_NANE MariaDB Service name to use to connect to DB from TestMariaDBConnection utility

Note: The entrypoint script waits for either an Oracle or a MariaDB database to start but not both. Oracle takes precedence.

Release

  1. Bump the version number in the VERSION file and commit and push to GitHub (using Semantic Versioning).
  2. The CD GitHub Action should run automatically invoking:
    • The Create release GitHub Action to tag the source and create release notes summarizing any pull requests. Edit the release notes to add any missing details.
    • The Publish docker image GitHub Action to create a new demo Docker image.