Time to look back. I have used OpenShift since 2016. The old OpenShift PaaS was retired a year ago. Same time I wrote my first blog about ‘last minute’ migration of my crowdfunding app to new OpenShift v3 container application platform. The migration, as such, was relatively straightforward, resulting to two running containers: Dockerised Node.js app and Mongo database. Now, I have gained some more experience of the new platform.
OpenShift builds on top of Kubernetes and supports deployment from Docker images. When v3 was released, source-to-image builds were not well supported. Currently, building and deployment from hosted Git repositories is possible. I have used deployment from prebuilt and locally tested images. Initially, I used Dockerhub as an intermediary storage for my images. However, due to improved documentation, I finally managed to create the image-stream by pushing the image directly in the OpenShift internal registry. This is convenient, especially, if you want to tricker new deployment on image chance. Otherwise, you’ll need to define Webhooks to update your image-stream from the remote repository.
OpenShift supports different databases (e.g. Mongo, MySQL, and PostgreSQL) as a prebuilt images. However, database containers (pods) needs to be mounted to persisted volumes in order to survive from container crashes and recreation without data loss. The documentation is partly miss-leading here. Even if you deploy a ‘persisted’ database the data is not automatically persisted. Especially, when using the command line tool, you need to add create a separate persisted volume and mount your data directory. I should have known better.
OpenShift don’t have built-in support for database backups. For manual database backups and migrations, I have used SSH port-forwarding. It is nice, as it allows running Mongo maintenance tools from the local machine. After having some database hiccups with wrongly configured or non-existent (!) persisted volumes, I ended up running a cron job for nightly database backup. Yea, persisted volumes taught me a lesson.
After all, I have enjoyed working with OpenShift v3 and will continue the journey. Next, I’d like to learn about different Kubernetes update strategies. Keep it rolling!
Recommended brand new eBook from O’Reilly: Deploying to OpenShift