Running On OpenShift after Hosting held Hostage

It all started when I got an alarming email from my (now ex’) hosting company  which I was using to run my WordPress based blog The email mentioned my account has expired, and the renewal quote was about double the price I was paying previous year. I kindly asked to backup all my data before I make any decision, and I was kindly refused. So basically with all it’s data was held hostage by the hosting company – I have to pay ransom to get access. I’ll refrain from mentioning the company’s name but there are plenty of bread crumbs spread around the web if you’re really interested.

Luckily (call it a hunch), just couple of days before, I made a backup of all directories and databases on my account, so I had a fairly recent snapshot of my data. I decided to try restoring my blog elsewhere.

Since WordPress is a simple LAMP application, all it would take to migrate it is to restore the database and all WordPress directories with custom code, Plugins, Themes, and uploads. So it would be a great candidate to run on OpenShift.

I must admit, OpenShift has come a long way from where it was just a year ago, it took me about couple of hours getting back online, and another half an hour to wait for my local DNS to catch up with some changes I had to do. I’ve tried migrating to OpenShift about a year ago but the lake of certain features prevented me from  completing the migration, this time was completely different.

Restoring WordPress Application on OpenShift:

1.Create Vanilla WordPress on OpenShift

The first step, after creating OpenShift Free account and setting up rhc command line tool is to create a vanilla WordPress application. There are some nifty things OpenShift does here during App deployment that I might want to discuss on another post.

The creation of a vanilla WordPress basically boils down to a single command:

rhc app create wordpress php-5.4 mysql-5.5 --from-code=

2. Restore Files Including : Themes, Plugins, and Uploads

If rhn setup was completed successfully you can now SSH into the application. I used scp to restore my original themes, Plugins, and Uploads. The important piece of information here is the path and directory structure  the application uses to store themes, plugins, and uploads.

scp berezins_public_html.tar.gz <USER_ID><USER_ID>/app-root/data

[arthur@boxster981 ~]$ rhc ssh arthur
Connecting to <USER_ID> ...
[ USER_ID]\> cd app-root/data/
[ data]\> tar xzf berezins_public_html.tar.gz

3. Restore Database

To import the Database we need to add  phpMyAdmin cartridge to the application:

[arthur@boxster981 ~]$ rhc add-cartridge phpmyadmin-4 --app arthur

This will create a phpMyAdmin cartridge to the application, and output the admin username and password, so from this point you can log-in  to the database and  import the backed-up data to the existing database.

4. Extra credit: Redirect DNS

The URL OpenShift provides to access the Application is nice, but it would be a lot nicer to use existing domain name. Here’s a great post discussing the limitations and ways to point existing domain names to the OpenShift application.

In short you would have to add an alias to the application:

[arthur@boxster981 ~]$ rhc alias add arthur

Then create a new CNAME record for the domain, that would point www  sub domain  to the OpenShift application:

Screenshot from 2014-12-24 16:38:21


Share If You Care

1 Comment on Running On OpenShift after Hosting held Hostage

  1. I’m newbie to I’m trying to create a blog at and i have been done with it. I’m good at SSH, so, is there any other way to login to upload my data (like themes, plugin, … ) to rhcloud account by FTP?

What do you think about this?