Community

Deploy a Drupal Application on IBM BlueMix

Share this post:

Drupal is a free and open-source content management framework written in PHP. It is used as a back-end framework for at least 2.1% of all websites worldwide ranging from personal blogs to corporate, political, and government sites including whitehouse.gov and data.gov.uk. It is also used for knowledge management and business collaboration

In order to have Drupal work on the IBM BlueMix Platform, do the following:

      1. Download a current stable version of Drupal from https://drupal.org/project/drupal.
      2. Untar or unzip the download (e.g. tar -xzf drupal-7.26.tar.gz) and change to the base directory (e.g. drupal-7.26).
      3. One of the most important files on a Drupal site is the settings.php file.  This file is located in the default subfolder of the sites root directory within a Drupal installation and contains the Drupal website’s base configuration details, such as database connection information, multisite options and login details.  For the BlueMix platform, database connection information is dynamically generated during service instantiation and shared within environment variables.  Therefore, a config file structured to read the MySQL environment variable details is necessary. Insert or replace the settings.php within the Drupal */sites/default directory with the one in this repository.
      4. Copy this file into the folder <base_directory>/sites/default
        bash-3.2$ <span style="color: #000080;">cp settings.php drupal-7.26/sites/default<br /></span>
      5. Using the cloud foundry v6 cli, login to BlueMix and install Drupal with a PHP buildpack.
        <<random number>> is user provided input.
        # Step 0: cf login -a &lt;api target url&gt; <br />$ <span style="color: #000080;">cf login -a https://api.ng.bluemix.net</span> <br /><br /># Step 1: cf create-service &lt;service name&gt; &lt;service plan type&gt; &lt;unique service instance name&gt;<br />$ <span style="color: #000080;">cf create-service mysql 100 mysql-drupal-service</span><br /><br /><span style="font-size: 12px;"># Step 2: cf push &lt;unique application name&gt; -b &lt;url to php buildpack&gt; --no-manifest (No manifest.yml present) --no-start (Don't start application after push)<br /></span><span style="font-size: 12px;"># Buildpack choices:  <br /></span><span style="font-size: 12px;">#  Basic - https://github.com/joshisa/cf-php-build-pack.git - Modified to include the gd PHP extension<br /></span><span style="font-size: 12px;">#  ZLib Support (Gzip compression)- https://github.com/cyberdelia/heroku-buildpack-php.git<br /></span><span style="font-size: 12px;">$ <span style="color: #000080;">cf push mysql-drupal-&lt;&lt;random number&gt;&gt; -b https://github.com/joshisa/cf-php-build-pack.git --no-manifest --no-start</span><br /><br /></span><span style="font-size: 12px;"># Step 3: cf bind-service &lt;unique application name used in Step 2&gt; &lt;service instance name used in Step 1&gt;<br /></span><span style="font-size: 12px;">$ <span style="color: #000080;">cf bind-service mysql-drupal-&lt;&lt;random number&gt;&gt; mysql-drupal-service</span><br /><br /></span><span style="font-size: 12px;"># Step 4: cf start &lt;unique application name used in Step 2&gt; (Start application)<br /></span><span style="font-size: 12px;">$ <span style="color: #000080;">cf start mysql-drupal-&lt;&lt;random number&gt;&gt;</span><br /></span>
      6. After the application is running on BlueMix, browse to http://<your_app_name>.ng.bluemix.net/install.php and complete the installation steps
      7. That’s it!.
Please note:  At this time, BlueMix does NOT provide persistent file storage. In order to have custom themes and plugins persist with your instance of Drupal, you should save those themes and/or plugins within the application folder prior to pushing your application.

FAQ

Q:  I’m encountering a PDOException: SQLSTATE[]: Base table or view not found error similar to below.  What’s going on here?

IncompleteInstall
A:  The drupal installation is incomplete.  Please complete all installation steps by browsing to http://<your_app_name>.ng.bluemix.net/install.php

SetupStartPage

More stories
May 7, 2019

We’ve Moved! The IBM Cloud Blog Has a New URL

In an effort better integrate the IBM Cloud Blog with the IBM Cloud web experience, we have migrated the blog to a new URL: www.ibm.com/cloud/blog.

Continue reading

May 1, 2019

Two Tutorials: Plan, Create, and Update Deployment Environments with Terraform

Multiple environments are pretty common in a project when building a solution. They support the different phases of the development cycle and the slight differences between the environments, like capacity, networking, credentials, and log verbosity. These two tutorials will show you how to manage the environments with Terraform.

Continue reading

April 29, 2019

Transforming Customer Experiences with AI Services (Part 1)

This is an experience from a recent customer engagement on transcribing customer conversations using IBM Watson AI services.

Continue reading