Deploy a sample app on the sandbox
Get started with your Developer Sandbox for Red Hat OpenShift
While learning about state-of-the-art software development is important and great, nothing can beat hands-on experience. The challenge is that not everyone works where microservices, containers, and serverless computing technologies are being rolled out. You can now finally get that first-hand knowledge by using the Developer Sandbox for Red Hat OpenShift.
Now that you have your very own cluster at your fingertips, it's time to get something up and running.
Get that cluster
The very first step, if you haven't already done it, is to get over to the Developer Sandbox for Red Hat OpenShift page and get a free OpenShift cluster for yourself. You'll also be joining the Red Hat Developer Program if you aren't already a member, which provides access to some incredible benefits.
Once you've secured your very own cluster, click Start using your sandbox to begin your future as shown in Figure 1.
In this article, we'll explore two ways to build and deploy an application to your cluster. They are:
- Build the application from source code
- Build the application from a container image
Also, the following programming languages are covered in these examples:
Option 1: Build the application from source code
To build your application using source code that is in a Git repository (or “repo”) starts by switching to the Developer view in your OpenShift dashboard (Figure 2):
Next, click the +Add panel (Figure 3) to display the many options available for adding an application to your cluster. In our case, we are interested in the Git Repository/Import from Git option:
Select the Import from Git option as shown in Figure 4.
You will be prompted to enter a URL that points to a Git repo. This is where things get interesting.
OpenShift will copy the repo to an internal storage location, inspect it, and attempt to discern the import strategy to build it. It will choose one of the following methods to build the application:
- Using the “Builder image” for the programming language used (i.e. the s2i option),
- Using the Dockerfile that is found in the Git repo
- Using the DevFile that is found in the Git Repo
Again; we’re focusing on option number one right now: Using the Building Image and the s2i technology.
The Builder Image is determined by inspecting the source code and may be .NET, JBoss, Perl, or one of several other options.
Here are some URLs of sample code that you can use for their related languages:
- C# (.NET) https://github.com/redhat-developer-demos/csharp_mvc.git
- Go https://github.com/redhat-developer-demos/sandbox-go.git
- Node.js https://github.com/redhat-developer-demos/sandbox-nodejs.git
- PHP https://github.com/redhat-developer-demos/sandbox-php.git
- Python https://github.com/redhat-developer-demos/sandbox-python.git
- Ruby https://github.com/redhat-developer-demos/sandbox-ruby.git
Supply the URL and click Create. Figure 5 is an example.
After a few minutes, the ring on your application's icon will switch from light blue to dark blue, which means that it's ready to go. Click the external link image to see your application in a browser, as shown in Figure 6.
What's next? Try your own source code. Go on This is what the sandbox is for—to experiment and learn.
Option 2: Build the application from a container image
Follow the steps in Option 1, but in Step 3 choose the Container images option as shown in Figure 7.
This is the option I use 100% of the time. I like to build and test my images on my PC, and then push them to my image registry (quay.io/donschenck). Once an image is hosted in a registry, it's very simple to get it into OpenShift.
Just like the other two options, the simplest path is to provide the location of the input—an image in this case—as shown in Figure 8, and click Create. Yes, it really is that simple.
Is there more?
Yes. Play around. Try things. Break things. Learn. There is a wealth of knowledge within the Red Hat Developer program.
Finally, wouldn't it be cool to automate all of this build stuff? Well, guess what: You can. Check out my forthcoming article and video series about Tekton, the open source image building system. It lets you use your programming skills to automate your own job.
Here's to a bright future.
Calling all developers
Learn how to move your existing Java app to Kubernetes—without changing a single line of code
Watch demos on how you can take your existing source code or create a new application, easily deploy and manage them as containers, edit the code from our integrated developer experience, and much more.