Skip to content

Latest commit

 

History

History
104 lines (69 loc) · 5.52 KB

File metadata and controls

104 lines (69 loc) · 5.52 KB

Liberty Source to Image Builder Demo

This demonstration describes how to produce a new Source to Image (S2I) runtime image to deploy web application running on liberty on OpenShift.

IBM Liberty

Table of Contents

Overview

OpenShift provides several out of the box Source to Image builder images. To support deployments in Liberty, a new s2i builder image will be created to support a simplified deployment to OpenShift. Once the new image is produced, an example application will be deployed.

It makes use of the following technologies:

Bill of Materials

Environment Specifications

This demo should be run on an installation of OpenShift Enterprise V3.7

External Source Code Repositories

OpenShift objects

The openshift-applier will create the following OpenShift objects:

NOTE: This requires permission to create new projects and that the liberty-demo project doesn't already exist

Setup Instructions

There is no specific requirements necessary for this demonstration. The presenter should have an OpenShift Enterprise 3.7 environment available with access to the public Internet and the OpenShift Command Line Tools installed on their machine.

Prerequisites

The following prerequisites must be met prior to beginning to build and deploy Liberty

  • OpenShift Command Line Tool
  • Openshift Applier to build and deploy artifacts and applications. As a result you'll need to have ansible installed The following steps are to be used to demonstrate two methods for producing the Source to Image builder image and deploying an application using the resulting image.

Build and Deployment

  1. Clone this repository: git clone https://github.com/redhat-cop/containers-quickstarts
  2. cd containers-quickstarts/build-s2i-liberty
  3. Run ansible-galaxy install -r requirements.yml --roles-path=roles
  4. Login to OpenShift: oc login -u <username> https://master.example.com:8443
  5. Run openshift-applier: ansible-playbook -i .applier/hosts roles/openshift-applier/playbooks/openshift-cluster-seed.yml

Three new image builds will be kicked off automatically. They can be tracked by running oc logs -f bc/websphere-liberty, oc logs -f bc/hello-world-artifacts and oc logs -f bc/hello-world respectively. Last the deployment will kick of which can be tracked by running oc logs -f dc/hello-world.

Verify the application

The application will be available at the context: hello-world-war-1.0.0 You can curl as follows:

curl -L http://$(oc get route hello-world --template '{{ .spec.host }}')/hello-world-war-1.0.0

Liberty s2i image environment variables

You can set the following environment variable on containers running on images created with the Liberty s2i image:

Environment Variable Default Description
ENABLE_DEBUG false enable running the jvm in debug mode
DEBUG_PORT 7777 port on which the jvm will listen for a debugger

Considerations on http session failover

When liberty is deployed in a cloud environment, there are certain limitations that apply as explained in this document. With respect to the http session failover, two techniques generally apply:

  1. session replication: Liberty does not support session replication out-of-the-box. This feature can be implemented by integrating with eXtremeScale, as described in this article.
  2. session persistence: it is possible to persist the session using any database that support a JDBC connection. This article explains how to configure Liberty to do so.

Cleaning up

oc delete project liberty-demo