As a weekend exercise, I migrated my old MEAN stack app into new OpenShift 3.0 PaaS. OpenShift has been completely rewritten utilising Docker containers orchestrated via the Kubernetes. Namely, it is a platform for deploying and managing Docker containers.
In OpenShift, a project is a Kubernetes namespace, which is a cluster of resources used by an application. The basic unit of deployment is a pod, a container started form a Docker image. Scaling can be done by varying the number of pods running.
For my setup, I deployed two Docker containers, one for the Node.js app and one for Mongo DB. Deployment can be done from the local machine, a git repository, or from DockerHub. I uploaded my images first to DockerHub and used that as an image stream for my deployment. You can also set webhooks to trigger automatised deployment on code or image change. OpenShift support different deployment strategies e.g. automatised rolling deployments.
My biggest challenge was to get my Docker images run on OpenShift, as there are some restrictions on how to set up your Dockerfile, e.g. due to security reasons you should avoid running commands as sudo. And I couldn’t find much documentation or examples of compatible descriptions.
In addition to web console, OpenShift provides a command line tool. It can be used to create new applications and to manage containers. Surprisingly, yes, the command line tool seemed to be most convenient for making deployments. You can use it to run commands inside your containers e.g. for debugging and setting up you database. It is, as they say, “one tool to rule all”, no need to use SSH or such. Web console was nice for setting environment variables and setting up routes. Web console also provides handy view on runtime, build, and deployment logs, metrics on used resources, and even integrated terminal window.
OpenShift has a free start-plan, which allows setting up one project and two pods with limited amount resources. Pro-plan can occupy up to 10 projects and the basic cost is about 50€ per month.
I had some previous experience on Docker, but first time I deployed containers on PaaS. Finally, I have it all happily up and running. So, if you’re looking for a container application platform…
Oh, and there is a free ebook by O’Reilly OpenShift for Developers.