In this lesson, you will learn how to work with the OpenShift web console to install an application from source code stored in a GitHub repository.
In order to get full benefit from taking this lesson, you need to:
- Understand the relationship between OpenShift and Kubernetes.
- Understand the purpose and use of a public Git repository such as GitHub to store application source code.
- Understand how to access the OpenShift web console via the Developer Sandbox for Red Hat OpenShift.
- Understand the basics of the features available to users in the Administrative and Developer perspectives.
In this lesson you will learn:
- How to use the web console to import source code from GitHub.
- How to use the web console to get the application up and running from source code.
- How to remove an application from OpenShift using the web console.
Red Hat OpenShift allows you to use the web console to install an application directly from source code hosted in a GitHub repository. All you need to do is declare the location of the source code, add some configuration information, and start the installation process.
OpenShift does the work of downloading the source code from the GitHub repository and then building a Linux container based on the source code. That Linux container is created as a pod(s) in the underlying OpenShift/Kubernetes cluster. Also, OpenShift does the work of creating a service that allows network access to the pod from within the cluster. OpenShift also creates a route to the application if the application needs to be publicly accessible.
Select the application to install
To select which application you want to install:
- Navigate here (Figure 1, Callout 1) and Select Start your sandbox for free (Figure 1, Callout 2).
- Provide the username and password for your Red Hat account in the login page that appears when you first enter the sandbox (Figure 2).
- In the OpenShift web console, select Add from the left-side vertical menu (Figure 3).
- An all service page appears. Under All items, there is a search field. Type
Python. This action filters out all text blocks except those that are relevant to Python (Figure 4).
- Select the text block labeled Python. You'll be presented with a web page that is unique to the Python service you've just selected. You will use this web page to install a Python application from source code. Select Create Application (Figure 5).
Create the application
When you select Create Application, a web page will appear titled Create to Source-To-Image Application. You'll use this web page to import source code into OpenShift that's stored in GitHub. You'll use OpenShift's Source-To-Image capabilities to create a Linux container that represents the application running in OpenShift.
Your first step is to declare the location of the application’s source code in GitHub.
https://github.com/openshift-instruqt/blog-django-pyin the text box labeled Git Repo URL (Figure 6).
- Scroll down the page. Your Create to Source-To-Image Application selection has automatically filled-in values for the Application and Name fields of the General section (Figure 7).
- Scroll until you reach Advanced options. Select Create a route to the Application. This means that as part of the application creation process, OpenShift will automatically create a URL that allows access to the application from the Internet.
- Select Create. This action will save the source code data and start the build process for the application (Figure 8).
- As the application builds, OpenShift will take you to the Topology sub-menu (Figure 9, Callout 1).
- The Topology page will display a graphic that represents the application within the OpenShift cluster. OpenShift will display the application with a light-blue circle as the build process progresses (Figure 9, Callout 2).
- When the application's build process is complete, the circle’s color will turn to dark-blue (Figure 9, Callout 3).
- Once the application build process is complete, it is ready for use. In this case, the application is a web application written in Python that is viewable in a web browser. Click the icon in the upper right corner "to application" graphic to start the web application in a browser window (Figure 10).
At this point, the Python application is up and running. All you did was choose an application template from the OpenShift library and set a URL that declared the location of the application’s source code in GitHub. OpenShift retrieved the source code, created a Linux container based on the source, then got the container up and running in the underlying Kubernetes cluster. Also, OpenShift did the work of exposing the application to the Internet at a URL created by OpenShift to enable access.
Delete the application from OpenShift
You can delete an application running in OpenShift by right-clicking on the circular graphic representing the application in Topology view, then selecting Delete Application.
Right-click on the outer ring of the circular icon representing the application in Topology view, then select Delete Application from the dialog box (Figure 11).
You will be asked to confirm if you want to delete the application. Enter the application’s name to delete it (Figure 12).
In this lesson, you learned how to use OpenShift to install an application from source code. You selected an application template for the OpenShift library. You declared the URL of the application’s source code in GitHub, then instigated the build process by doing nothing more than clicking a Create button. Finally, you viewed the application by using a URL that OpenShift created.
In the next lesson, you’ll learn how to use the OpenShift web console to install and run an application from a container image that’s hosted in a public repository.