Monday, February 1, 2016

Deploying Yii Application in Openshift Origin

This post would describe how we deploy a Yii application into Openshift Origin. It should also work in Openshift Enterprise and Openshift online.


PHP-based application that runs in a Gear must not write to the application directory, because it is not writable. Openshift provides a Data Directory for each gear, which we could use for the purpose of writing assets and application runtime log.

For the case of load-balanced application, error messages written to application log is also stored in multiple gears, making troubleshooting more complex than it is.


Use deploy action hook in order to create directories in the data directory and symbolic links to the application. Change the deploy script to be executable, in Windows systems without TortoiseGit we need to do some git magic.
Create this file as .openshift/action_hooks/deploy in the application source code.

If your application is hosted using 'php' directory in the source code :

If your application is hosted in the root of the application source code :

Then make it executable and commit it :

For checking application.log, do this in the Ruby command prompt : (a trick I learned from this blog)

Another way to troubleshoot is to do port forwarding to different gears :
After port forwarding set up, you could access the apache in the gear by going to in your browser (adjust with the actual port shown by rhc port forward)

No comments: