Overview

Skill Level: Any Skill Level

The purpose of the article is explain how to configure a Bluemix environment for Wordpress and how to install the product and avoid common issues of this process.

Ingredients

  • Bluemix account
  • Wordpress 4.8.1

The recipe assumes a basic knowledge of IBM Bluemix concepts, basic knowledge of PHP and Wordpress

 

Step-by-step

  1. Create Bluemix PHP application

    Login into Bluemix (https://console.bluemix.net/dashboard/apps)

    1-LoginToBluemix

    Open the catalog (https://console.bluemix.net/catalog/) and create a CloudFoundry application using the PHP Buildpack

    CatalogPHP

    Fill the applicatoin name field, in this recipe we’re going to use ‘WordPressSample‘ as application name

    CreatePHPApplication

    This application will be located under a space called ‘dev‘ representing a development environment. Push the ‘Create‘ button to finish the procedure.
    You can review the application’s resources in the ‘Overview‘ section, from this area you can reconfigure the amount of instances and memory assigned to it. Consider the use of monitoring and auto-scaling services to improve the access to the information about the performance and take advantage of the best strategy to balance cost and performance.

    PHPRuntime

  2. Create MySQL database in Bluemix

    Click on the Catalog link at the right-top of the page.

    GoToCatalog

    Then click on the Data & Analytics option in the left menu, look for Compose for MySQL and click on it to create an instance of this service.

    CatalogForCompose

    Fill the creation for, locating the service under the same sapce (‘dev‘ in our recipe) and change the value of Connect to combo field to WordPressSample, finally push the Create button at the end of the form.

    MySQLCreateForm

    You’ll see a dialog that will ask you the restage the application, push Restage and continue.

    RestageDialog

     

    You can verify that the new MySQL database service was linked to the PHP Application created previously.

    LinkedMySQL

     

    Click on the View credentials button of MySQL service box, then you’ll see a dialog with the service configuration and credentials in JSON format, look for the uri attribute and copy the value for future use (Alternatively, you can press the copy icon at the top-right side of the text area to copy all the content directly).

    MySQL-CredentialsDialogThe sample is:

    “uri”: “mysql://admin:PASSWORD@bluemix-sandbox-dal-9-portal.8.dblayer.com:29205/compose”

    This url value is composed of the following fields, we’ll need to use the values of these fields in the next steps.

    mysql://[USER]:[PASSWORD]@[SERVER]/[DATABASE]

  3. Enable Continous Delivery with Orion IDE

    At this point, we finished the Bluemix components creation, so we can proceed to upload the WordPress application to the Bluemix environment. There are several ways to do it, some of them are:

    • Get the base application package and push it with the Cloudfoundry or Bluemix CLI.
    • Prepare a GIT repository, configure an automated Pipeline, and deliver the content to the GIT repository for automated build & deploy.
    • Enable the ‘Continuous delivery‘ feature, and use the Online IDE (Orion) to deploy the files manually. This is the option of our recipe.

     

    Go to the PHP Application created in the first step, under the Overview section you’ll find and area called Continuous delivery, push the Enable button of this section.

    EnableContinousDelivery

    This is the default template of ToolChain for Continuous delivery.

    DefaultToolchain

    Scroll down the initial form and look for the Git Repos and Issue Tracking options, then change the value of Repository type to New and press the Create button.

    ToolchainGitOptions

    Click on the Eclipse Orion Web IDE box.

    OpenOrion

     

    This is the initial Orion perspective

    OrionIDE

  4. Prepare WordPress files and configuration

    Go to the top menu bar and click on File->Import->HTTP, you’ll see a small input bar at the top of the IDE, you need to fill it with ‘https://wordpress.org/latest.zip‘ and press Submit (Leave the ‘Unzip: *.zip files’ option checked).

    ImportWordpress

     

    The result is a new directory called wordpress, as you can see this content locates our product under /wordpress path.

    ImportedWordpress

     

    Make a right click on the root’s WordPressSample item and select New->Folder, assign .bp-config as name. Then use the same method to create the file .bp-config/options.json with the following content:

    {
    “PHP_EXTENSIONS”: [“bz2”, “zlib”, “curl”, “mcrypt”, “mysql”]
    }

    The final result is:

    PHPOptions

     

    Rename wp-config-sample.php to wp-config.php and edit its mysql configurations using the values copied in the previous step.

    WordpressConfiguration

     

    Deploy the application using the button with the play icon (Triangle pointing to the right) in the top bar of the IDE.

    DeployFromOrion

  5. Install WordPress

    Access to http://wordpresssample.mybluemix.net/wordpress/wp-admin/install.php and complete the installation. These are the screenshots of the wizard for this recipe.

    wordpress-step1

    wordpress-step2

    wordpress-step3

    Login to http://wordpresssample.mybluemix.net/wordpress/wp-login.php with the purpose of verify the result

    wordpress-step4

    Look at the administration panel

    wordpress-step5

    Check the main application with the default post

    wordpress-step6

    The recipe is completed, you’ve got your WordPress instance running in Bluemix!!!

    wordpress-step7

  6. Conclusion

    This recipe shows that is simple and possible build an environment for WordPress in Bluemix.

     

    Next steps

    • Add monitoring and/or auto-scaling services.
    • Work with Continuous Delivery features to build a DevOps environment that extends the result of this recipe.

Join The Discussion