OpenShift ANZ Meetup Series
Interested in this kind of thing? Are you based in Australia and New Zealand? We are doing a Meetup up tour of various cities in ANZ. Check here for details on the latest topic and schedule. Now read on! Find the presentation of the completed DevOps with OpenShift series here and read book.
Application Centric Automation
OpenShift makes it easy to use powerful orchestration tools such as Kubernetes together with container image formats such as docker to build application centric automation. Keen to just get started? Go straight to the Installation section then try one of the Labs.
Still reading? Use of Kubernetes and docker primitives can be fully abstracted for those not concerned with such details. This makes for a compelling technology platform to enable DevOps capabilities accessible to “Citizen Developers” through to 10x Programmers.
A DevOps Tutorial
This tutorial curates a series of OpenShift-based mini labs demonstrating a particular DevOps automation use case, so hey, let’s call them minilabs, because we can.
Each minilab topic points to a seperate blog post entry following the pattern as summarised below. While the emphasis is more practice than theory, each presents an exemplar that can be later generalised or refactored.
Introduction – A short teaser setting the scene of why this topic matters.
Objectives – Learning and demonstration outcomes.
Setup – Getting started steps including how to reset the tutorial.
Instructions – Steps to reproduce the demonstration use case.
Trivia – Useful and interesting resources for follow up.
Note that the worked examples favour a command-line interface (CLI) style rather than using graphical (GUI) tools. This is deliberate as the CLI approach makes it easier for DevOps interested users to later reproduce and automate. The CLI calls are typically self-evident, but the reader is encouraged to use the onboard
--help and/or replicate the example using the OpenShift Console at their convenience.
oc cluster up
The minilabs can be followed from the safety and comfort of your own laptop. OpenShift is launched using the “oc cluster up” feature. This is a simple command that launches an OpenShift cluster for local workstation research and development as a single (master/node) instance. To make this even easier, several convenience wrapper tools are available that provide support for stateful profiles. This enables us to label, separate and save multiple different OpenShift cluster work environments within the same operation system instance. The OpenShift MiniLab series environment has been documented and tested using Mac OS/X (Sierra) and Windows 10 (PowerShell).
The sample application used for many of the tutorials is known as COTD. It is a PHP and jQuery Mobile based web application that shows an ordered list of items. Each page consists of an image with a small trivia comment and the user can step through and rate any item. The application can display different content by changing the theme via an environment variable (SELECTOR). Three of the included themes feature a list of “pets, “cats” and “cities” – hence the origin of the name COTD, or “Cat/City of the Day”. The default theme, “pets” is collected from amongst my work colleagues. Inspect a running instance of COTD featuring one of our star pets, Tipsy.
Follow the instructions detailed at: Getting started with oc cluster up/down to set up your Linux, Mac OS/X or Windows 10 environment.
Create a working directory and clone down the latest version of some useful lab support artefacts.
$ mdkir ~/containersascode $ cd ~/containersascode $ git clone https://github.com/StefanoPicozzi/cotd.git
Launch OpenShift Cluster
Finally its time to start an OpenShift cluster. Described here is the launch instruction using the oc-cluster-wrapper tool. Yes, its this easy. The other cluster up techniques behave similarly, check Getting started with oc cluster up/down for details specific to your environment.
The “containersascode” parameter sets this up as a named profile so that the system state (configuration) is preserved on restart. The first launch will take a few minutes as it pulls down the OpenShift Origin distribution. Once started verify the cluster is operational as per below. Login to the Console if you wish using credentials developer/developer, then try a restart.
$ oc-cluster up containersascode $ oc login -u system:admin $ oc project default $ oc get pods $ oc-cluster down $ oc-cluster up containersascode
Once you have successfully completed the installation procedures, do the following to refresh and restart before each lab. From time to time it is worth reviewing the Getting started with oc cluster up/down to pull down any updates of the oc client tools or for the launch technique of your preference, e.g. powershift, oc-cluster-wrapper or CLI.
$ cd ~/containersascode $ cd cotd; $ git pull $ oc-cluster down $ oc-cluster up containersascode
If you’ve got to here you have probably self-selected yourself as someone who has a background knowledge of this content and its importance. The labs to follow assume an introductory familiarity with using OpenShift. The OpenShift for Developers eBook is a great place to start.
Read the first few chapters of DevOps with OpenShift – Cloud Deployments Made Easy.
Summarised here are not just one, but three different approaches to getting started with setting up a local OpenShift cluster lab environment. Pick your favourite and away you go. Also read Chapter 1 of DevOps with OpenShift – Cloud Deployments Made Easy.
Persistence and stateful behaviour is not going anywhere soon. OpenShift solves the problem of provisioning and managing persistent volume claims by ephemeral work loads such as containers. It take just a few simple steps which are described in this tutorial. Also read Chapter 1 of DevOps with OpenShift – Cloud Deployments Made Easy.
Read Chapter 3 of DevOps with OpenShift – Cloud Deployments Made Easy.
Read Chapter 4 of DevOps with OpenShift – Cloud Deployments Made Easy.
An OpenShift image build can be triggered by a push event in your git-based source code repository. This enables an easy integration of third party CI/CD tool chains to OpenShift as a container management host. A north/south separation of concerns, if you so will. Try this feature for yourself in this tutorial.
Read Chapter 5 of the book DevOps with OpenShift – Cloud Deployments Made Easy.
Read Chapter 5 of DevOps with OpenShift – Cloud Deployments Made Easy.
One way we can empower all those “Citizen Developers” is to make it as easy as possible to build useful container based applications, without needing to know container implementation details. Source-to-image (S2I) builds and deploy a container from source using a recipe, many of which ship with OpenShift. This example shows how to create or customise your own S2I to build a business rules service. Also read Chapter 6 of DevOps with OpenShift – Cloud Deployments Made Easy.
So you’re a Data Scientist? Check out RStudio Server on OpenShift. Login credentials are guest/guest. The home directory is an externally mounted volume and so all the packages you install are preserved on restart. Nice?
Check out the blog page. Then read Chapter 7 of the book DevOps with OpenShift – Cloud Deployments Made Easy.
Read Chapter 7 of DevOps with OpenShift – Cloud Deployments Made Easy.
As much as I love RStudio, that doesn’t stop me seeing other people. So here we set up a Jupyter R-enabled notebook on OpenShift. As with RStudio, the work directory is an externally mounted volume and so all the packages you install are preserved on restart. Go cRazy!
So that last lab was too easy. An RStudio Server instance sending SparkR instructions to a remote Apache Spark cluster all on OpenShift. Don’t be Ridiculous!
Itching too try out minishift? Here you go and with a JBoss EAP sample application to boot.
An asynchronous match made in heaven? No. Just a matter of refactoring an existing template.