Helm Chart for WildFly in OpenShift Developer Console
We have recently released a Helm Chart for WildFly and wrote an article about it. Since that article, we have submitted this Helm Chart to the OpenShift Developer Console.
It is now possible to build and deploy a WildFly application in OpenShift directly from its Developer Console. In this article, we will show the steps to do so.
We will use Red Hat Developer Sandbox for Red Hat OpenShift as our OpenShift cluster.
For this article, we will use the same
microprofile-config quickstart for WildFly that we used in our initial article about the Helm Chart.
Install a Helm Release
Once you have logged in your OpenShift Developer Sandbox, the steps to install a WildFly application are:
Go to the OpenShift Developer Console (in the
</> Developerperspective in the left hand menu)
Helm Chart, then
WildFly(at the time of this writing, the exact version is
Click on the
Install Helm Chartbutton
At this point, we need to configure the chart to be able to build and deploy the
First, we will change the name of the release to
Release Nametext field instead of the default
We can configure the Helm Chart either using a
Form Viewor a
YAML View. We will use the
YAML Viewby checking the button in the
Then, we will change the YAML content to configure the Helm Chart by copying the following content in the
YAML viewinstead of the existing content:
build: uri: https://github.com/wildfly/quickstart.git ref: 24.0.0.SP1 mode: bootable-jar env: - name: ARTIFACT_DIR value: microprofile-config/target - name: MAVEN_ARGS_APPEND # Use the bootable-jar-openshift profile to ensure that the application # can be deployed on OpenShift but disable JKube as the image will be # built and deployed by this chart. value: -am -pl microprofile-config -Pbootable-jar-openshift -Djkube.skip=true - name: MAVEN_OPTS value: '-XX:MetaspaceSize=251m -XX:MaxMetaspaceSize=256m' deploy: replicas: 1 env: - name: CONFIG_PROP value: Hello from OpenShift
This is the same YAML content that we used in the inital article when we install the Helm Chart from the command line.
Finally, we click on the
Installbutton to finish the installation. This will open the
Topologyview with a graphical represenation of the Helm realease (named
my-widlfly-app) and its associated resources:
The Helm Release (abbreviated
HR) is named
my-wildlfy-app and uses the WildFly icon to shows that this release is managed by the Helm Chart for WildFly. It includes a
Deployment resource (abbreviated
D) also named
When build is finished (the bottom-left icon will display a green check) and the application is deployed (the circle outline is in dark blue), you can go the the URL (using the top-right icon) from the route associated to the deployment, append
/config/value and you will see the message:
Hello from OpenShift
This message corresponds to the
CONFIG_PROP environment variable defined in the Helm Chart YAML file.
Congratulations, you have built and deployed your first Java application with WildFly on OpenShift!
Upgrade the Helm Release
It is possible to upgrade the Helm Release to change its configuration from the OpenShift Developer Console.
Click on the
Helmin the left hand menu
Click on the
my-wildfly-applink to open the page specific to our Helm release.
Click on the
Actionsmenu in the right of the page and select
Upgrade. This will show the
Upgrade Helm Releasepage.
The YAML View in that page contains some additional content compared to what was initially pasted. The OpenShift developer console aggregates some of the chart’s default values with the YAML content we provided.
Let’s say we want to modify the message returned by our application. We will change the value of the
CONFIG_PROP environement variable to
Bonjour depuis OpenShift (instead of
Hello from Openshift)
deploy: ... env: - name: CONFIG_PROP value: Bonjour depuis OpenShift
At this point, we click on
Upgrade to upgrade the Helm release.
As we have only modified the
deploy section of the Helm release, we will reuse the existing application image and redeploy it with the new environment variable.
Once the application is redeployed, if we click on the Route button and append
/config/value, we see that the application has correctly been upgraded:
Bonjour depuis OpenShift
Prior to OpenShift 4.8, there was a bug preventing to directly upgrade the Helm Release.
To workaround that error, we had to reload the initial Chart version and apply our changes.
We can now click on the
Now that the Helm Chart for WildFly is included by default in OpenShift Developer console, it is straightforward to build and deploy WildFly application in an OpenShift cluster.
It is also possible to upgrade the Helm release so that it remains the source of any configuration from the application, although we need to reset the Chart version every time we want to apply such an upgrade.