Answers.Body: <p>There are a few gotchas (and probably some I haven't run into). I moved one of my clients with about 40,000 contacts to Pantheon (business level plan) in October, and we've had pretty good success with it after ironing out a few major details.</p>
  
  <p>The biggest problem is Smarty. Since it compiles its templates into the file system (Valhalla), they tend to run slower than molasses in January in Siberia. The solution can be found here:</p>
  
  <p><a href="https://forum.civicrm.org/index.php?topic=35125.0;nowap" rel="nofollow">https://forum.civicrm.org/index.php?topic=35125.0;nowap</a></p>
  
  <p>The basic premise here is that loading compiled templates from Redis is going to be much, much faster than loading them from the file system. The thing you'll need to watch for with this is anything that uses Smarty now needs to bootstrap Drupal to have access to cache_set and cache_get for Redis. In general, you should keep anything PHP based (extensions, core file overrides, etc) in sites/all/something, not sites/default/files/...</p>
  
  <p>The second biggest thing we ran into was a problem with accessing extensions on business level and above plans (since they run multiple appservers). For some reason Civi likes to cache paths, so I had to write some custom code into the extension loader to account for that (and pop it back to the right path when it gets off track).</p>
  
  <p>The final big piece you'll need is Kalamuna's civicrm.settings.php modifications, which can be found here: <a href="http://blog.kalamuna.com/news/civicrm-pantheon" rel="nofollow">http://blog.kalamuna.com/news/civicrm-pantheon</a></p>
  
  <p>They're meant for D6, but I've found they work just fine with D7 (and you can go a step beyond and do the same path overrides for everything they don't, such as extensions).</p>
  
  <p>I can tell you from my experience, which started about a year ago, there are some headaches that come along with this, but the benefits of MultiDev and the security of not having to worry about the platform (at least for me) are worth it in the long run. This has sped up our development cycle significantly, and the reliability and lack of late evening trouble calls have been worth it. We've been running 4.4.x since January, and the number of headaches I've had that are platform related have been steadily dropping once you get through the first big problem above (Smarty).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T02:40:31.720Z
Answers.Text: Thanks Chris. Would you unpack this statement for me a bit more? _The thing you'll need to watch for with this is anything that uses Smarty now needs to bootstrap Drupal to have access to cache_set and cache_get for Redis. In general, you should keep anything PHP based (extensions, core file overrides, etc) in sites/all/something, not sites/default/files/..._ - you mean the contents of templates_c/* when you are saying "PHP based", or is that two separate statements?
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T02:42:51.987Z
Answers.Text: _The second biggest thing we ran into was a problem with accessing extensions on business level and above plans (since they run multiple appservers). For some reason Civi likes to cache paths, so I had to write some custom code into the extension loader to account for that (and pop it back to the right path when it gets off track)._ - I'd be happy to help get this in if you're keen to see it part of core. Want to open an issue on it @ https://issues.civicrm.org/ ? The hardcoded path fixity is something I'd love to see gone from CiviCRM.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T13:44:14.527Z
Answers.Text: There is already an issue for this: https://issues.civicrm.org/jira/browse/CRM-16618 -- looks like its going nowhere without funding and/or patches.
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-01T04:58:45.043Z
Answers.Text: Is Redis the only way aroung the Smarty issue? Redis is only available on the enterprise plan which is $75/month more than the personal plan that we are on.
Answers.UserDisplayName: Yossi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-06T15:08:37.357Z
Answers.Text: Regarding CiviCRM caching config, this issue changes they way Civi deals with config in 4.7: https://issues.civicrm.org/jira/browse/CRM-16373. Hopefully this will address the one concern about full paths getting cached.
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T02:25:46.880Z
Answers.LastActivityDate: 2015-08-06T02:25:46.880Z
Answers.UserDisplayName: Chris Grewe
Answers.Body: <p>Patheon also does not provide an ability to tune your database. Its database configuration is more tuned for CMS's like Drupal and Wordpress, and not for CRM's like CiviCRM which can have huge data storage requirements. </p>
  
  <p>Another aspect which I have difficulty with (though ultimately it doesn't matter too much) is the need to maintain the entire Drupal/Wordpress and CiviCRM codebase in Git.  It just seems like such a waste when the core files are readily available elsewhere.  But again, that's just a personal nit.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-17T19:29:53.850Z
Answers.LastActivityDate: 2015-09-17T19:29:53.850Z
Answers.UserDisplayName: DaveD
Answers.Body: <p>We have a few sites on pantheon running civicrm. 
  We started with the civicrm_starterkit. There were a few issues to iron out but Pantheon does save you the headache of worrying about hosting, and multi-dev environment goes a long way.
  Also with the kalabox from kalamuna, local development for pantheon sites is life changing.</p>
  
  <p>We updated the starterkit's civicrm 4.4 to 4.6 without any issues. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T02:49:33.190Z
Answers.LastActivityDate: 2015-08-06T02:49:33.190Z
Answers.UserDisplayName: Yossi
Answers.Body: <p>I'm currently testing a CiviCRM extension which regenerates cache (updates the file paths) when they change on Pantheon.</p>
  
  <p><a href="https://civicrm.stackexchange.com/questions/8779/cannot-redeclare-class-crm-core-config">What is the best way to override changes to CRM_Core_Config?</a></p>
  
  <p>It's a CiviCRM extension, which I'm happy to share if it works as expected.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-13T21:27:23.710Z
Answers.Text: I suspect [this question on Pantheon Power-Users](https://groups.google.com/a/pantheon.io/forum/#!topic/power-users/3kTPXgtKodI) (membership required to view) may be looking for the solution your CacheOff extension offers - would you consider publishing it for them? Shouldn't hurt for you to have more people testing it :)
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-12T09:46:52.533Z
Answers.LastActivityDate: 2016-01-12T09:46:52.533Z
Answers.LastEditDate: 2017-04-13T12:53:13.207Z
Answers.UserDisplayName: Adam
Answers.Body: <ol>
  <li>A bottle of aspirin</li>
  <li>A lot of patience</li>
  <li>A budget to migrate the site to another host</li>
  </ol>
  
  <p>I actually can't remember all the issues, but I know that Tommy and Sanjay have had continual trouble with folks on Pantheon. There have been problems running upgrades on their dev sites because they're underpowered.  Pantheon doesn't provide any cron except a <code>drush cron</code> every hour, so you have to have another server run cron for you if you want a decent frequency.  There have been other issues that don't immediately come to mind, but I have yet to see any advantage to using Pantheon.</p>
  
  <p>Fundamentally, it's just overpriced, gussied-up shared hosting. Anyone will do better with a VPS and their dev/staging/production sites set up in regular git repos.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T02:40:17.883Z
Answers.Text: This isn't a very balanced response. There are pros and cons to using Pantheon I've found. Since Pantheon focuses on Drupal and Wordpress officially it's not that fair to blame them for not working all the time with CiviCRM.
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T02:44:01.750Z
Answers.Text: Oh, they'll change file paths on alternate Tuesdays, except when Mercury is in retrograde, when it's each Friday. They also make no promises regarding your mail IP address, so you have to do external SMTP or you get to have fun configuring SPF for a moving target.
Answers.UserDisplayName: Andie Hunt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T02:46:40.530Z
Answers.Text: @herb no, you're right that it's not balanced. I don't think it's necessarily bad for what it is; I just know that what it is isn't good for CiviCRM.
Answers.UserDisplayName: Andie Hunt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T15:28:28.683Z
Answers.Text: Yes Pantheon changes its bindings for load balancing, but that's something that Drupal or Wordpress have no problem handling. So it means that out of the box CiviCRM doesn't account for that, but I've found small changes make it work. Regarding external SMTP this is something we *always* do on our own servers as well. SMTP services do a much better job anyway.
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T16:13:13.037Z
Answers.Text: @herb totally agree on SMTP in general, but for someone not using CiviMail, it can be overkill for just receipts and password reminders here and there.  My main feeling is that just because you *can* make it work doesn't mean it's worth the trouble when there are plenty of perfectly good hosting arrangements that don't require these workarounds.
Answers.UserDisplayName: Andie Hunt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T17:00:24.397Z
Answers.Text: The question is not really about whether Pantheon is "good" or not, since some developers already figure it's worth the tradeoffs. It all depends on your requirements.
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-20T00:08:01.563Z
Answers.Text: Just to counter this, we've been running Civicrm on Pantheon for more than 18 months, and after a few teething issues (patches in the other answers) it's running smoothly and reliably for us. Naturally it depends on your requirements, but it can and does work.
Answers.UserDisplayName: Owen Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-25T21:17:04.653Z
Answers.Text: @OwenKelly thanks for that patch! Sadly I'm having troubles getting it to work. It seems to me as if either not all the code is in the patch or I'm missing a step. The error I get: 
  
  >User error: Smarty error: the $compile_dir 'redis/' does not exist, or is not a directory. in Smarty->trigger_error() (line 1086 of/srv/bindings/REDACTED/code/sites/all/modules/civicrm/packages/Smarty/Smarty.class.php).
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-17T14:59:57.283Z
Answers.Text: Update: this is what was missing from Owen's patch: https://github.com/freeform/civicrm-drupal-pantheon/blob/4.4.x/patches/setting-redis-cache-with-smarty.patch in case anyone was hoping to give it a try. Thanks Chris Grewe!
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T02:15:11.937Z
Answers.LastActivityDate: 2015-08-06T02:15:11.937Z
Answers.UserDisplayName: Andie Hunt
Answers.Body: <p>I worked through how to do this for D8!</p>
  <p><a href="https://webform-civicrm.io/installing-drupal-8civicrm-pantheon" rel="nofollow noreferrer">https://webform-civicrm.io/installing-drupal-8civicrm-pantheon</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-16T21:34:52.813Z
Answers.LastActivityDate: 2020-09-16T21:34:52.813Z
Answers.UserDisplayName: KarinG - Semper IT
Answers.Body: <p>All of the existing documentation assumes you'll be using Drupal 7 with Pantheon, with the exception of my <a href="https://hq.megaphonetech.com/projects/commons/wiki/Migrating_D8CiviCRM_to_Pantheon" rel="nofollow noreferrer">&quot;migrating Drupal 8/CiviCRM to Pantheon&quot;</a> documentation.  I couldn't find anything for WordPress.</p>
  <p>Fortunately, Herb's answer above covers most of what you need, except you'll need an alternative <code>civicrm.settings.php</code>.  You can find a <a href="https://github.com/MegaphoneJon/civicrm-wp-pantheon" rel="nofollow noreferrer">civicrm.settings.php for WordPress on Pantheon here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-16T21:36:43.490Z
Answers.Text: Hi Jon -> I worked through how to do this on Pantheon with D8 a few months ago and added it as an answer here.
Answers.UserDisplayName: KarinG - Semper IT
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-16T20:04:05.560Z
Answers.LastActivityDate: 2020-09-16T20:04:05.560Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Made this module for Drupal, which flushes the CiviCRM cache when the disk path changes:</p>
  
  <p><a href="https://github.com/adam-devapp/drupal-pantheon-civicrm-cache-clear/tree/master/civicrm_cache_clear" rel="nofollow">https://github.com/adam-devapp/drupal-pantheon-civicrm-cache-clear/tree/master/civicrm_cache_clear</a></p>
  
  <p>The path is cached, so there is only the initial database call. If you're site switches servers a lot, it may cause some slowness whilst the cache is regenerated, but works well for my needs and hands off.</p>
  
  <p>The alternative was to submit a path to Smarty to support Redis template caching (smarty), as to stop hacking third party libraries. Currently, the only way to add Redis caching to smarty, is to hack smarty distributed with CiviCRM.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T22:46:43.480Z
Answers.Text: can the lack of this module be what is causing me to often get this error when accessing civicrm pages : "The xml data cannot be loaded"
Answers.UserDisplayName: Yossi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-28T02:51:36.853Z
Answers.Text: Yes, I believe so. The error goes away after a page refresh (as the file is regenerated). Since using this module, the issues with Pantheon have gone away completely.
Answers.UserDisplayName: Adam
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-04T19:45:02.697Z
Answers.Text: I've enabled this module on many sites and the error "The xml data cannot be loaded" continues to persist. any ideas?
Answers.UserDisplayName: Yossi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-21T10:34:42.663Z
Answers.LastActivityDate: 2016-10-22T23:23:19.657Z
Answers.LastEditDate: 2016-10-22T23:23:19.657Z
Answers.UserDisplayName: Adam
Answers.Body: <p>There are two approaches, use the CiviCRM Starterkit which currently is available as an upstream for Pantheon, or use a fresh CiviCRM install with some patches.</p>
  
  <p><strong>CiviCRM Starterkit</strong></p>
  
  <p>The <a href="https://www.drupal.org/project/civicrm_starterkit" rel="nofollow">starterkit</a> is a Drupal distribution will get you most of the way since it includes a few patches so CiviCRM will work more smoothly on Pantheon's architecture. In order to use the the starterkit in Pantheon use the option provided when creating a new site from the Pantheon dashboard (and not from the distribution hosted on drupal.org). Unfortunately, the original maintainer is no longer working on CiviCRM projects so has been unable to maintain the distribution.</p>
  
  <p><strong>CiviCRM with patches</strong></p>
  
  <p>The other approach is to install CiviCRM manually on top of the default Pantheon upstream for Drupal and apply the patches from the Starterkit which patch CiviCRM core. One can then maintain the appropriate patches so they can be applied to each CiviCRM upgrade, similar to <a href="https://github.com/freeform/civicrm-drupal-pantheon" rel="nofollow">the repo "CiviCRM for Drupal on Pantheon" we've maintained</a> for a client (though there are differences currently in what people are patching).</p>
  
  <p><strong>Dealing with a dynamic system</strong></p>
  
  <p>The main change required for CiviCRM to work with Pantheon is get around CiviCRM's approach of hardcoding the absolute paths to all its configuration. Pantheon (and other similar hosts) use environment variables to set the server paths and the database connections. That's because its app bindings will change depending on whether the fallback server kicks in to deal with the load on the site. I've found that this can happen often, especially when a large mailing is being sent out.</p>
  
  <p>First the paths and database connections are set up dynamically in civicrm.settings.php (as described in <a href="http://blog.kalamuna.com/news/civicrm-pantheon" rel="nofollow">Kalamuna's post</a> and patched in the Starterkit and the alternative patches). Then one needs to deal with CiviCRM's caching of absolute server paths (at least <a href="https://issues.civicrm.org/jira/browse/CRM-16373" rel="nofollow">up to 4.7</a>). For now one can simply <a href="https://github.com/freeform/civicrm-drupal-pantheon/blob/4.6.x/patches/skip-config-cache.patch" rel="nofollow">bypass the caching of configuration</a> entirely with no discernible downside. </p>
  
  <p><strong>Using Redis for caching and template storage</strong></p>
  
  <p>Pantheon uses Redis caching to improve the handling of the Drupal cache (Redis can handle it better than MySQL). In order to get CiviCRM to also use Redis caching as the default for CiviCRM cache one needs to set up a new Redis caching class in CiviCRM and set it as the default in civicrm.settings.php. This has been merged into <a href="https://issues.civicrm.org/jira/browse/CRM-17401" rel="nofollow">CiviCRM core for 4.7</a>. (based on <a href="https://github.com/ChrisChinchilla/com.schwartzmedia.rediscache" rel="nofollow">this git repo</a>). </p>
  
  <p>To use Redis for storing the compiled Smarty templates follow the approach outlined in this <a href="https://forum.civicrm.org/index.php?topic=35125.0;nowap" rel="nofollow">forum post</a>, which for some has made noticeable improvements to the speed at which CiviCRM loads templates in Pantheon. It can be done by either using Drupal caching functionality <a href="https://github.com/freeform/civicrm-drupal-pantheon/blob/4.4.x/patches/civi-smarty-redis-integration-ojkelly-85e04b6.patch" rel="nofollow">cache_get</a> and <a href="https://github.com/freeform/civicrm-drupal-pantheon/blob/4.4.x/patches/setting-redis-cache-with-smarty.patch" rel="nofollow">cache_set</a> or with CiviCRM to store cache in Redis (<a href="https://github.com/freeform/civicrm-drupal-pantheon/blob/4.6.x/patches/smarty-redis-civi-cache.patch" rel="nofollow">patch</a>). You may notice some side-effects with using scripts in extern/* folder that don't bootstrap the CMS, so you may find these patches.<a href="https://github.com/freeform/civicrm-drupal-pantheon/blob/4.6.x/patches/extern-cms-bootstrap.patch" rel="nofollow">1</a> <a href="https://github.com/freeform/civicrm-drupal-pantheon/blob/4.6.x/patches/ipn.patch" rel="nofollow">2</a> useful (for PaypalPro).</p>
  
  <p>There are a few other minor patches as part of the Starterkit but these main ones will get you a long way to a stable and efficient CiviCRM on Pantheon.</p>
  
  <p><strong>Cron</strong></p>
  
  <p>By default Pantheon runs cron once an hour. In order to <a href="https://pantheon.io/docs/articles/drupal/cron/" rel="nofollow">run cron more often</a>, which is useful for more granular control of CiviCRM cronjobs (also useful for Drupal's Elysia cron), one needs to use an external cron or ping service.</p>
  
  <p><strong>Emails and SMTP</strong></p>
  
  <p>For basic Drupal setups on Pantheon just using their email service for sending basic transactional emails is okay. But it is highly recommended to use an external SMTP service for emails on CiviCRM (and for Drupal). CiviSMTP and Mandrill (with a CiviCRM extension) will work for Civimail and CiviCRM transactional emails.</p>
  
  <p><strong>Benefits of CiviCRM on Pantheon</strong></p>
  
  <p>As others have noted, being able to quickly clone the site into a new branch with MultiDev, or even just clone between the default environments, can be a big time saver for small development firms and for freelancers without the knowledge or support of building a similar system.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T14:54:06.293Z
Answers.Text: I've tried to be more comprehensive here about what is required to get CiviCRM to run on Pantheon. I can edit anything incorrect or missing.
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T23:01:43.583Z
Answers.Text: Best answer so far, covers all the points I have.
Answers.UserDisplayName: Owen Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-07T01:31:58.720Z
Answers.Text: can you link to the issues where you've mentioned them being worked on in core?
Answers.UserDisplayName: ryancross
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-07T01:33:43.740Z
Answers.Text: also, i think its worth clarifying that the civicrm_startkit on its own is not suited for Pantheon. There is a pantheon specific version for the starterkit
Answers.UserDisplayName: ryancross
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-07T03:19:20.003Z
Answers.Text: Although obviously I have opinions about whether Pantheon is worth it overall, this is a really nice outline of what should be done in order to make it work.
Answers.UserDisplayName: Andie Hunt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-06T22:22:47.140Z
Answers.Text: @herb Long term, I think it would be good to get this into core with a toggle in civicrm.settings.php, as it's applicable to any horizontally scaled instance of CiviCRM.
Answers.UserDisplayName: Owen Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-07T04:19:06.887Z
Answers.Text: Currently, you can only enable redis on on Pantheon for  the enterprise plan and up which starts at $100 per month. Are there any other work around on Pantheon for smarty templates?
Answers.UserDisplayName: Yossi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-07T04:20:03.140Z
Answers.Text: Great post by the way
Answers.UserDisplayName: Yossi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-08T17:39:20.877Z
Answers.Text: @YossiCrm I guess the only other option is to leave Smarty templates at the default--compiled into the filesystem. I have wondered how the performance compares with Drupal 8's twig which also compiles templates to the filesystem and which Pantheon fully supports.
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-13T07:18:09.507Z
Answers.Text: Has CiviCRM added support to cache smarty files in redis as yet, so an additional patch is not required?
Answers.UserDisplayName: Adam
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-14T13:18:28.770Z
Answers.Text: @adamk there is no built-in support to store smarty files in Redis. I imagine it might require changes to the Smarty project so it can support different backends.
Answers.UserDisplayName: herb
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-06T13:37:39.713Z
Answers.LastActivityDate: 2015-12-06T15:35:49.850Z
Answers.LastEditDate: 2015-12-06T15:35:49.850Z
Answers.UserDisplayName: herb
Body: <p><a href="https://pantheon.io/">pantheon.io</a> is a managed hosting service &amp; devops infrastructure with support for Drupal and WordPress.</p>
  
  <ul>
  <li>What additional considerations are there for hosting CiviCRM on Pantheon?</li>
  <li>Are there any specific configurations or patches required?</li>
  <li>Is there any functionality which differs from hosting CiviCRM on a "standard" LAMP stack?</li>
  </ul>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-06T01:49:45.017Z
Comments.Text: I've posted this question after [the topic was raised on the Pantheon Power Users list this morning](https://groups.google.com/a/pantheon.io/forum/#!topic/power-users/SEAwjzcMYHE) (group membership required to view?). Hoping to gather some community feedback here, with links to relevant issues / docs.
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-06T03:22:16.890Z
Comments.Text: Related forum post by @herb: [Ensure CiviCRM is always using dynamically generated server paths](https://forum.civicrm.org/index.php?topic=36505.0)
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-06T03:30:16.080Z
Comments.Text: Related forum post with patches to cache Smarty in Drupal cache: [Smarty is slowing down our civicrm](https://forum.civicrm.org/index.php?topic=35125.0;nowap), patches @ [ojkelly/civicrm-packages@4e88b13](https://github.com/ojkelly/civicrm-packages/commit/4e88b13ef5263ac874c9922c2dd6c1051a59f1f0) & [ojkelly/civicrm-packages@85e04b67](https://github.com/ojkelly/civicrm-core/commit/85e04b67a662c86b27811e8850f94a9daccd0a0a)
Comments.UserDisplayName: Chris Burgess
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-06T16:10:29.460Z
Comments.Text: Totten reformatted the first patch: https://gist.github.com/totten/cf6a22150ca7944b14ee to better understand what had changed.
Comments.UserDisplayName: herb
Tags: <hosting><pantheon><hosting-providers>
Title: What is required to run CiviCRM on Pantheon?
ThreadText: # What is required to run CiviCRM on Pantheon?
  
  (Asked by: username_0 on 2015-08-06)
  
  [pantheon.io](https://pantheon.io/) is a managed hosting service & devops infrastructure with support for Drupal and WordPress.
  
  * What additional considerations are there for hosting CiviCRM on Pantheon?
  * Are there any specific configurations or patches required?
  * Is there any functionality which differs from hosting CiviCRM on a "standard" LAMP stack?
  
  **Tags:** hosting, pantheon, hosting-providers
  
  > **Comments:**
  > **username_0**: I've posted this question after [the topic was raised on the Pantheon Power Users list this morning](https://groups.google.com/a/pantheon.io/forum/#!topic/power-users/SEAwjzcMYHE) (group membership required to view?). Hoping to gather some community feedback here, with links to relevant issues / docs.  
  > **username_0**: Related forum post by @username_1: [Ensure CiviCRM is always using dynamically generated server paths](https://forum.civicrm.org/index.php?topic=36505.0)  
  > **username_0**: Related forum post with patches to cache Smarty in Drupal cache: [Smarty is slowing down our civicrm](https://forum.civicrm.org/index.php?topic=35125.0;nowap), patches @ [ojkelly/civicrm-packages@4e88b13](https://github.com/ojkelly/civicrm-packages/commit/4e88b13ef5263ac874c9922c2dd6c1051a59f1f0) & [ojkelly/civicrm-packages@85e04b67](https://github.com/ojkelly/civicrm-core/commit/85e04b67a662c86b27811e8850f94a9daccd0a0a)  
  > **username_1**: Totten reformatted the first patch: https://gist.github.com/totten/cf6a22150ca7944b14ee to better understand what had changed.  
  
  ---
  
  ## 9 answers
  
  ### Answer by username_1 on 2015-08-06. Score: 11 | Accepted answer
  
  There are two approaches, use the CiviCRM Starterkit which currently is available as an upstream for Pantheon, or use a fresh CiviCRM install with some patches.
  
  **CiviCRM Starterkit**
  
  The [starterkit](https://www.drupal.org/project/civicrm_starterkit) is a Drupal distribution will get you most of the way since it includes a few patches so CiviCRM will work more smoothly on Pantheon's architecture. In order to use the the starterkit in Pantheon use the option provided when creating a new site from the Pantheon dashboard (and not from the distribution hosted on drupal.org). Unfortunately, the original maintainer is no longer working on CiviCRM projects so has been unable to maintain the distribution.
  
  **CiviCRM with patches**
  
  The other approach is to install CiviCRM manually on top of the default Pantheon upstream for Drupal and apply the patches from the Starterkit which patch CiviCRM core. One can then maintain the appropriate patches so they can be applied to each CiviCRM upgrade, similar to [the repo "CiviCRM for Drupal on Pantheon" we've maintained](https://github.com/freeform/civicrm-drupal-pantheon) for a client (though there are differences currently in what people are patching).
  
  **Dealing with a dynamic system**
  
  The main change required for CiviCRM to work with Pantheon is get around CiviCRM's approach of hardcoding the absolute paths to all its configuration. Pantheon (and other similar hosts) use environment variables to set the server paths and the database connections. That's because its app bindings will change depending on whether the fallback server kicks in to deal with the load on the site. I've found that this can happen often, especially when a large mailing is being sent out.
  
  First the paths and database connections are set up dynamically in civicrm.settings.php (as described in [Kalamuna's post](http://blog.kalamuna.com/news/civicrm-pantheon) and patched in the Starterkit and the alternative patches). Then one needs to deal with CiviCRM's caching of absolute server paths (at least [up to 4.7](https://issues.civicrm.org/jira/browse/CRM-16373)). For now one can simply [bypass the caching of configuration](https://github.com/freeform/civicrm-drupal-pantheon/blob/4.6.x/patches/skip-config-cache.patch) entirely with no discernible downside.
  
  **Using Redis for caching and template storage**
  
  Pantheon uses Redis caching to improve the handling of the Drupal cache (Redis can handle it better than MySQL). In order to get CiviCRM to also use Redis caching as the default for CiviCRM cache one needs to set up a new Redis caching class in CiviCRM and set it as the default in civicrm.settings.php. This has been merged into [CiviCRM core for 4.7](https://issues.civicrm.org/jira/browse/CRM-17401). (based on [this git repo](https://github.com/ChrisChinchilla/com.schwartzmedia.rediscache)).
  
  To use Redis for storing the compiled Smarty templates follow the approach outlined in this [forum post](https://forum.civicrm.org/index.php?topic=35125.0;nowap), which for some has made noticeable improvements to the speed at which CiviCRM loads templates in Pantheon. It can be done by either using Drupal caching functionality [cache\_get](https://github.com/freeform/civicrm-drupal-pantheon/blob/4.4.x/patches/civi-smarty-redis-integration-ojkelly-85e04b6.patch) and [cache\_set](https://github.com/freeform/civicrm-drupal-pantheon/blob/4.4.x/patches/setting-redis-cache-with-smarty.patch) or with CiviCRM to store cache in Redis ([patch](https://github.com/freeform/civicrm-drupal-pantheon/blob/4.6.x/patches/smarty-redis-civi-cache.patch)). You may notice some side-effects with using scripts in extern/\* folder that don't bootstrap the CMS, so you may find these patches.[1](https://github.com/freeform/civicrm-drupal-pantheon/blob/4.6.x/patches/extern-cms-bootstrap.patch) [2](https://github.com/freeform/civicrm-drupal-pantheon/blob/4.6.x/patches/ipn.patch) useful (for PaypalPro).
  
  There are a few other minor patches as part of the Starterkit but these main ones will get you a long way to a stable and efficient CiviCRM on Pantheon.
  
  **Cron**
  
  By default Pantheon runs cron once an hour. In order to [run cron more often](https://pantheon.io/docs/articles/drupal/cron/), which is useful for more granular control of CiviCRM cronjobs (also useful for Drupal's Elysia cron), one needs to use an external cron or ping service.
  
  **Emails and SMTP**
  
  For basic Drupal setups on Pantheon just using their email service for sending basic transactional emails is okay. But it is highly recommended to use an external SMTP service for emails on CiviCRM (and for Drupal). CiviSMTP and Mandrill (with a CiviCRM extension) will work for Civimail and CiviCRM transactional emails.
  
  **Benefits of CiviCRM on Pantheon**
  
  As others have noted, being able to quickly clone the site into a new branch with MultiDev, or even just clone between the default environments, can be a big time saver for small development firms and for freelancers without the knowledge or support of building a similar system.
  
  > **Comments:**
  > **username_1**: I've tried to be more comprehensive here about what is required to get CiviCRM to run on Pantheon. I can edit anything incorrect or missing.  
  > **username_7**: Best answer so far, covers all the points I have.  
  > **username_10**: can you link to the issues where you've mentioned them being worked on in core?  
  > **username_10**: also, i think its worth clarifying that the civicrm_startkit on its own is not suited for Pantheon. There is a pantheon specific version for the starterkit  
  > **username_6**: Although obviously I have opinions about whether Pantheon is worth it overall, this is a really nice outline of what should be done in order to make it work.  
  > **username_7**: @username_1 Long term, I think it would be good to get this into core with a toggle in civicrm.settings.php, as it's applicable to any horizontally scaled instance of CiviCRM.  
  > **username_3**: Currently, you can only enable redis on on Pantheon for  the enterprise plan and up which starts at $100 per month. Are there any other work around on Pantheon for smarty templates?  
  > **username_3**: Great post by the way  
  > **username_1**: @YossiCrm I guess the only other option is to leave Smarty templates at the default--compiled into the filesystem. I have wondered how the performance compares with Drupal 8's twig which also compiles templates to the filesystem and which Pantheon fully supports.  
  > **username_5**: Has CiviCRM added support to cache smarty files in redis as yet, so an additional patch is not required?  
  > **username_1**: @adamk there is no built-in support to store smarty files in Redis. I imagine it might require changes to the Smarty project so it can support different backends.  
  
  ---
  
  ### Answer by username_2 on 2015-08-06. Score: 4
  
  There are a few gotchas (and probably some I haven't run into). I moved one of my clients with about 40,000 contacts to Pantheon (business level plan) in October, and we've had pretty good success with it after ironing out a few major details.
  
  The biggest problem is Smarty. Since it compiles its templates into the file system (Valhalla), they tend to run slower than molasses in January in Siberia. The solution can be found here:
  
  <https://forum.civicrm.org/index.php?topic=35125.0;nowap>
  
  The basic premise here is that loading compiled templates from Redis is going to be much, much faster than loading them from the file system. The thing you'll need to watch for with this is anything that uses Smarty now needs to bootstrap Drupal to have access to cache\_set and cache\_get for Redis. In general, you should keep anything PHP based (extensions, core file overrides, etc) in sites/all/something, not sites/default/files/...
  
  The second biggest thing we ran into was a problem with accessing extensions on business level and above plans (since they run multiple appservers). For some reason Civi likes to cache paths, so I had to write some custom code into the extension loader to account for that (and pop it back to the right path when it gets off track).
  
  The final big piece you'll need is Kalamuna's civicrm.settings.php modifications, which can be found here: <http://blog.kalamuna.com/news/civicrm-pantheon>
  
  They're meant for D6, but I've found they work just fine with D7 (and you can go a step beyond and do the same path overrides for everything they don't, such as extensions).
  
  I can tell you from my experience, which started about a year ago, there are some headaches that come along with this, but the benefits of MultiDev and the security of not having to worry about the platform (at least for me) are worth it in the long run. This has sped up our development cycle significantly, and the reliability and lack of late evening trouble calls have been worth it. We've been running 4.4.x since January, and the number of headaches I've had that are platform related have been steadily dropping once you get through the first big problem above (Smarty).
  
  > **Comments:**
  > **username_0**: Thanks username_0. Would you unpack this statement for me a bit more? _The thing you'll need to watch for with this is anything that uses Smarty now needs to bootstrap Drupal to have access to cache_set and cache_get for Redis. In general, you should keep anything PHP based (extensions, core file overrides, etc) in sites/all/something, not sites/default/files/..._ - you mean the contents of templates_c/* when you are saying "PHP based", or is that two separate statements?  
  > **username_0**: _The second biggest thing we ran into was a problem with accessing extensions on business level and above plans (since they run multiple appservers). For some reason Civi likes to cache paths, so I had to write some custom code into the extension loader to account for that (and pop it back to the right path when it gets off track)._ - I'd be happy to help get this in if you're keen to see it part of core. Want to open an issue on it @ https://issues.civicrm.org/ ? The hardcoded path fixity is something I'd love to see gone from CiviCRM.  
  > **username_1**: There is already an issue for this: https://issues.civicrm.org/jira/browse/CRM-16618 -- looks like its going nowhere without funding and/or patches.  
  > **username_3**: Is Redis the only way aroung the Smarty issue? Redis is only available on the enterprise plan which is $75/month more than the personal plan that we are on.  
  > **username_1**: Regarding CiviCRM caching config, this issue changes they way Civi deals with config in 4.7: https://issues.civicrm.org/jira/browse/CRM-16373. Hopefully this will address the one concern about full paths getting cached.  
  
  ---
  
  ### Answer by username_4 on 2015-09-17. Score: 3
  
  Patheon also does not provide an ability to tune your database. Its database configuration is more tuned for CMS's like Drupal and Wordpress, and not for CRM's like CiviCRM which can have huge data storage requirements.
  
  Another aspect which I have difficulty with (though ultimately it doesn't matter too much) is the need to maintain the entire Drupal/Wordpress and CiviCRM codebase in Git. It just seems like such a waste when the core files are readily available elsewhere. But again, that's just a personal nit.
  
  
  ---
  
  ### Answer by username_3 on 2015-08-06. Score: 2
  
  We have a few sites on pantheon running civicrm.
  We started with the civicrm\_starterkit. There were a few issues to iron out but Pantheon does save you the headache of worrying about hosting, and multi-dev environment goes a long way.
  Also with the kalabox from kalamuna, local development for pantheon sites is life changing.
  
  We updated the starterkit's civicrm 4.4 to 4.6 without any issues.
  
  
  ---
  
  ### Answer by username_5 on 2016-01-12. Score: 2
  
  I'm currently testing a CiviCRM extension which regenerates cache (updates the file paths) when they change on Pantheon.
  
  [What is the best way to override changes to CRM\_Core\_Config?](https://civicrm.stackexchange.com/questions/8779/cannot-redeclare-class-crm-core-config)
  
  It's a CiviCRM extension, which I'm happy to share if it works as expected.
  
  > **Comments:**
  > **username_0**: I suspect [this question on Pantheon Power-Users](https://groups.google.com/a/pantheon.io/forum/#!topic/power-users/3kTPXgtKodI) (membership required to view) may be looking for the solution your CacheOff extension offers - would you consider publishing it for them? Shouldn't hurt for you to have more people testing it :)  
  
  ---
  
  ### Answer by username_6 on 2015-08-06. Score: 2
  
  1. A bottle of aspirin
  2. A lot of patience
  3. A budget to migrate the site to another host
  
  I actually can't remember all the issues, but I know that Tommy and Sanjay have had continual trouble with folks on Pantheon. There have been problems running upgrades on their dev sites because they're underpowered. Pantheon doesn't provide any cron except a `drush cron` every hour, so you have to have another server run cron for you if you want a decent frequency. There have been other issues that don't immediately come to mind, but I have yet to see any advantage to using Pantheon.
  
  Fundamentally, it's just overpriced, gussied-up shared hosting. Anyone will do better with a VPS and their dev/staging/production sites set up in regular git repos.
  
  > **Comments:**
  > **username_1**: This isn't a very balanced response. There are pros and cons to using Pantheon I've found. Since Pantheon focuses on Drupal and Wordpress officially it's not that fair to blame them for not working all the time with CiviCRM.  
  > **username_6**: Oh, they'll change file paths on alternate Tuesdays, except when Mercury is in retrograde, when it's each Friday. They also make no promises regarding your mail IP address, so you have to do external SMTP or you get to have fun configuring SPF for a moving target.  
  > **username_6**: @username_1 no, you're right that it's not balanced. I don't think it's necessarily bad for what it is; I just know that what it is isn't good for CiviCRM.  
  > **username_1**: Yes Pantheon changes its bindings for load balancing, but that's something that Drupal or Wordpress have no problem handling. So it means that out of the box CiviCRM doesn't account for that, but I've found small changes make it work. Regarding external SMTP this is something we *always* do on our own servers as well. SMTP services do a much better job anyway.  
  > **username_6**: @username_1 totally agree on SMTP in general, but for someone not using CiviMail, it can be overkill for just receipts and password reminders here and there.  My main feeling is that just because you *can* make it work doesn't mean it's worth the trouble when there are plenty of perfectly good hosting arrangements that don't require these workarounds.  
  > **username_1**: The question is not really about whether Pantheon is "good" or not, since some developers already figure it's worth the tradeoffs. It all depends on your requirements.  
  > **username_7**: Just to counter this, we've been running Civicrm on Pantheon for more than 18 months, and after a few teething issues (patches in the other answers) it's running smoothly and reliably for us. Naturally it depends on your requirements, but it can and does work.  
  > **username_1**: @username_7 thanks for that patch! Sadly I'm having troubles getting it to work. It seems to me as if either not all the code is in the patch or I'm missing a step. The error I get:   >User error: Smarty error: the $compile_dir 'redis/' does not exist, or is not a directory. in Smarty->trigger_error() (line 1086 of/srv/bindings/REDACTED/code/sites/all/modules/civicrm/packages/Smarty/Smarty.class.php).  
  > **username_1**: Update: this is what was missing from username_7's patch: https://github.com/freeform/civicrm-drupal-pantheon/blob/4.4.x/patches/setting-redis-cache-with-smarty.patch in case anyone was hoping to give it a try. Thanks username_0 username_2!  
  
  ---
  
  ### Answer by username_8 on 2020-09-16. Score: 1
  
  I worked through how to do this for D8!
  
  <https://webform-civicrm.io/installing-drupal-8civicrm-pantheon>
  
  
  ---
  
  ### Answer by username_9 on 2020-09-16. Score: 1
  
  All of the existing documentation assumes you'll be using Drupal 7 with Pantheon, with the exception of my ["migrating Drupal 8/CiviCRM to Pantheon"](https://hq.megaphonetech.com/projects/commons/wiki/Migrating_D8CiviCRM_to_Pantheon) documentation. I couldn't find anything for WordPress.
  
  Fortunately, username_1's answer above covers most of what you need, except you'll need an alternative `civicrm.settings.php`. You can find a [civicrm.settings.php for WordPress on Pantheon here](https://github.com/MegaphoneJon/civicrm-wp-pantheon).
  
  > **Comments:**
  > **username_8**: Hi Jon -> I worked through how to do this on Pantheon with D8 a few months ago and added it as an answer here.  
  
  ---
  
  ### Answer by username_5 on 2016-10-21. Score: 1
  
  Made this module for Drupal, which flushes the CiviCRM cache when the disk path changes:
  
  <https://github.com/username_5-devapp/drupal-pantheon-civicrm-cache-clear/tree/master/civicrm_cache_clear>
  
  The path is cached, so there is only the initial database call. If you're site switches servers a lot, it may cause some slowness whilst the cache is regenerated, but works well for my needs and hands off.
  
  The alternative was to submit a path to Smarty to support Redis template caching (smarty), as to stop hacking third party libraries. Currently, the only way to add Redis caching to smarty, is to hack smarty distributed with CiviCRM.
  
  > **Comments:**
  > **username_3**: can the lack of this module be what is causing me to often get this error when accessing civicrm pages : "The xml data cannot be loaded"  
  > **username_5**: Yes, I believe so. The error goes away after a page refresh (as the file is regenerated). Since using this module, the issues with Pantheon have gone away completely.  
  > **username_3**: I've enabled this module on many sites and the error "The xml data cannot be loaded" continues to persist. any ideas?  
  
  ---
  
  