Hello there friendly OpenShift Online Next Gen traveler. You are probably familiar with the Source-to-Image builder mechanism that allows you to push source code directly to the platform. Using this process is quick and easy in that it allows the platform to build the source and then create a new docker image for you on the fly. It truly seems like magic. What's that you say friendly traveler, you don't have an account for OpenShift Online Next Gen yet?
However, one of the questions you may be asking yourself after using the developer preview for a few days is how to deploy a .war directly to OpenShift instead of relying on the platform to build your source code and resolve all of your dependencies for you (maven for example). I am happy to report that you can do this with just a few taps of the keys at your trusty command line using the oc command line tool. If you just simply want to try this out if you don’t a .war file ready to go, I would suggest downloading the sample war file from the apache tomcat project to use as our example. Once you have the .war file downloaded and ready to go, we need to do a few housekeeping items.
First, create a directory for your project on your local file system. For example, I like to store all of my project in my ~/code directory so I would issue the following command (assuming sample.war is located in my Downloads directory):
$ mkdir sample
$ cd sample
$ cp ~/Downloads/sample.war .
Now that we a project directory created named sample, and our .war file located in the deployment subdirectory, it’s time to create our application.
$ oc new-app wildfly:latest~. --name mysample
This will create all of the necessary kubernetes and openshift objects required for our application. The last thing we need to do is to create a build that will push our .war file up to the OpenShift server and deploy it. Enter in the following command:
We recently introduced the Web Terminal Operator on OpenShift in Tech Preview. This operator integrates with the OpenShift console (in OpenShift 4.5.3 and higher) to allow you to open a full terminal ...