One of my goals of today was to figure out how to deploy Wordpress to Cloud Foundry. I figured this was a pretty simple goal, but alas there is a trick to it.

Note: I deployed the following to Pivotal Web Services.

  1. Set up your MySQL service instance. To use the PWS ClearDB (MySQL) free tier:
    cf create-service cleardb spark NAMEofINSTANCE
  2. Download the latest version of Wordpress:
    wget http://wordpress.org/latest.tar.gz
    • Note: If you are running Mac OS X you can install wget with Homebrew. I did not have success using curl (even with -O) for the download.
  3. Uncompress the file:
    tar xfz latest.tar.gz
  4. Go into the new wordpress directory:
    cd wordpress
  5. Generate the secret keys from the Wordpress Secret Key Service
  6. Populate the keys into the appropriate section of the wp-config.php file.
  7. Add the database credentials to the wp-config.php file.*
  8. Add a composer.json file and include the mysqli extension.**
  9. Deploy the application using dmikusa's PHP buildpack.
    • If you need to add persistent storage, I recommend using dmikusa's manifest as a template.

* - If you are using PWS, you can view the database credentials by doing the following:
1. Log into PWS and navigate to the org & space that conatins your app. Click "Manage" next to the service instance (this will open a new window/tab):

2. Click on the database name:

3. Go to Endpoint Information:

The parameters needed for wp-config.php (with the info populated from above) are:

db name ad_a448706f10da344
db user b37917c0af0c2a
db password 6858192d
hostname us-cdbr-east-05.cleardb.net

** - The composer.json file should be as follows:

{
  "require": {
    "ext-mysqli": "*"
  }
}

To view my account of figuring out this seemingly simple process, please head over here.