Create Bluemix PHP application
Login into Bluemix (https://console.bluemix.net/dashboard/apps)
Open the catalog (https://console.bluemix.net/catalog/) and create a CloudFoundry application using the PHP Buildpack
Fill the applicatoin name field, in this recipe we’re going to use ‘WordPressSample‘ as application name
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.
Create MySQL database in Bluemix
Click on the Catalog link at the right-top of the page.
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.
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.
You’ll see a dialog that will ask you the restage the application, push Restage and continue.
You can verify that the new MySQL database service was linked to the PHP Application created previously.
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).
The sample is:
This url value is composed of the following fields, we’ll need to use the values of these fields in the next steps.
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.
This is the default template of ToolChain for Continuous delivery.
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.
Click on the Eclipse Orion Web IDE box.
This is the initial Orion perspective
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).
The result is a new directory called wordpress, as you can see this content locates our product under /wordpress path.
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:
Rename wp-config-sample.php to wp-config.php and edit its mysql configurations using the values copied in the previous step.
Deploy the application using the button with the play icon (Triangle pointing to the right) in the top bar of the IDE.
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.
Login to http://wordpresssample.mybluemix.net/wordpress/wp-login.php with the purpose of verify the result
Look at the administration panel
Check the main application with the default post
The recipe is completed, you’ve got your WordPress instance running in Bluemix!!!
This recipe shows that is simple and possible build an environment for WordPress in Bluemix.
- Add monitoring and/or auto-scaling services.
- Work with Continuous Delivery features to build a DevOps environment. Continue with this recipe Deploy and configure WordPress in Bluemix