Friday, August 26, 2016

Lessons learned from an Acquia migration

Lessons learned from an Acquia migration



Acquia is a popular Drupal hosting service, but I was surprised at how many "gotchas" I encountered when migrating a number of sites to their environment.  Ive listed them below (in no particular order) in case others find it useful.  Note: some of these are general Drupal issues rather than Acquia specific.


GOTCHA:
If you run into a cache issue (i.e. data is correct in the appropriate database table but doesnt show correctly in the UI and clearing caches via the Drupal admin UI doesnt work) you may need to clear memcache

GOTCHA:
If youre using drush sql-query in your post-db-copy Acquia Cloud Hook, you need to include the --database parameter for a multisite:

#!/bin/sh

site="$1"
target_env="$2"
db_name="$3"
source_env="$4"

drush @$site.$target_env sql-query "select * from node;" --database=$db_name


GOTCHA:
Make sure to disable modules before deleting them (especially Boost, since Acquia Purge will complain).  If, for whatever reason, that option isnt available, you can manually remove the database entry: delete from system where name = boost;

GOTCHA:
The default Developer role doesnt work with Acquia Dev Desktop 2.  You need to provide at least Senior Developer access.

GOTCHA:
Its not obvious how to change the Acquia Cloud list label:
  1. Login to Acquia Cloud
  2. Go to the Subscriptions tab
  3. Select the Subscription you would like to edit
  4. Click Edit
  5. Change the name

GOTCHA:
BlazeMeter is restricted to 40 tests and a 30-day trial.  Unlike other add-ons (which are not trials and dont have expiration dates), the BlazeMeter limited trial begins when you activate the add-on so be careful to activate it only when you are about to go live and need to run the required load test.  Also, if you have more than 40 sites, you can combine sites in a single test by including multiple site URLs.

GOTCHA:
When using Acquia Dev Desktop 2, previous installations of an older version of Drush may cause problems.  On Windows, check your PATH environment variable and on OS X check your ~/.bash_profile file for non-DevDesktop references to Drush and remove them.

GOTCHA:
git subtree has the potential to impact Acquia Remote Administration services.

GOTCHA:
Acquia Search issues: 1, 2, 3

GOTCHA:
In Acquia Dev Desktop 2, the common git error "Cannot push missing reference (4:-11)" is vague and unhelpful.  It basically means you need to do a git pull before a git push.

GOTCHA:
Stage File Proxy does not support subfolders within your Drupal user files directory. Any images or other files within subfolders will not be displayed correctly in the RA environment.  Update: This is possibly fixed in latest dev

GOTCHA:
New Relic is incompatible with PHP 5.6.  Use PHP 5.5 instead.

GOTCHA:
Multisites require additional New Relic configuration.  The sample settings.php Acquia snippet didnt work for me so I ended up using:

if (extension_loaded(newrelic)) {
  $exploded_path = explode(/, dirname(__FILE__));
  $site_domain = array_pop($exploded_path);
  newrelic_set_appname($_ENV[AH_SITE_ENVIRONMENT] ._. $site_domain, , true);
}

Note: "Custom app names defining individual sites are initialized later in the Drupal bootstrap process, so New Relic can not report on Drupal modules, views, and hooks on a per-domain basis when this method is used. This data is only available for the environment as a whole"

GOTCHA
Make sure to use the Acquia Dev Desktop 2 version 27 July 2015 or later to fix a Drush/OpenSSL bug.

GOTCHA:
If using the Acquia Drupal distribution profile, the status report may indicate theres a Drupal core update available when in fact you are running the latest core.  This is a known issue and "As a result, we often recommend moving away from the profile."

GOTCHA:
You may encounter periodic fatal errors (white screens) as a result of updating modules like CTools or Rules (for example, Fatal error: Class RulesAbstractPlugin not found in /.../docroot/sites/all/modules/contrib/rules/includes/rules.plugins.inc on line 11).  You need to download and run registry_rebuild to fix it.

GOTCHA:
Acquia cron commands are limited to 255 chars.  If you have a longer command, put it in a shell script and reference that instead.

