Monday, August 30, 2021 - 16:00
  • Share this article:

Recently, Jelastic was asked to sponsor cloud hosting of a Jakarta EE blueprint application called Cargo Tracker. As a member of the Jakarta EE Working Group, we wanted to support the community, so we’re now running the application at Scaleforce, one of our platform as a service (PaaS) providers. To help other developers learn how to deploy Jakarta EE applications to a Kubernetes cluster in Jelastic PaaS, we’re using this article to share the steps we followed.

First, a bit of background.

Cargo Tracker Uses Domain-Driven Design to Power Jakarta EE

Cargo Tracker is a public tracking interface that allows you to track the status and handling history of cargo for which you have a registered tracking ID. The application was developed to demonstrate how developers can use well-established architectural patterns and blueprints to develop real-world applications with Jakarta EE.

Cargo Tracker is created using Domain-Driven Design (DDD), an approach that focuses on the study of a subject area — a domain — and its business processes. Standard programming pays more attention to technologies and infrastructure, and while these aspects are important, they are secondary to business itself. The DDD approach helps developers speak the language of business, the so-called Ubiquitous Language.

The Jelastic team deployed the Cargo Tracker application to the Kubernetes environment using GitHub Actions workflows. The deployment and all data are automatically refreshed nightly. The application is running on a PostgreSQL database in the cloud, and the GitHub Container Registry is used to publish Docker images.

Using Cargo Tracker as an example, here are the steps required to deploy a Jakarta EE application to a Kubernetes cluster in Jelastic PaaS.

Install Kubernetes

The first step is to create a Kubernetes cluster from the Jelastic marketplace. This is a fully automated process, so just follow our tutorial.

CargoTrackerFigure1

The topology of a simple development cluster can look like the example below.

CargoTrackerFigure2

Deploy the Jakarta EE Application

1. Get three config files from the repository:

  • The postgres-secret.yaml file provides a database username and password encoded with Base64. This project uses the value “postgres” for both.
  • The postgres.yaml file creates a PostgreSQL database.
  • The cargo-tracker.yaml file deploys a highly available topology of the Jakarta EE application which consists of two replicas.

CargoTrackerFigure3

2. Use a configuration file manager to create these files on the Control plane node (formerly known as the Master) of the Kubernetes cluster.

CargoTrackerFigure4

Use these files to create the six required Kubernetes resources:

  • postgres-secret
  • postgres deployment
  • postgres service
  • cargo-tracker deployment
  • cargo-tracker service
  • cargo-tracker ingress

3. Use WebSSH to log in to the Control plane node and apply the files.
But first, check whether the ROOT context path “/” is already used by an ingress resource by typing:

$ kubectl get ing

In the example below, the helloworld application’s ingress is using the “/” context path.

CargoTrackerFigure5

To delete the existing ingress resource shown in the example and release the path for your application, type:

$ kubectl delete ing helloworld

4. Apply the configuration files by typing:

$ kubectl apply -f postgres-secret.yaml
$ kubectl apply -f postgres.yaml
$ kubectl apply -f cargo-tracker.yaml

CargoTrackerFigure6

Test the Jakarta EE Application

Wait for a minute, then check whether the resources have been created and are running by typing:

$ kubectl get secrets

CargoTrackerFigure7

$ kubectl get deploy

CargoTrackerFigure8

2. Click Open in Browser to see the application and verify it works.

CargoTrackerFigure10

CargoTrackerFigure11

3. To confirm the system works, enter the demo tracking ID ABC123 in Cargo Tracker.

CargoTrackerFigure12

Get More Information


Here are a few ways to get more information related to this tutorial:
·      Learn more about the Jakarta EE Cargo Tracker demonstration application.
·      Review the source code for the Cargo Tracker application.
·      Learn more about Jakarta EE and get involved in the community.

About the Author

Tetiana Fydorenchyk

Tetiana Fydorenchyk

Tetiana Fydorenchyk is VP of marketing at Jelastic.