Moving to OpenShift

It’s about half an year I want to move my blog away from Heroku. It’s the best PaaS I ever used but the free plan has a huge limit: the dynos idle. In a previous post i talked about how to use Heroku to build a reverse proxy in front of AppFog to avoid theirs custom domain limit but the idle problem is still there. My blog has less than 100 visits per day and almost every visitor has to wait 5-10 seconds to view home page because dynos are always idle.

openshift_logoToday I decided to move to another platform suggested by my friend @dani_viga: OpenShift. It’s a PaaS similar to Heroku which use Git to control revision and has a similar scaling system. And the free plan hasn’t the idle problem and it’s 10 times faster!

I created a new application using the following cartridge: PHP 5.3, MySQL 5.1 (I’d like to use MariaDB but cartridge is still in development and I couldn’t install it) and phpMyAdmin 3.4. They require a Git repo to setup application and provide a WordPress template to start. I used it as template moving code of my blog into /php directory.

The hard part was to migrate my PostgreSQL database into the new MySQL. To start I removed PG4WP plugin following installation instruction in reverse order.

Then I exported my PostgreSQL database using heroku db:pull command. It’s based on taps and is really useful. I had some problems with my local installation of MySQL because taps has no options about packet size and character set so you must set them as default. I added a few line to my.cnf configuration:

# enlarged, before was 1M
max_allowed_packet = 10M
# default to utf-8
skip-character-set-client-handshake
character_set_client=utf8
character_set_server=utf8

At the end of the pull my local database contains a exact copy of the Heroku one and I can dump to a SQL file and import into the new MySQL cartridge using phpMyAdmin.

The only problem I had was about SSL certificate. The free plan doesn’t offer SSL certificate for custom domain so I have to remove the use of HTTPS for the login. You can do in the wp-config.php setting:

define('FORCE_SSL_ADMIN', false);

Now my blog runs on OpenShift and by now seems incredibly faster 😀

  • neychang

    Great !,I will try openshift by your way !thanks

  • Raphael Negrão

    Just a heads up: you can get around the idle dyno issue on Heroku. Two ways are shown here.

    • Yes, I know. There are many workarounds and I used some of them in the past.
      Anyway I still prefer a provider who don’t have this limit 🙂

  • Madni

    The only problem I had was about SSL certificate. The free plan doesn’t
    offer SSL certificate for custom domain so I have to remove the use of
    HTTPS for the login. You can do in the wp-config.php setting:

    how did you do it.
    i repeated the instructions in my wordpress install on OS, but still i am getting the same ssl https error.

    even messed up with the .htaccess file .no use.

    what is your domain name?

    is it http://“blog”.andreamostosi.name?

    or http://“www”.andreamostosi.name

    are you getting that ssl error?
    if you have a workaround for that, please tell me.

  • Madni

    You should not proceed, especially if you have never seen this warning before for this site.
    Proceed anyway or Back to safety

  • Madni

    i did change this in wordpress config file
    FORCE_SSL_ADMIN’, false
    but it remained to be the same error whenever i tried to open any of the Sample Pages for example.
    all links are prefixed with an https://
    had they been http:// only, things would had been different.

  • Madni

    are you still on Openshift with this blog http blog andreamostosiname
    your links are all having http instead of https

    kindly sort the problem for me too.
    Would be thankful

  • Madni

    hi again Andrea.
    the thing is:
    i have set up a wordpress blog on openshift
    spent a lot of time building its infrastructure up (not yet started posting)
    but when i checked it on other browsers
    i came to know that whenever someone is going to put its address in the browser’s address bar like this

  • Madni

    https my address
    the browser is going to present an SSL mismatch error
    telling the user that

  • Madni

    i cant make comments here, man
    what is the problem?
    that is why i have send you these little pieces of comments
    kindly provide me with some better thing to communicate with you.

    • I’m sorry man but I’m not your help desk 😉
      My standard installation of WordPress with this simple edit, works fine.
      If you need more support you can drop me a mail: andrea.mostosi@zenkay.net 🙂

      • Madni

        Yeah I know I am bothering you.
        Email sent for help.

  • Emanuel Damián Chura Flores

    I have the same issue as Madni, changed the wp-config.php, setted FORCE_SSL_ADMIN and FORCE_SSL_LOGIN to false and still redirecting to HTTPS. It may be Openshift WordPress version modified to do this and pay for the Silver plan?

    • Setting FORCE_SSL_ADMIN to false simply says WordPress to use HTTP instead HTTPS so I don’t think is an OpenShift mod. Anyway I’m still using last version of WordPress with this simple edit to run this blog and I can’t understand why yours don’t work… Did you try with different browser o after cleaning up cache?

    • How did you update wp-config.php? By logging in with ssh then editing app-root/data/current/wp-config.php or by updating .openshift/config/wp-config.php then pushing the code?

      If you did the latter, then it won’t work unless you have edited .openshift/action_hooks/deploy and added some code there that updates the wp-config file like this: http://www.andyebrown.com/2014/03/27/openshift-wordpress-cartridge-with-custom-wp-config-php/

      And the easiest way is to just login with ssh and update it yourself.

      • I can’t understand why you should update your wp-config.php using SSH.
        If your wp-config.php is versioned into php/ directory your updates are deployed with the rest of your code. I created wp-config.php using wp-config-sample.php as example (I didn’t use the 5 minutes installation wizard) then I versioned it (https://github.com/zenkay/personal-blog/blob/master/php/wp-config.php) and everything works fine…

    • Madni

      this comment space never sends me no email updates when someone replies to me in here. anyways i am happy to announce that i have been successful in overcoming the problem of directing traffic to http://www.howtech.ga notice the http in the address.
      the problem was with the wordpress configuration. and now the things are smooth as fluff.

  • Pingback: Ian Lacerda | Blog WordPress gratuito no Open Shift – Red Hat()

  • Pingback: Blog infrastructure update: HHVM and MariaDB - Useful StuffUseful Stuff()