Openshift Online still remains one of most generous Paas offerings on the market. With 3 free containers it’s really good bargain. Recently I’ve modified couple of my older applications to run in Openshift (myplaces and iching) to run in Openshift.
Previously I’ve created pretty standard and simple Flask application and deployed it on Openshift. The process was pretty straightforward as described in this article. However now situation was different, because both applications are special.
myplaces is python application in Django, but it requires additional process as backend computational server. Web process communicates with backend server via ZMQ sockets. Also application requires web socket communication with socketio messaging ( to update import status), so it cannot run in classical WSGI sever ( rather it runs in gevent sever). So I have to use custom catridge for python.
iching application is written in OCAML and Ocsigen, which not very common technology, so it also required custom cartridge ( I used this one, but had to modify it slightly).
Generally experience was far from smooth, with quite a few peculiar issues, to name few:
- python pip install was not working by default because Openshift is using different repositories ( I have to redirect explicitly to official pypi repos).
- start, stop action hooks did not work for python app ( but they do for OCAML one).
- Took me some time to realize where to run Django specific tasks like
manage.py migrate
- Deployment behaves differently when it runs as git hook or as enc
rhc app deploy
command or within ssh shell. (For instance I could not really get lxml installed as part of regular deploy process, but it installed without any problems in ssh shell. For OCAML compilation there were significant differences between git initiated deployment and deployment via rhc tool – finally I had to use rhc tool to make things work). - Installing of missing development libraries (libpcre in my case) was rather tedious – basically you have to supply script to download source and compile it.
- Environment variables like PATH, LD_LIBRARY_PATH, PKG_CONFIG_PATH etc. must be set correctly in all environments – which was not always the case – so I had to fix manually ( for instance custom python cartridge had incorrect LD_LIBRARY_PATH in ssh shell, which caused error when running python).
Finally I got both applications running on Openshift, but comparing with Docker (I also made Docker containers for both applications) it was much harder effort. Probably if I’ve learned more about Openshift platform, it could have been easier, but considering that their future versions are abandoning current model and moving towards Docker containers, it would not worth do dig deeper into Openshift Online technologies, because they are already past now and Docker seems to be the future.
Curious reader can look at source code (with Openshift and Docker integration) of both applications here: myplaces, iching.