Cloud Zone is brought to you in partnership with:

Dedicated and detail-oriented IT Engineer experienced in software deployment, cloud infrastructure, process automation, shell scripting and configuration management. Also skilled in Agile Development and Scrum. Always ready to work with new technologies and to deliver continuous improvement. Alen is a DZone MVB and is not an employee of DZone and has posted 6 posts at DZone. You can read more from them at their website. View Full User Profile

More on Running WordPress on OpenShift

02.22.2013
| 3732 views |
  • submit to reddit
So here is second part of running WordPress on OpenShift article. As I said this post will show you how to install OpenShift CLI, how to create snapshots, aliases and how to add your domain.

OpenShift CLI installation

First I will cover installation of CLI. For Windows you will need to install ruby 1.8.7 first, on Linux you will probably have it, so just skip first two steps:

  • You will need ruby, easiest way to install ruby on Windows is using rubyinstaller for Windows
  • During installation choose “add to path” option
  • After installation is done go to CMD/Shell and type “gem install rhc”
  • When rhc gem is installed run “rhc setup” to finish installation (you will need to provide OpenShift username and password, you can skip adding keys)

After finishing last step you are done. One note regarding CLI is that basically some things like creating snapshots or creating aliases can’t be done through web, so CLI is only option. Actually CLI has any option that is available through web and a lot more. To see full list of options just type “rhc”.

Creating snapshots and adding aliases

Next thing you will need for your application is creating backup or snapshots. Through rhc it’s pretty simple, just run following command:

rhc snapshot save appName

This command sometimes don’t work for some reason, but in that case you will get which command you need to run through ssh.

Login to your application

OpenShift uses a public key to securely encrypt the connection between your local machine and your application and to authorize you to upload code. You must create a private and public key on your local machine and then upload the public key before you can connect to your applications’ Git repositories or remotely access your application. On Windows you can use puttygen to generate keys and on Linux you can use “ssh-keygen -t rsa” command. Then copy content of your public key here.

Adding your domain name

To add your own domain you need a domain of course. Next you need to add aliases to your application:

rhc alias add appName domain.com
rhc alias add appName www.domain.com

After that go to your domain name registrar and add following:

@ - URL redirect - http://www.domain.com
www - CNAME - applicationname–namespace.rhcloud.com

Then on your WordPress application (General settings) add this URL: www.domain.com (using just domain.com will make your app unavailable)

So that is basically it for now, if you have any questions just post a comment and you will get the answer ASAP.
Published at DZone with permission of Alen Komljen, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)