Acme Air is a full-fledged sample application for a fictitious airline called Acme Air which handles flight bookings with thousands of entries in its database. The implementation can support running on a variety of runtime platforms including virtual machines (VMs), Red Hat® OpenShift®, Docker containers, IBM Cloud®, and other Kubernetes environments. This tutorial shows you how to deploy the application on Red Hat OpenShift Container Platform on IBM Power Systems™ and to build your own images and perform updates on a running deployment.
The project consists of five components as shown in Figure 1. The front-end and deployment scripts are in the Main Service project.
Figure 1. Major components of Acme Air
Prerequisites
You need to make sure that the following prerequisites are fulfilled before deploying the sample Acme Air application.
To access the application, open the URL provided in the output of the script in a browser. Click the Configure the Acme Air environment link to load the database and start using the application.
Figure 3. Acme Air homepage for Version 1.0
Build your own images for Acme Air
Each repository for Acme Air is present in https://github.com/ocp-power-demos organization. You can make updates to the application across the five components and can deploy seamlessly without uninstalling the application.
Code updates and image creation
To demonstrate, we will make a version change to the front end of the application dashboard. After an update is performed, the change will be reflected on the browser without having to uninstall the application.
Fork the https://github.com/ocp-power-demos repository to your GitHub account to start creating changes. Create a new branch on the acmeair-mainservice-java repository. Because this is a version update, we call this branch version-update.
git clone https://github.com/<fork-repository-account>/acmeair-mainservice-java
cd acmeair-mainservice-java
git checkout -bversion-update
Show more
Update the code in the Java™ web application.
As a small update, change the version of the application from Version 1.0 to Version 1.1. Update the HTML code under acmeair-mainservice-java/src/main/webapp/.
Note: There is a separate HTML file for each page of the application under the webapp directory.
Figure 4. Header section of the HTML file contains the title image and caption of the Acme Air web application
Update the deployment YAML file (deploy-acmeair-mainservice-java.yaml) in the manifests-openshift directory of the source code to reflect the version of the new image for future deployments. Update the quay.io username with the account registered to you. The tag used here is 1.1 to relate to our new version 1.1.
Figure 5. An example of the image name in the deploy-acmeair-mainservice-java.yaml deployment manifest
As the images will be built using Travis CI, you need to authorize Travis CI to push images to our Quay.io account. To do this, create a new robot account in Quay.io and add the credentials to Travis CI. To create a new robot account, go to the Robot Account section in your Quay.io account and add a name and description and click Create robot account.
Figure 6. Creating a robot account
Notice that the credentials for the robot account are provided in the Robot Token section. The username and token can be shared by multiple repositories that are owned by a user or organization.
Figure 7. Token generated after creating a new robot account
Create a new empty public repository in Quay.io with the name of the image. To create a repository in the Quay.io UI, click the + (plus) icon at the upper-right side of the header on any Quay.io page and click New Repository.
Figure 8. Selecting the option to create a new repository
Figure 9. Window to create a new repository
Select the newly created repository (in this example, acmeair-mainservice-java) under REPOSITORY NAME and click Settings.
Figure 10. Selecting the new repository
In the User and Robot Permissions section, add the robot token with Write permissions.
Figure 11. User and Robot permissions on the Repository settings page
Go to travis-ci.org, navigate to your Travis CI account settings and enable the project under the Repositories section. Repositories in travis-ci.org are disabled by default.
Figure 12. The repositories section in user account settings
To populate the environment variables in travis-ci.org, click Settings next to the project name. Add two environment variables, ROBOT_TOKEN and ROBOT_USER and set the values from step 5. The names of the environment variables should match the variable names given in the .travis.yml file.
Figure 13. Environment variables for robot user and token
Update the .travis.yml file in the repository source code. IMAGE_PREFIX must contain the name of your Quay.io repository and the ACME_VERSION is the image tag, which is 1.1.
The .travis.yml file specifies the tasks for Travis CI to perform. The robot user and token information will be picked up directly from the environment variables set in the travis-ci.org repository settings.
Figure 14. Acme Air build configuration in the .travis.yml file
Push the local changes to remote. After successfully pushing the code, the Travis CI job will begin, and a new version of the image will be generated in Quay.io.
Figure 15. Green check mark indicating that the job is successful
Perform a rolling update
Each deployment for Acme Air has a rolling update strategy. You may update fields for RollingUpdate during deployment with the required values.
StrategyType: RollingUpdate
MinReadySeconds: 0RollingUpdateStrategy: 25% max unavailable, 25% max surge
Show more
Run the following command to perform the rolling update:
You can perform similar steps to build images for all the five projects as required. Making updates and deploying this sample application can help you to discover and understand the different features of OpenShift on IBM Power Systems servers. You can also perform performance benchmark tests, change the update strategy, and add in your own set of features to the application.
About cookies on this siteOur websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising.For more information, please review your cookie preferences options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.