Skip to content

Repository files navigation

wildfly CIDocker (demo)

Configurable Wildfly base Docker image and bash setup scripts.



Overview

This Jefferson Lab Wildfly template for Wildfly 37.0.1 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.

NameDescription
ACCESS_LOGIf defined, enable access logging
ADD_JBOSS_MODULESJBoss Modules to install, if any
APPLY_ELYTRON_PATCHIf defined, apply patch
EMAIL_FROMDefault from address for the mail/jlab resource
EMAIL_HOSTHost for the mail/jlab resource
EMAIL_PORTPort for the mail/jlab resource
GZIPIf defined, enable gzip
KEYSTORE_NAMEIf defined, set TLS keystore name (file must be inside configuration dir and of type PKS12)
KEYSTORE_PASSKeystore password
ORACLE_DRIVER_URLPath to ORACLE Driver for Wildfly to use
MARIADB_DRIVER_URLPath to MariaDB Driver for Wildfly to use
WILDFLY_HOMEPath to Wildfly home dir
WILDFLY_PASSAdmin password (if empty no admin user is created)
WILDFLY_RUN_USERUser for running Wildfly
WILDFLY_USERAdmin 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.

NameDescriptionRuntime Overridable
KEYCLOAK_REALMKeycloak realm to configureYES
KEYCLOAK_RESOURCEKeycloak resource to configureYES
KEYCLOAK_SECRETKeycloak SecretYES
KEYCLOAK_SERVER_URLScheme, host name, and port of Keycloak authentication serverYES
KEYCLOAK_WARName of war file to secure with Keycloak (app key)NO
ORACLE_DATASOURCEName of Oracle datasource (app key)NO
ORACLE_SERVERHost name and port of Oracle server to use to connect to DB from WildflyYES
ORACLE_SERVICEOracle Service name to use to connect to DB from WildflyYES
ORACLE_USERUsername to use to connect to DB from WildflyYES
ORACLE_PASSPassword to use to connect to DB from WildflyYES
MARIADB_DATASOURCEName of MariaDB datasource (app key)NO
MARIADB_SERVERHost name and port of MariaDB server used to connect to DB from WildflyNO
MARIADB_DB_NAMEName of MariaDB database name to use to connect from WildflyNO
MARIADB_USERUsername to use to connect to DB from WildflyNO
MARIADB_PASSPassword to use to connect to DB from WildflyNO
WILDFLY_HOMEPath to Wildfly home dirNO
WILDFLY_RUN_USERUser for running WildflyNO

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.

NameDescription
ORACLE_DATASOURCEOracle Datasource name to use to connect to DB from TestOracleConnection utility
ORACLE_SERVERHost name and port of Oracle server to use to connect to DB from TestOracleConnection utility
ORACLE_USERUsername to use to connect to DB from TestOracleConnection utility
ORACLE_PASSPassword to use to connect to DB from TestOracleConnection utility
ORACLE_SERVICEOracle Service name to use to connect to DB from TestOracleConnection utility
MARIADB_DATASOURCEMariaDB datasource name to use to connect to DB from TestMariaDBConnection utility
MARIADB_SERVERHost name and port of MariaDB server used to connect to DB from TestMariaDBConnection utility
MARIADB_USERUsername to use to connect to DB from TestMariaDBConnection utility
MARIADB_PASSPassword to use to connect to DB from TestMariaDBConnection utility
MARIADB_DB_NANEMariaDB 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.

About

Configurable Wildfly base Docker image and setup scripts

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

6 watching

Forks

Releases

Used by

Contributors

Languages