In this post I’d like to document some information I discovered while creating an OpenShift QuickStart for Zabbix.
It will be a post that will be updated regularly.
An OpenShift QuickStart enables people to setup applications in the cloud very quick and consistent. It’s basically a package of software and scripts to setup an application in the RedHat Cloud, and I may such a package for Zabbix.
Setting up a free Zabbix Server (very handy for website monitoring) in the cloud is now as easy as:
rhc app create zabbix php-5 mysql-5 --from-code=https://github.com/dkanbier/openshift-zabbix-quickstart
Check out your brand new Zabbix server at http://zabbix-<your_namespace>.rhcloud.com!
There are plenty of examples of OpenShift QuickStarts available on GitHub, but a few things weren’t exactly clear to me so I thought I’d share my thoughts on them.
What’s the difference between OPENSHIFT_DATA_DIR and OPENSHIFT_REPO_DIR?
In many of the QuickStart examples there is data shared between the DATA and REPO directories. What are they for?
OPENSHIFT_DATA_DIR is a persistent location. Data saved in this place will stay there in between deploys, where the data saved in OPENSHIFT_REPO_DIR is replaced every deploy.
How do I use this?
In my QuickStart I need to download the Zabbix source code and compile the Zabbix binaries from iit. This takes a lot of time and resources, while the result is always the same.
It’s a waste of time and resources to do this every deploy. It would make a lot of sense to download the source code and create the binaries only once. This is where the DATA and REPO directories come in to play.
I download the source code and save the generated binaries in OPENSHIFT_DATA_DIR:
Because the DATA directory keeps it’s data, once the source code is downloaded and compiled it will stay there. During deploy’s we simply create a simlink from the DATA directory to the REPO directory, saving us a download and compile time.