Migrating WordPress-On-Bluemix’s Object Storage

Share: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditEmail this to someonePrint this page

Migrate your WordPress Object Storage

Recently, IBM Object storage transition from version 1 to version 3. The major change that occurred was the authentication mechanism. This altered how we had to go about offering object storage as a plugin to our ‘wordpress on bluemix’ app.

In this tutorial, i will walk through the step required to move from IBM Object Storage v1 to IBM Object Storage v3.

What you should currently have:

You should see your three bluemix services: Object Storage v1, ClearDB, and Send Grid.

WPV1Initial

Step 1 – Get all of your old media:

Migration Steps

Step 2 – Unbind and Rename V1 Service:

The name must also change to make way for the new v3 service.

unbindV1

Step 3 – Add new V3 Service:

Call it “myObjectStorage” or whatever your OS V1 instance was named.

addService

OSv3

Screen Shot 2015-11-30 at 5.24.00 PM

Step 4 – Return to Dashboard and Delete app:

BE SURE NOT TO DELETE YOUR SERVICES (uncheck the boxes)

Screen Shot 2015-11-30 at 5.25.53 PM   Screen Shot 2015-11-30 at 5.27.10 PM

Step 5 – Go to DevOp Services and log in:

Under Projects, find your application and click into it

Step 6 – Click Edit Code:

Screen Shot 2015-11-30 at 5.31.15 PM

Step 7 – Edit manifest.yml to look like this:

Note it is case sensitive


declared-services:
myObjectStorage:
label: Object-Storage
plan: Free
myClearDB:
label: cleardb
plan: spark
mySendGrid:
label: sendgrid
plan: free
applications:
– name: WP-adlewitt-OSv1
memory: 256M
instances: 1
buildpack: https://github.com/cloudfoundry/php-buildpack
services:
– myObjectStorage
– myClearDB
– mySendGrid
host: <your-app-name>

Step 8 – Edit composer.json to look like this:

Note: you can just copy paste

{
“repositories”: [
{
“type”: “vcs”,
“url”: “git@github.com:ibmjstart/wp-bluemix-sendgrid.git”
},
{
“type”: “vcs”,
“url”: “git@github.com:ibmjstart/wp-bluemix-objectstorage.git”
},
{
“type”: “vcs”,
“url”: “git@github.com:ibmjstart/wp-bluemix-config.git”
},
{
“type”: “composer”,
“url”: “http://wpackagist.org”
},
{
“type”: “vcs”,
“url”: “https://github.com/php-opencloud/openstack.git”
}
],

“scripts”: {
“pre-install-cmd” : [
“curl https://api.github.com/rate_limit”
],
“post-install-cmd” : [
“mv vendor/ibmjstart/wp-bluemix-config/mu-plugins htdocs/wp-content/mu-plugins”,
“mv vendor/ibmjstart/wp-bluemix-config/.user.ini htdocs”,
“mv vendor/ibmjstart/wp-bluemix-config/wp-config.php htdocs”,
“mv vendor htdocs/vendor”,
“mv lib/.htaccess htdocs”
]

},

“require”: {
“ext-gd” : “*”,
“johnpbloch/wordpress” : “4.3.*”,
“ibmjstart/wp-bluemix-sendgrid” : “dev-master”,
“ibmjstart/wp-bluemix-objectstorage” : “dev-master”,
“ibmjstart/wp-bluemix-config” : “dev-master”,
“wpackagist-plugin/stops-core-theme-and-plugin-updates”: “*”,
“wpackagist-plugin/sendgrid-email-delivery-simplified”: “*”,
“wpackagist-plugin/wp-super-cache” : “*”,
“wpackagist-theme/twentyfourteen” : “*”,
“wpackagist-theme/twentythirteen” : “*”,
“wpackagist-theme/twentytwelve” : “*”
},

“extra”: {
“wordpress-install-dir”: “htdocs”,
“installer-paths”: {
“htdocs/wp-content/plugins/{$name}/” : [“type:wordpress-plugin”],
“htdocs/wp-content/themes/{$name}/” : [“type:wordpress-theme”]
}
},
“minimum-stability” : “dev”,
“prefer-stable”: true
}

Step 9 – Edit .bp-config->options.json:

Change php_version to match

“PHP_VERSION”: “{PHP_56_LATEST}”

Step 10 – Re-deploy your app:

click the play button to re-deploy your app. This will recreate your app using the proper buildpack and php version.

Screen Shot 2015-11-30 at 5.41.02 PM

Step 11 – Verify all of your services are bound to your app:

If not, click ‘bind a service’ and bind the object storage v3 we created earlier.

Screen Shot 2015-11-30 at 5.42.52 PM

Step 12 – Open your app:

Now open your app by clicking the route url. If wordpress pops up and tells you to update, just click okay.

Step 13 -Go to your media tab and upload all of your old media:

Screen Shot 2015-11-30 at 5.46.35 PM

Step 14 – Bad News:

Now for the bad news, go to each of your old posts and remove the outdated image and insert your newly uploaded image.

Share: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditEmail this to someonePrint this page
Alex Lewitt
Alex is currently a software developer co-op on the IBM jStart Team and is pursuing a BS Degree in Computer Science at the University of Florida. Alex's main focus for the past few months has been on Apache Spark, Apache Spark Machine Learning, and IBM BlueMix.
Alex Lewitt
Alex Lewitt
GitHub

3 comments

  • Percy Mamedy

    Hello, I am using Object storage v3 on bluemix with wordpress. My homepage contains a lot of photos I am facing some performance issue with it, my site lags when the plugin is activated as it is replacing all the links one by one for each picture.

    It takes almost 1 minute to render the homepage. Other pages with pictures are also affected. is there any way to counter this problem another plugin maybe.

    Thanks for your help.

  • CD

    Hi Alex.

    Thanks for the great post.

    I’ve managed to get everything working but am stumped on a particular task.

    I want to password protect the ‘htdocs’ folder and have tried adding the relevant code to the already existing htdocs/.htaccess file. I have also placed the .htpasswd file in the same dir with ‘username:encrypt$dpa$sword’.

    Unfortuntly, when I now load the URL in a browser, I get a blank page. Any ideas on where I am going wrong?

  • Yeah, the response time seems to increase 1 second per each image added. Not very useful :/

Leave a Reply

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