In this example we are making use of the EAP 8 runtime image to build an EAP 8 server + JAX-RS application docker image. In order to create an EAP 8 server containing our application, we are using the EAP Maven Plugin.
The docker image is built then deployed on an Openshift cluster using Helm charts for EAP 8.
- Test EAP 8 new features and/or bug fixes on Openshift.
High level view of the EAP Maven plugin configuration.
org.jboss.eap:wildfly-ee-galleon-pack
org.jboss.eap.cloud:eap-cloud-galleon-pack
jaxrs-server
JBoss EAP CLI scripts executed at packaging time
- None
Extra content packaged inside the provisioned server
- None
Technologies required to build and deploy this example
-
docker
-
Helm chart for EAP8
jboss-eap/eap8
.
-
You have docker setup.
-
You have a
Registry Service Account
. You can create one if not. -
You have configured docker to access the EAP 8 images. For detailed instructions check the URL:
https://access.redhat.com/terms-based-registry/#/token/<your user id>/docker-login
. -
You are logged into an OpenShift cluster and have
oc
command in your path -
You have installed Helm. Please refer to Installing Helm page to install Helm in your environment
-
You have installed the repository for the Helm charts for EAP 8
helm repo add jboss-eap https://jbossas.github.io/eap-charts/
- You have built EAP 8 and artifacts are present in your local maven cache
- Build the application and server
mvn clean package [-Dversion.eap=<your SNAPSHOT version>]
- Build the docker image
docker build --squash -t eap8-myapp:latest .
- Push the image to the Openshift Sandbox
Make sure to set the OPENSHIFT_IMAGE_REGISTRY
env variable with the actual route to the registry.
When logging to the registry, the route to the registry will be printed on the console.
export IMAGE=eap8-myapp:latest
export OPENSHIFT_NS=$(oc project -q)
oc registry login
# Copy the route in the env variable OPENSHIFT_IMAGE_REGISTRY
OPENSHIFT_IMAGE_REGISTRY=$(oc registry info)
docker login -u openshift -p $(oc whoami -t) $OPENSHIFT_IMAGE_REGISTRY
docker tag $IMAGE $OPENSHIFT_IMAGE_REGISTRY/$OPENSHIFT_NS/$IMAGE
docker push $OPENSHIFT_IMAGE_REGISTRY/$OPENSHIFT_NS/$IMAGE
- Enable the pushed image stream resolution
oc set image-lookup eap8-myapp
- Deploy the example application using EAP 8 Helm charts
helm install eap8-myapp -f helm.yaml jboss-eap/eap8
- Access the endpoint
curl https://$(oc get route eap8-myapp --template='{{ .spec.host }}')/