Moving an existing site into

A walk through my first Platform experience with steps on how to avoid problems if you need to upload your local version into it. Lots of hints to get it right the first time!


If you are in a hurry and only need a recipe, please head to the technical part of the article, but I would like to start sharing a bit of my experience first because you might be still deciding if Platform is for you.

I decided to try Platform because a friend of mine needed a site. Do to several reasons I didn't want to host it on my personal server. But I didn't want to run a server for him either. I wanted to forget about maintaining the server, keeping it secure or do upgrades to it.

So I started thinking about options for small sites:

The list is not fair in terms of what's being offered, the offer is quite different. But I used all of these before for different projects. Only one left to try was Platform.

So going over above list with a fine cone:

  • I discarded RH Openshift because I wanted a solution, not just running an application. Others option offer caching servers too which does speed up things significantly.
  • Aberdeen: Used it before, works, but focused on the Europe market.
  • Acquia is easy to use, there was a comparable option, but price was still higher.
  • Pantheon: I've used it and like it, but the pricing was a bit risky. 25USD option was had traffic limits, the risk of needing the 100USD option was real.

Since I've been hearing very good things about Platform, the comparison on price/specs, and my appetite for new things, I decided to give it a try.

The Experience

Platform do not have a free option, only way to try/use is to pay for a site. So it was a bit of a jump from a cliff. Even had a couple of rough moments while fighting to get it online when I thought it wasn't the right choice. I must say I'm more used to sysadmin for dummies interfaces, this is a programmer oriented environment. In any case as with the others once you learn its perks, the offer balance out. Not having to deal with sysadmin stuff is great to avoid charging for support and OS upgrades to your clients and focusing on Drupal alone. They provide lots of documentation, which is quite useful. But some how I failed to get things running using just that, so I had to lean a bit on their online support. The time to respond was reasonable, and support was really good.

I would compare their approach to RH Openshift platform offering. Price is a bit higher, but final service is better. Along with hosting Drupal (or any other PHP app) they provide Solr search, Redis cache and a CDN caching network). So it is a more complete PaaS solution. I haven't run a production Drupal on RH Openshift, but given my experience I wouldn't risk running Drupal without a proper caching mechanism.

Any side effects? Well... Given I'm more familiar with Acquia or Pantheon service, I found a bit annoying the time you have to wait after every git push... Each time you do a push your application needs to be packaged, configured and delivered. So you end up with a bit of delay between you push something and are able to see it online. This happens with other platforms, but I found it a bit more noticeable. I guess Platform targets programmers as their main customer, so having a local environment would be a plus.

Overall I found the experience positive, but a bit involved. If you want an easy solution I must recommend against it, but hopefully this tutorial and all their documentation will help you to cross over the bridge. And keep in mind that's only the first step, then it is just a new way of launching a site in Drupal.

I haven't launched the site yet, so I yet to see performance of it. But given the caching approach and different services provided I think it will be ok.

The How

I guess things are easier if you don't have a process before and follow their workflow 100%. Since I had prior experience I decided to build the site locally first, and then publish online. How hard it could be? Well... Not hard, but has its perks.

So here are the steps if you are pushing your local Drupal 7 site to Platform:

  1. First thing is to add your key and start a GIT repo (or upload your current GIT repo). More on the repo on last steps, but you need to get your SSH key into as the first step to gain access to it using GIT, SSH, etc...
  2. Then you should write your own "" file, here is my example:
    name: drupal
    type: php:5.6
        flavor: drupal
        database: "database:mysql"
        solr: "search:solr"
        redis: "cache:redis"
        document_root: "/"
        passthru: "/index.php"
          # robots.txt.
          - /robots\.txt$    
          # CSS and Javascript.
          - \.css$
          - \.js$
          # image/* types.
          - \.gif$
          - \.jpe?g$
          - \.png$
          - \.ico$
          - \.bmp$
          # fonts types.
          - \.ttf$  
    disk: 2048
        "/public/sites/default/files": "shared:files/files"
        "/tmp": "shared:files/tmp"
        "/private": "shared:files/private"
        # We run deploy hook after your application has been deployed and started.
        deploy: |
            cd public
            drush -y updatedb
            spec: "*/20 * * * *"
            cmd: "cd public ; drush core-cron"
  3. We also need to add MySQL service (among others) to our application. So we need to add another file to the repository: ".platform/services.yaml":
      type: mysql:5.5
      disk: 512
        type: solr:4.10
        disk: 512
        type: redis:2.8

    This is actually one of the good things about using, you can have your Drupal with SOLR+Redis at the same cost. When using search on your site SOLR does really help, and when configured in Drupal Redis can speed up your site's logged in response time (it is similar to Memcache).

  4. We also need to add the domain, this is done by adding the file ".platform/routes.yaml":
        type: upstream
        upstream: "drupal:php"
        type: redirect
        to: "http://www.{default}/"
  5. Now you need to configure Drupal to use platform DB service. You do this by customizing your settings.php, Platform will automatically create a "settings.local.php" file which will connect you to the DB. So replace your "settings.php" with:
    $update_free_access = FALSE;
    $local_settings = dirname(__FILE__) . '/settings.local.php';
    if (file_exists($local_settings)) {
  6. And we are ready to start copying things across. I will being with the DB copy. There are other options, but I will explain using an SSH connection:
    scp mysitesdb.dump.gz [PROJECT-ID]-[ENV]@ssh.[REGION]
    ssh [PROJECT-ID]-[ENV]@ssh.[REGION]
    zcat tmp/mysitesdb.dump.gz | mysql -h database.internal main
    rm tmp/mysitesdb.dump.gz
  7. To get your code into the platform git repo you'll need to create/push it:
    cd mysite/code
    git init
    git remote add platform [PROJECT-ID]@git.[REGION][PROJECT-ID].git
    git add --all
    git commit -m "Initial commit of My Project"
    git push

    It is important to know that each git push trigers your app building by platform. So the push will take more than you are used to. It won't only push, but also build the whole application for you on each push.

  8. To import the files you can use rsync:
    rsync -r my/local/files/. [PROJECT-ID]-[ENV]@ssh.[REGION]
  9. Finally we will need to rebuild the site registry:
    ssh [PROJECT-ID]-[ENV]@ssh.[REGION]
    drush dl registry_rebuild --destination=/app/tmp
    sed -i 's/, define_drupal_root()/, '"'"'\/app\/public'"'"'/' /app/tmp/registry_rebuild/registry_rebuild.php
    cd /app/public
    php ../tmp/registry_rebuild/registry_rebuild.php

Following these steps I ended up with my local version of the site running on platform. Process for Drupal 8 is quite similar, you definitely don't need the final step. Also I recall a simpler setup for settings.php, but it doesn't differ much from the above.

Main gotchas for me where adding normal files (CSS, JS & images) to the "" file within the "whitelist" section and took me a while to be able to run from proper DB (by creating custom setting.php shared above). In both situations support took a bit of time, but got me into the right track.

There is lot of documentation, but I would like to flag the "Getting started for the impatient" because it is in line with this blog post. Didn't solve all my issues, but it is a nice brief of the whole thing.

Hope this helps someone out there. I know I looked for prior experiences and found little information but the docs.