This getting started experience walks you through the simplest way to get a sample project up and running on OpenShift Enterprise. There are a few different ways to launch images within a project, but this topic focuses on the quickest and easiest method.
If this is the first part of the documentation you have read, and you are unfamiliar with the core concepts of OpenShift version 3, you might want to start by reading about what’s new. This version of OpenShift is significantly different from version 2.
To help illustrate constructing such applications, the following sections guide you through creating a project that contains a sample Node.js application that will serve a welcome page and the current hit count (stored in a database).
Before you can get started:
You must be able to access a running instance of OpenShift Enterprise. If you do not have access, contact your cluster administrator.
Your instance must be pre-configured by a cluster administrator with the Instant App templates and builder images. If they are not available, direct your cluster administrator to the Loading the Default Image Streams and Templates topic.
You must have the OpenShift Enterprise CLI downloaded and installed.
Review the browser versions and operating systems that can be used to access the web console.
The following video walks you through the rest of this topic: Click here to watch
To create an application, you must first create a new project, then select an InstantApp template. From there, OpenShift begins the build process and creates a new deployment.
Visit the OpenShift web console in your browser. The web console uses a self-signed certificate, so if prompted, continue past a browser warning.
Log in using the username and password recommended to you by your administrator.
To create a new project, click New Project.
Type a unique name, display name, and description for the new project.
The web console’s welcome screen loads.
To create a new application, click Add to Project.
The Add to Project page loads, and gives you the option to create from a publicly accessible git repository, or from a template.
Click the nodejs-mongodb-example template.
The template configuration page loads, displaying pre-configured parameters.
Click Edit Parameters, then update the source repository URL to your forked repository:
Type a secret in the GITHUB_WEBHOOK_SECRET field. This webhook secures the trigger that causes your application to automatically rebuild whenever you push a code change to your forked repository.
After creation, these settings can only be modified from the CLI by using the
Your application is then created, which might take some time. In the case of this template, MongoDB is created first, then the Node.js application is built using the OpenShift source-to-image (S2I) builder.
You can follow along on the Overview page of the web console to see the new resources being created, and watch the progress of the build and deployment. While the MongoDB pod is being created, its status is shown as pending. The MongoDB pod then starts up and displays its newly-assigned IP address.
When the Node.js pod is running, the build is complete.
If your DNS is correctly configured, then your new application can be accessed using a web browser. If you cannot access your application, then speak with your system administrator.
To view your new application:
In the web console, view the overview page to determine the web address for the application. For example:
Visit the web address for your new application.
You forked the source code for this application from the OpenShift GitHub repository. Therefore, you can use a webhook to automatically trigger a rebuild of your application whenever you push code changes to your forked repository.
To set up a webhook for your application:
From the Web Console, navigate to the project containing your application.
Click the Browse tab, then click Builds.
Click to copy your GitHub webhook.
Navigate to your forked repository on GitHub, then click Settings.
Click Webhooks & Services.
Click Add webhook.
Paste your webhook URL into the Payload URL field.
In the Secret field, type the secret you chose when creating your application.
Click Add webhook to save.
GitHub now attempts to ping the OpenShift server to ensure that communication is successful. If it is correctly configured, you will see a green check mark next to your new webhook URL. Hover your mouse over the check mark to see the status of the last delivery.
The next time you push a code change to your forked repository, your application will automatically rebuild.
To work locally and then push changes to your application:
On your local machine, use a text editor to change the sample application’s source for the file nodejs-ex/views/index.html
Make a code change that will be visible from within your application. For example: on line 219, change the title from
Welcome to your Node.js application on OpenShift to
This is my awesome Node.js application on OpenShift, then save your changes.
Commit the changes in git, and push the change to your fork.
If your webhook is correctly configured, your application will immediately rebuild itself based on your changes. View your application using a web browser to see your changes.
Now all you need to do is push code updates, and OpenShift handles the rest.
You may find it useful to manually rebuild an image if your webhook is not working, or if a build fails and you do not want to change the code before restarting the build. To manually rebuild the image based on your latest committed change to your forked repository:
Click the Browse tab, then click Builds.
Find your build, then click Rebuild.