Blog

Getting started with OpenShift development – in just 15 minutes

July 31, 2021 By Christopher Downey

Introduction

This is the start of tutorial series for software developers on OpenShift and DevSecOps. We will start as simple as possible, incrementally working our way to creating complex open-source software that Swish actively uses across multiple projects.

Along the way, we will build a DevSecOps pipeline, utilize an OpenShift operator to automate the drudgery of maintaining encryption certificates, move from OpenShift 3.11 to 4.x and investigate its potential for improving our pipeline security, and much more.

This tutorial sets up OpenShift on your development machine and proves whether or not it works via a simple deployment. Every tutorial is developed, tested and guaranteed to work on Windows 10 and Mac OS X 10.13 and greater.

If you’re using a machine provided by your organization, you might find that it is locked down and some steps will not work (especially the initial installation and setup of our development environment). In this case, we suggest that you (1) use your own machine while (2) working within your organization to understand the current constraints placed upon developers and making simple, bold requests that the constraints be loosened enough to allow for this series.

By taking this dual approach, you will take the first steps to incrementally move yourself and your organization towards a DevOps culture.  Swish has experience with this, so feel free to reach out to share your frustrations or brainstorm some approaches that you could take.

What this tutorial will do for you

There are an almost overwhelming number of ways to get started with OpenShift development. This tutorial is pre-tested on a simple path to get you up and running fast.

Requirements

  • You are comfortable with the command line
  • 4 GB of memory that can be used by OpenShift
  • 20 GB of disk space for OpenShift
  • A sense of curiosity and adventure

If you’re using a Mac

When you see a line that starts with $, that means it’s a command for the terminal.

Install your initial toolkit:

If you’re using Windows

When you see a line that starts with $, that means it’s a command for the git bash command line.

Install your initial toolkit:

  • Git Bash.  This provides git on your Windows machine.  If you are not familiar with the Linux command line, all the more important for you to use this in place of the Windows command line.
  • VirtualBox.  Note: contact me for an alternative approach if you’re already using Docker for Windows, which requires a configuration that breaks VirtualBox.
  • Download the latest minishift release for Windows, move the unzipped minishift.exe into your working directory or path

Continue with Installation

  • $ ./minishift config set vm-driver virtualbox
  • $ ./minishift start

This could take some time. At the end, if successful, you will see a message that “The server is accessible via web console…”

Next,

  • copy the OpenShift client executable – C:\Users\$YOUR-ACCOUNT-NAME.minishift\cache\oc\v3.11.0\windows\oc.exe – to your working directory or path
  • $ ./oc new-app –name=hello-world ruby~https://github.com/openshift/ruby-hello-world
  • $ ./oc expose svc/hello-world
  • $ ./oc status

When your first application is ready, you will see “deployment #1 deployed” in the results of oc status, including a URL for your app. When ready, plug the URL into your browser. If successful, you’ll see “Welcome to an OpenShift v3 Demo App.”

Problems?

Invitation: contact me if you need a troubleshooting partner.

Conclusion

You just accomplished a lot in a very short period of time:

  • installed OpenShift onto your development machine
  • injected application code into a secured container
  • utilized Kubernetes as an application server by running the sample hello-world application

Just a few years ago, without a platform builder like OpenShift, getting all this setup and working would have taken much longer (at least a few hours).

Next Action To Take

Email me directly at cdowney@swishdata.com if you’d like to discuss your specific software development challenges.  And if you haven’t already done so, read our Getting Started in DevSecOps Cheat Sheet.