Acquia DevCloud - Local development environment setup

  |   Source
Acquia Dev Cloud provides Drupal-optimized hosting with professional administration tools. It includes three environments for staged deployment and can be managed through multiple interfaces.

This will show you how to set up your local development environment to work with DevCloud.

From an existing site:

Make sure you know the name of the user for the Administrator of the site (Admin, admin, administrator, etc)

git clone the codebase

create a local db

create a multisite dir, copy default.settings.php to settings.php, create the files dir, chmod 777 settings.php files

modify the root .gitignore file to include the new multisite directory

add the hostname to the hosts file

go to the local and and run the install,

download the Drush utilities from DevCloud and untar in the .drush directory

Modify the new file as below:

<?php

// Site dastagg2, environment dev
$aliases['dev'] = array(
  'parent' => '@parent',
  'site' => 'dastagg2',
  'env' => 'dev',
  'root' => '/var/www/html/dastagg2.dev/docroot',
  'remote-host' => 'srv-1450.devcloud.hosting.acquia.com',
  'remote-user' => 'dastagg2',
  'uri' => 'dastagg2dev.devcloud.acquia-sites.com',
  // this is a line you will have to add
  'path-aliases' => array(
    '%dump-dir' => '/mnt/files/dastagg2dev/import')

);
// Site dastagg2, environment test
$aliases['test'] = array(
  'parent' => '@parent',
  'site' => 'dastagg2',
  'env' => 'test',
  'root' => '/var/www/html/dastagg2.test/docroot',
  'remote-host' => 'srv-1450.devcloud.hosting.acquia.com',
  'remote-user' => 'dastagg2',
  'uri' => 'dastagg2test.devcloud.acquia-sites.com',
  // this is a line you will have to add
  'path-aliases' => array(
    '%dump-dir' => '/mnt/files/dastagg2test/import')

);
// Site dastagg2, environment prod
$aliases['prod'] = array(
  'parent' => '@parent',
  'site' => 'dastagg2',
  'env' => 'prod',
  'root' => '/var/www/html/dastagg2.prod/docroot',
  'remote-host' => 'srv-1450.devcloud.hosting.acquia.com',
  'remote-user' => 'dastagg2',
  'uri' => 'dastagg2.devcloud.acquia-sites.com',
  // this is a line you will have to add
  'path-aliases' => array(
    '%dump-dir' => '/mnt/files/dastagg2/import')
);
// This is the included portion to connect to      the local environment
// Site dastagg2, environment local
$aliases['local'] = array(
  'parent' => '@parent',
  'site' => 'dastagg2',
  'env' => 'local',
  'root' => '/Users/dastagg/develop/websites/php/drupal/devcloud/dastagg2/docroot',
  'uri' => 'dastagg2.dev',
  'path-aliases' => array(
    '%dump-dir' => '/tmp')
);

Now that your tools are in place, you can synchronize the database and files from the Acquia Cloud environment back to the local Dev Desktop.

First, get a copy of the database using the drush sql-sync command. Now that the aliases are in place, you can simply run the following drush command from the terminal window:

drush sql-sync @dastagg2.prod @dastagg2.local --no-cache --sanitize

Be sure to substitute the proper @[subscription].[site].[environment] string to match what's in the Drush aliases file. Note that the last two items are optional. The --no-cache ensures that Drush is always making a current backup of the database—by default, it won't if there's a version less than twenty-four hours old saved already—and --sanitize resets passwords and email addresses in the local copy. This is a good idea if you're copying real production data.

Next, get a copy of the files using the drush rsync command:

drush rsync @dastagg2.prod:%files/ @dastagg2.local:%files

There may be an issue with this due to permissions on the local machine. If you see something like this:

Do you really want to continue? (y/n): y

rsync: failed to set times on "/Users/dastagg/develop/websites/php/drupal/devcloud/dastagg2/docroot/sites/dastagg2.dev/files/styles": Operation not permitted (1)

rsync: failed to set times on "/Users/dastagg/develop/websites/php/drupal/devcloud/dastagg2/docroot/sites/dastagg2.dev/files/styles": Operation not permitted (1)

rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(1400) [generator=2.6.9]

Could not rsync from dastagg2@srv-1450.devcloud.hosting.acquia.com:/var/www/html/dastagg2.dev/docroot/sites/default/files/ to [error]

go to the docroot/sites/<localver>/files dir. and issue a command similar to this:

sudo chown -R dastagg:dastagg styles

and re-run the rsync command.

Now, you should have a complete replica of the Acquia Cloud environment on your Dev Desktop.

There are two more things, though, to do to ensure things are running smoothly:

Clear the cache by executing the following:

drush @dastagg2.local cache-clear all

The second thing to do relates to the administator password. If you used the --sanitize option with the database sync, you'll need to get a new admininstrator password. You can do this with the drush user-login command:

drush @dastagg2.local user-password admin --password="pass"
Comments powered by Disqus