GOTCHA:
Cloud hook scripts created on Windows machines dont have their executable bit set.  Heres the fix.

GOTCHA:
Cloud hook will revert all features on code deploy.  To keep an override (such as disable CSS/JS aggregation), use the "Lock" mechanism as described in the "Living with Overrides" section here.

GOTCHA:
Always include a version (e.g. "version = 7.x-1.0") with your Feature (otherwise the module_filter display is messed up).

GOTCHA:
The Acquia documentation for incompatible modules is incomplete.  Use this version instead.

GOTCHA:
Acquia Dev Desktop 2 uses a .gitignore default that prevents settings.php from being sent.  Create a sites/.gitignore file and add this line: !*/settings*.php

GOTCHA:
If you add a new site to an existing multisite Acquia Dev Desktop 2, you need to do an immediate code pull from dev after pushing to dev the very first time so your local settings.php file will be updated with the Acquia dev database credentials.

GOTCHA:
If memcache does not appear to be running or working, run /update.php

GOTCHA:
In Acquia purge, "the standard domain detection often can detect too many domains and may cause cross-site purging".  You need to identify the Acquia purge domains because otherwise it purges pages for all domains in a docroot!  Add this to your settings.php file:

if (isset($_SERVER[HTTP_HOST]) && (!empty($_SERVER[HTTP_HOST]))) {
  $conf[acquia_purge_domains] = array($_SERVER[HTTP_HOST]);
}    

GOTCHA:
The self-signed cert in Acquia Dev Desktop 2 still throws a Chrome intercept warning so its probably easiest just to disable HTTPS when working locally.

GOTCHA:
Its not currently possible for a single environment to have multiple elastic load balancers (ELBs) so youll need to unify all your multisite sites into a single cert: 1, 2

GOTCHA:
Features sometimes adds a "project = " line in the info file which causes the Drupal update check to look for it on Drupal.org.  Remove that line if it exists.

GOTCHA:
img style is stripped when using the "Limit allowed HTML tags" in /admin/config/content/formats/filtered_html  See 1, 2, 3

GOTCHA:
Picture integration with wysiwyg/ckeditor is not well documented

GOTCHA:
From Acquia tech support: "You cannot (or rather should not) point an A record (e.g. a bare domain like example.com) at an ELBs IPs because they are ephemeral. The bare domain has to point with an A record to the IP of the active balancer."

GOTCHA:
The core overlay module affects performance and can be a security risk.  Disable it.

GOTCHA:
rsync has a ~260 char filename limit (including path!) on Windows which can break Acquia Dev Desktop 2: 1, 2

GOTCHA:
Acquia Dev Desktop 2 local shortcuts and symbolic links should be excluded from git.  Create/edit a sites/.gitignore file and add these lines:

*.dd
*.lnk

GOTCHA:
Private files require additional configuration.

GOTCHA:
You can use the @sites alias, but it needs to come after the Acquia docroot alias.  For example:  drush @mycooldocroot.dev @sites cc all

GOTCHA:
Ad-blocking add-ons can affect page loading so check incognito mode before filing a help ticket.

GOTCHA:
The server time was 7 hours off of our local time so when we created a cron job to run at 10pm we were surprised to discover it was actually running at 3pm local time (during peak site traffic).  So, remember to run date on the server to check the time and adjust your cron jobs accordingly.

GOTCHA:
If you need SSL/TLS for your apex domain (aka "bare" or "naked" domain), such as example.com, youll need to purchase a managed DNS service that supports ALIAS or ANAME records.  Acquia has a great (albeit buried) guide for Amazons Route 53 service.

GOTCHA:
If you use SSL/TLS for your site and you use the acquia_purge module, you need to add a rather buried setting to your settings.php file.

GOTCHA:
If you use webform and a private file system path is configured, you need to add an additional settings.php setting to avoid zero-byte webform result downloads

GOTCHA:
If you use the Remote Administration (RA) service and Acquia Cloud Hooks youll likely run into conflicts.  Disable your hooks in the RA environment with:

if [ "$AH_SITE_ENVIRONMENT" != "ra" ]; then
# your code here...
fi


Available link for download