Developers: Web Console Walkthrough (OpenShift Origin)

1. References

https://docs.openshift.org/latest/getting_started/developers_console.html#getting-started-developers-console

2. Introduction

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).

3. Before you begin

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.

3.1. Loading the Default Image Streams and Templates

You can populate your OpenShift Origin installation with useful sets of Red Hat-provided image streams and templates to make it easy for developers to create new applications.

Confirm if these image streams and templates are already registered in your OpenShift Origin cluster:

$ oc get is -n openshift
No resources found.
$ oc get templates -n openshift
No resources found.

You must have cloned the repository that contains the default image streams and templates:

$ cd ~
$ git clone https://github.com/openshift/openshift-ansible
Cloning into 'openshift-ansible'...
remote: Counting objects: 50088, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 50088 (delta 5), reused 0 (delta 0), pack-reused 50077
Receiving objects: 100% (50088/50088), 13.10 MiB | 1.59 MiB/s, done.
Resolving deltas: 100% (30254/30254), done.
Checking connectivity... done.

Define shell variables for the directories containing image streams and templates:

Note: Tutorial indicates "v1.1" but directory has more versions, we're using the "latest" one instead of "v1.1" because jenkins was not working fine

$ IMAGESTREAMDIR=~/openshift-ansible/roles/openshift_examples/files/examples/latest/image-streams; \     DBTEMPLATES=~/openshift-ansible/roles/openshift_examples/files/examples/latest/db-templates; \     QSTEMPLATES=~/openshift-ansible/roles/openshift_examples/files/examples/latest/quickstart-templates

Creating Image Streams for OpenShift Origin Images (requires cluster-admin privileges, because it operates on the default openshift project):

$ oc create -f $IMAGESTREAMDIR/image-streams-centos7.json -n openshift
imagestream "ruby" created
imagestream "nodejs" created
imagestream "perl" created
imagestream "php" created
imagestream "python" created
imagestream "wildfly" created
imagestream "mysql" created
imagestream "postgresql" created
imagestream "mongodb" created
imagestream "jenkins" created

Creating Database Service Templates:

The database service templates make it easy to run a database image which can be utilized by other components. For each database (MongoDB, MySQL, and PostgreSQL), two templates are defined.

One template uses ephemeral storage in the container which means data stored will be lost if the container is restarted, for example if the pod moves. This template should be used for demonstration purposes only.

The other template defines a persistent volume for storage, however it requires your OpenShift Origin installation to have persistent volumes configured.

To create the core set of database templates:

$ oc create -f $DBTEMPLATES -n openshift
template "mongodb-ephemeral" created
template "mongodb-persistent" created
template "mysql-ephemeral" created
template "mysql-persistent" created
template "postgresql-ephemeral" created
template "postgresql-persistent" created

Creating Instant App and Quickstart Templates:

The Instant App and Quickstart templates define a full set of objects for a running application. These include:

Some of the templates also define a database deployment and service so the application can perform database operations.

Using these templates, users are able to easily instantiate full applications using the various language images provided with OpenShift Origin. They can also customize the template parameters during instantiation so that it builds source from their own repository rather than the sample repository, so this provides a simple starting point for building new applications.

To create the core Instant App and Quickstart templates:

$ oc create -f $QSTEMPLATES -n openshift
template "cakephp-mysql-example" created
template "cakephp-example" created
template "dancer-mysql-example" created
template "dancer-example" created
template "django-psql-example" created
template "django-example" created
template "jenkins-ephemeral" created
template "jenkins-persistent" created
template "nodejs-mongodb-example" created
template "nodejs-example" created
template "rails-postgresql-example" created

3.2. Verify availability from the web console

Login into the OpenShift Origin web console, eg: with login test and password test

https://openshift.local:8443/console/

Click in a project, eg: 'prova'

Click 'Add to project' and verfify that it is not empty the catalog of default Image Streams and Templates as shown in screenshot below:

4. Tutorial Video

OpenShift Enterprise 3.2 - Creating your first application from the web console:

https://access.redhat.com/videos/2480801

5. Test it

On the host machine, add to the hosts file:

127.0.0.27 ruby-ex-prova.router.default.svc.cluster.local

VirtualBox has port forwarding to the OpenShift router on port 80:

TCP 127.0.0.27:8080 --> [blank]:80

On the host, browse to the application:

http://ruby-ex-prova.router.default.svc.cluster.local:8080/

6. Manually Rebuilding Images

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:

    1. Click the Browse tab, then click Builds.
    2. Find your build, then click Start Build.