Skip to main content

Install Scripts

Learn how to install scripts with Quicksilver.


This section provides information on script type and location, as well as how to install specific scripts.

Script Type and Location

Quicksilver currently supports webphp scripting, which runs a PHP script through the same runtime environment as the website. PHP scripts are subject to the same limits as any code on the platform, such as timeouts. PHP scripts cannot be batched, and run continuously and sequentially. Each command executes after the previous command has finished or timed out.

We recommend that you set the web_docroot to true and that you create a dedicated directory under the docroot (for example, web/private/scripts). This tracks files by instructing Quicksilver to look for the files inside the web folder. If your site uses this nested docroot setting, the scripts directory must be located in the web subdirectory of your site's code repository (for example, web/private/scripts).

Info:
Nested Docroots

If your site uses a nested docroot, the script paths in your pantheon.yml file should not include the web/ path prefix. Scripts in your pantheon.yml file should match one of the following path examples:

  • private/scripts/new_relic_deploy.php
  • private/scripts/slack_deploy_notification.php

Even though the script section in the pantheon.yml file does not include the web folder, the file is located inside web. For example, if this line is set in the pantheon.yml file:

private/scripts/new_relic_deploy.php

The file must be located in:

web/private/scripts/new_relic_deploy.php

Composer Script Installs

You can use Terminus to install Quicksilver Composer scripts if you have a Composer-managed site. The sections below provide links to Pantheon-maintained repositories with install scripts.

Clear Cloudflare Cache

Use the Pantheon Cloudflare Cache repository to clear your Cloudflare cache.

Info:
Note

Always clear your CDN cache using the after timing option to avoid requests re-caching stale content. Caches should generally be cleared "bottom up".

Debugging with Quicksilver

Use the Pantheon Quicksilver Debugging repository to explore Quicksilver as a workflow improvement tool.

Drush CMI

The Pantheon Drush CMI repository provides steps on how to integrate Drush commands into your Quicksilver operations. This allows you to import configuration changes from .yml files.

Drush Revert Features

The Pantheon Drush Revert Features repository provides information on using Drush commands to revert specific features.

Enable Development Modules

The Pantheon Enable Development Module repository provides steps on how to use Drush within a Quicksilver script.

Generate Development Content

Use the Pantheon Generate Development Content repository to integrate Drush devel generate commands into your Quicksilver operations. This allows you to generate development content on each database clone operation.

Import WP-CFM Configuration Settings into a Cloned Database

Use the Pantheon WP-CFM Import repository to automatically import WP-CFM configuration settings into a cloned database. This is useful for development environments that have slightly different settings than the production environment.

Info:
Note

Only use WP-CFM to write changes to code in Dev and Multidev environments, where the code base is writable. Cloning databases between environments before saving WP-CFM bundles can result in loss of data.

New Relic Custom Apdex T Values Multidev Environments

Use the Pantheon New Relic Apdex T Values repository to set custom T values for Multidev environments. Each environment will use the default values of 0.5 and 7 for your server and browser, respectively, if you don't set a custom value.

New Relic Deploy Markers

Use the Pantheon New Relic Deploy Markers repository to automatically log changes to your site into New Relic's Deployments page. This can be useful for keeping track of performance improvements.

Search and Replace URLs on WordPress Sites

Use the Pantheon Search and Replace URLs on WordPress Sites repository to automatically find and replace URLs in the database of a WordPress website. This is helpful for sites that have multiple domains in an environment.

Secrets

Your script may require tokens, passwords, or other information that should be protected. These values should be stored securely. You can do this with a third-party key management service like Lockr.

You can also use your site's private files path to store values securely. Note that the Site Dashboard function to copy files from one environment to another will also overwrite the private files path when storing keys for Quicksilver scripts in the private files path.

Install the Terminus Secrets Plugin to manage secret data in JSON files in your site's private files path.

This allows you to write and remove key values. The code example below shows you how to write a value to a key:

terminus secrets:set site.env key value

Slack Integration

Use the Pantheon Slack Integration repository to integrate Slack notifications from your Pantheon project using Quicksilver. This integration overview also provides information on how to manage API keys outside of your site repository.

URL Checker

Use the Pantheon URL Checker repository to check specific URLs after a live deployment. This script also notifies you of failures by email.

Webhooks

Use the Pantheon Quicksilver Webhooks repository to post workflow data to an external URL for a generic Webhook implementation.

WP Solr Indexing

Use the Pantheon WP Solr Index repository when you create a new WordPress Multidev environment. New WordPress Multidevs clone the code, files, and database, but not the Solr instance. This script re-indexes Solr using WP-CLI and the Solr Power WordPress plugin.

More Resources