Getting Started with Red Hat OpenShift Application Runtimes
For Use with Red Hat OpenShift Application Runtimes
With the emergence of Linux containerization and container platforms, the barrier to entry for using a polyglot, or multiple application runtime, architecture has been reduced. This allows you to embrace different ecosystems, languages, and runtimes at the same time for solving business problems. Moreover container platforms such as OpenShift manage, secure, and automate the deployments and monitoring of your applications. This enables you to decompose your business problems into smaller microservices while letting OpenShift help with managing some of the inherent complexity that comes with deploying, monitoring, and maintaining microservices.
Red Hat OpenShift Application Runtimes provides you with cloud-native runtimes and prescribes opinionated, cloud-native development approaches to developing, building, and deploying applications that use those cloud-native runtimes on OpenShift. These cloud-native development approaches take advantage of the capabilities provided by OpenShift and enable you to use patterns such as Circuit Breaker, Health Check, and Service Discovery.
This guide takes you through cloud-native development on OpenShift. It shows you how to create and deploy example cloud-native applications called boosters to OpenShift using developers.redhat.com/launch or the Fabric8 Launcher tool. These example applications can serve as the foundation for your actual cloud-native microservices since they can be updated and redeployed using the same deployment process detailed in this guide.
Chapter 1. Introduction to Red Hat OpenShift Application Runtimes
This section provides a brief overview of the foundational concepts behind Red Hat OpenShift Application Runtimes.
Red Hat OpenShift Application Runtimes is:
- A collection of runtimes, such as WildFly Swarm and Spring Boot, designed to run on OpenShift.
- A prescriptive approach to cloud-native development on OpenShift.
The goal of Red Hat OpenShift Application Runtimes is to provide opinionated architectures, design patterns, tools, and best practices in ready-made example applications you can execute on OpenShift to enable cloud-native development.
Cloud-native development is an approach to developing, deploying, and running applications that fully embrace the advantages of cloud computing.
Red Hat OpenShift is a container application platform that brings Docker and Kubernetes to the enterprise. OpenShift Online is a public cloud hosted by Red Hat. A Single-node OpenShift Cluster is a local cloud that you can install and execute on your local machine; this functionality is provided for example by Red Hat Container Development Kit or Minishift.
developers.redhat.com/launch is a project generator offered by Red Hat to accelerate your experience with cloud-native development on OpenShift. It provides a hassle-free way of creating example applications, called boosters, as well as an easy way to build and deploy those boosters to OpenShift. To use developers.redhat.com/launch:
- Navigate to developers.redhat.com/launch.
- Choose the details for your example application.
- Deploy application OpenShift automatically or manually.
You can find more details on using developers.redhat.com/launch in the Chapter 2, Deploying a Booster to OpenShift Online section.
The Fabric8 Launcher Tool
The Fabric8 Launcher is the upstream project from which developers.redhat.com/launch is based.
You can also install and execute the Fabric8 Launcher tool on your Single-node OpenShift Cluster to use the same capabilities within your Single-node OpenShift Cluster. For more information, see the Installing the Fabric8 Launcher Tool chapter of the Install and Configure the Fabric8 Launcher Tool guide.
Missions and Boosters
A mission implements a Microservice pattern such as:
- Health Check
- REST or HTTP endpoint
- Externalized Configuration
- Circuit Breaker
Missions use these patterns to show how to create the fundamental building blocks of cloud-native applications and services, such as:
- Creating HTTP APIs.
- Integrating your application with a relational database to provide persistent data storage.
- Implementing the health check and circuit-breaker patterns to ensure that your services can withstand a traffic overload and network issues.
- Externalizing the configuration of your applications to make them more secure and easier to scale.
Each mission is implemented in one or more runtimes. Both the specific implementation and the actual project that contains your code are called a booster. Any booster can be updated or extended for your own use case.
Process for Building and Deploying to OpenShift
When using developers.redhat.com/launch, you can create and deploy a booster to OpenShift using the Build and Deploy to OpenShift build process, which is based on the Source-to-Image (S2I) build process. Build and Deploy to OpenShift configures OpenShift to pull the code of your booster from your GitHub repository, build the code, and deploy it to OpenShift.
The benefit of this process is that it handles all the configuration, building, and deployment steps needed to get your booster running in OpenShift. It also allows you to quickly deploy code updates to help you rapidly iterate and see your changes in OpenShift.
OpenShift supports different build strategies including Source-to-Image and Jenkins Pipeline. The Red Hat OpenShift Application Runtimes boosters use the Source-to-Image strategy for simplicity of use and implementation. Other build strategies, such as the Jenkins Pipeline, are more complex, for example employing multiple servers for building or using webhooks to trigger builds.
Boosters created using the Build and Deploy to OpenShift build process can also be executed locally, as well as built locally and manually deployed to OpenShift. For more information on these options, see the
README.adoc file of your booster.
Chapter 2. Deploying a Booster to OpenShift Online
You can quickly create, build, and deploy a booster to OpenShift Online using developers.redhat.com/launch. developers.redhat.com/launch creates a new repository in your GitHub account containing the booster’s code and deploys it to your OpenShift Online account. It can also create a ZIP of the booster for you to download and run on your localhost.
- Navigate to developers.redhat.com/launch using your browser.
Select Launch your Project.
- You may be prompted to log in to your Red Hat Developers account. If you are, click Log in or register and complete the authentication steps.
You may be prompted to grant developers.redhat.com/launch access to your GitHub and OpenShift Online accounts. This is a one-time action.Important
developers.redhat.com/launch uses the
rh-developers-launchSSO realm to connect your Red Hat Developers account, your GitHub account, and your OpenShift Online account together. When you add these connections, developers.redhat.com/launch is granted access to those accounts and is allowed to use those accounts when creating and deploying boosters.
When connecting these three accounts together in
rh-developers-launch, they may only be used with each other within the
rh-developers-launchSSO realm. For example, if your GitHub account is associated with a different Red Hat Developers account within the
rh-developers-launchSSO realm, you must deauthorize it from the other Red Hat Developers account or add a different GitHub account.
At this time, you cannot use the
us-east-2OpenShift Starter cluster with developers.redhat.com/launch. This cluster is used with OpenShift.io and is configured differently.
- Click Grant Access.
- Click the Add button next to the GitHub field and authorize developers.redhat.com/launch to access your GitHub account.
- Click the Add button next to the OpenShift Online cluster you use.
- Follow the instructions to create a booster based on a mission, runtime, and target environment.
README.adocfile in your booster’s project and follow the instructions for building, deploying, and interacting with your booster.
When you are done interacting with and updating your booster, it is recommended to delete your project because the resources allocated to your OpenShift Online account are limited. For instructions, see the Deleting a Project chapter of the OpenShift Online documentation. You can redeploy the booster later using the instructions in the relevant runtime guide.
You have quotas for your OpenShift Online account. If you exceed your account quota, you will not be able to launch new boosters using developers.redhat.com/launch. The quota for your account varies depending on your subscription.
Chapter 3. Creating and Deploying a Booster Using your Single-node OpenShift Cluster
You can quickly create, build, and deploy a booster to a Single-node OpenShift Cluster using the Fabric8 Launcher tool. The Fabric8 Launcher tool creates a new repository in your GitHub account containing the booster’s code and deploys it to your Single-node OpenShift Cluster. It can also create a ZIP of the booster for you to download and run on your localhost.
Navigate to the Fabric8 Launcher tool on your Single-node OpenShift Cluster using your browser.
Optionally, use the following command to open the Web Console of your Single-node OpenShift Cluster in your browser in order to navigate to your Fabric8 Launcher tool:
$ minishift console
- Select Launch Your Project.
- Follow the instructions to create a booster based on a mission, runtime, and target environment.
README.adocfile in your booster project for more details about interacting with your booster.
Take a look the different runtime guides to learn more about runtimes as well as their boosters:
Chapter 4. Deploying a Booster to OpenShift Container Platform
- Clone your booster Github repository, or download and extract the booster ZIP archive.
Get the command containing your authentication token for using the
ocCLI client with your OpenShift Container Platform Web Console:
- Login to your OpenShift Container Platform Web console.
- Click on the question mark icon in the top right-hand corner of the Web console, next to your user name.
- Select Command Line Tools in the drop-down menu.
Find the text box that contains the
oc login …command with the hidden token, and click the button next to it to copy its content to your clipboard.
Paste the command you copied in the previous step into a terminal to authenticate your
ocCLI client with your OpenShift Container Platform account by using your authentication token.
$ oc login OCP_URL --token=MYTOKEN
Create a new project.
$ oc new-project MY_PROJECT_NAME
- Navigate to the root directory of your booster.
Deploy your booster to OpenShift Container Platform.
If your booster uses Maven:
$ mvn clean fabric8:deploy -Popenshift
If your booster uses
$ npm install && npm run openshift
README.adocfile in your booster’s project and follow the instructions for interacting with your booster.
Take a look at the different runtime guides to learn more about runtimes as well as their boosters:
Chapter 5. Updating Your Booster and Deploying the Changes
To push changes to this booster running in OpenShift Online or your Single-node OpenShift Cluster, you can push a new commit to the GitHub repository and start a new build.
Clone your project from GitHub:
$ git clone firstname.lastname@example.org:USERNAME/PROJECT-NAME.git
- Open your project in your desired IDE or editor, such as JBDS.
- Make an update to the project.
- Save your changes.
Commit and push your changes back to GitHub:
$ git add . $ git commit -m "Made an update" $ git push
- Navigate back to the OpenShift Online or Single-node OpenShift Cluster Web console and ensure the project of your mission is selected.
Click on the three dots on the right side of your application’s deployment and choose Start Build.
Your deployment is complete when you see Build #2 is complete under Builds and a
#2next to the application name under Deployment. This number will increase for each additional build and deployment.
- Confirm your changes when your deployment is complete.
Chapter 6. Using Red Hat JBoss Developer Studio with a Booster Project
Red Hat JBoss Developer Studio is an integrated development environment, or IDE, that provides tooling for writing software. You can use it to make changes to your booster’s code.
6.1. Importing your Booster’s Code
Importing your booster’s code creates a project in Red Hat JBoss Developer Studio and enables you to start making changes.
- Ensure Developer Studio is running.
- Click File → Import.
- Choose Maven → Existing Maven Projects.
- Click Browse, navigate to the root of your booster project, and click Open.
pom.xmlfile is selected and click Finish.
- Start editing your project after your import is complete.
6.2. Committing and Pushing Changes to your Booster’s GitHub Repository:
Red Hat JBoss Developer Studio provides tooling for committing and pushing code through
git directly in the IDE. Alternatively, you can use Red Hat JBoss Developer Studio to make changes and push those changes with the
- Ensure you have saved all files with changes that you intend to commit.
- Right click on the root of the project Project Explorer or Package Explorer view.
- Choose Team → Commit….
- Drag all the changes you want to commit from the Unstaged Changes section to the Staged Changes section.
- Enter your commit message and click Commit and Push.
- Click OK in the Push Results window when prompted.
- Observe your changes are now available in your GitHub repository.
Appendix A. Glossary
A.1. Product and Project Names
- developers.redhat.com/launch is a standalone getting started experience offered by Red Hat for jumpstarting cloud-native application development on OpenShift. It provides a hassle-free way of creating functional example applications, called missions, as well as an easy way to build and deploy those missions to OpenShift.
- Fabric8 Launcher
- The Fabric8 Launcher is the upstream project on which developers.redhat.com/launch is based.
- Single-node OpenShift Cluster
- An OpenShift cluster running on your machine using Minishift.
A.2. Terms Specific to Fabric8 Launcher
- Booster Catalog
- A Git repository that contains information about boosters.
An application specification, for example a web service with a REST API.
Missions generally do not specify which language or platform they should run on; the description only contains the intended functionality.
- A platform that executes boosters. For example, WildFly Swarm or Eclipse Vert.x.