build wordpress on OpenShift

OpenShift is a cloud service provided by Redhat. It provides three small gears of service. I think it's enough for my website which is build with wordpress. I placed my site on Amazon before it's on OpenShift. However, OpenShift is place on Amazon.

After registered on the openshift, It would send you an email for activating your account. Once you active your account, you can start your OpenShift journey.

When you signed in firstly, you will see the following:

Choose your application template -- wordpress (2) as the above picture shows. Then you can see:

At the Public URL, fill in your application (2) and name space (3). The name space is unique in OpenShift. Then you click the button "Create Application". Now you see:

The mysql database and user password (1), your site (2), and SSH public key (3) should be pasted here. (how to generate SSH key, please google it)

And That's OK for your first OpenShift site. If you want to start a new wordpress, you type your web address in your browser to start your blog.

If you just want to transfer your wordpress from other virtual host, you should upload your database backup file to the cloud. Since the OpenShift uses git for management, you should download the full site by:

$ git clone YOUR-GIT-RESPOSITORY # clone your cloud site
$ cd YOUR-APP/php # to your application folder of php
$ cp YOUR-DATABASE-BACKUP-FILE # copy your database backup file
$ git add YOUR-DATABASE-BACKUP-FILE
$ git commit # comment
$ git push # update your files
$ ssh YOUR-SSH-CLOUD-SITE # secure connect to your cloud site
\> cd  php-5.3/repo/php/
\> gzip -d YOUR-DATABASE-BACKUP-FILE.sql.gz #unzip your data file if you gzipped it
\> mysql --default-character-set=utf8 -p -u PASSWORD USER < YOUR-DATABASE-BACKUP-FILE.sql

Then you can see your site. If you want to use your own domain, you should use the CNAME record for forwarding, and delete the A HOST record.

The last thing you should do is make alias for your site (here, I show you the commands when I use CentOS 6.3):

$ sudo yum install rubygems
$ rhc setup
$ rhc app show YOUR-APP-NAME # show your app information
$ rhc alias add YOUR-APP-NAME YOUR-DOMAIN # make alias for your app
$ rhc app show YOUR-APP-NAME # show your app information, and you can see the alias appears
$ rhc app restart -a YOUR-APP

You should use your own domain name in minutes.

Reference
[1] OpenShift User Guide. https://access.redhat.com/knowledge/docs/en-US/OpenShift/2.0/html/User_Guide/index.html

   Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.