{"id":13993524,"url":"https://github.com/pantheon-systems/quicksilver-examples","last_synced_at":"2025-05-16T15:06:38.352Z","repository":{"id":43330474,"uuid":"47789040","full_name":"pantheon-systems/quicksilver-examples","owner":"pantheon-systems","description":"Example scripts for using Pantheon's Quicksilver Platform Hooks","archived":false,"fork":false,"pushed_at":"2025-04-01T19:34:59.000Z","size":306,"stargazers_count":134,"open_issues_count":47,"forks_count":115,"subscribers_count":129,"default_branch":"main","last_synced_at":"2025-05-09T15:55:54.049Z","etag":null,"topics":["automation","quicksilver"],"latest_commit_sha":null,"homepage":"https://docs.pantheon.io/guides/quicksilver","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pantheon-systems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-12-10T21:40:16.000Z","updated_at":"2025-04-01T19:35:03.000Z","dependencies_parsed_at":"2024-01-18T04:10:52.835Z","dependency_job_id":"59c7cda8-1e41-49c7-9d5a-b5a6ca3fb30a","html_url":"https://github.com/pantheon-systems/quicksilver-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pantheon-systems%2Fquicksilver-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pantheon-systems%2Fquicksilver-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pantheon-systems%2Fquicksilver-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pantheon-systems%2Fquicksilver-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pantheon-systems","download_url":"https://codeload.github.com/pantheon-systems/quicksilver-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553959,"owners_count":22090417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","quicksilver"],"created_at":"2024-08-09T14:02:25.243Z","updated_at":"2025-05-16T15:06:38.333Z","avatar_url":"https://github.com/pantheon-systems.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Pantheon Cloud Integration Examples\nThis repo contains example scripts for use with Quicksilver Platform Hooks. These will allow you to automate more of your workflow, and integrate better with other cloud services.\n\n[![Minimal Support](https://img.shields.io/badge/Pantheon-Minimal_Support-yellow?logo=pantheon\u0026color=FFDC28)](https://pantheon.io/docs/oss-support-levels#minimal-support)\n\nThe current release of Quicksilver supports one utility operation: `webphp`. This invokes a PHP script via the same runtime environment as the website itself. `php` scripts are subject to the same limits as any code on the platform, [like timeouts](https://pantheon.io/docs/articles/sites/timeouts/#timeouts-that-aren't-configurable), and cannot be batched.\n\nThis initial release makes four platform workflows eligible for Quicksilver operations:\n\n- `deploy`: when code is deployed to Test or Live. `webphp` scripts run on the target environment.\n- `sync_code`: code is pushed via Git or committed in the Pantheon dashboard. `webphp` scripts run on the committed-to environment (dev or multidev).\n- `clone_database`: data is cloned between environments. `webphp` scripts run on the target (to_env) environment.\n- `clear_cache`: the most popular workflow of them all! `webphp` scripts run on the cleared environment.\n\n## Introducing `pantheon.yml` ##\n\nQuicksilver is configured via a `pantheon.yml` file, which lives in the root of your repository (`~/code/`). When this file is first pushed to an environment, it will set up the workflow triggers.\n\nThe format for `pantheon.yml` is as follows:\n\n```yaml\n# Always start with an API version. This will increment as Quicksilver evolves.\napi_version: 1\n\n# Now specify the workflows to which you want to hook operations.\nworkflows:\n  deploy:\n    # Each workflow can have a before and after operation.\n    after:\n      # For now, the only \"type\" available is webphp.\n      - type: webphp\n        # This will show up in output to help you keep track of your operations.\n        description: Log to New Relic\n        # This is (obviously) the path to the script.\n        script: private/scripts/new_relic_deploy.php\n```\n\nNote that if you want to hook onto deploy workflows, you'll need to deploy your `pantheon.yml` into an environment first. Likewise, if you are adding new operations or changing the script an operation will target, the deploy which contains those adjustments to `pantheon.yml` will not self-referentially exhibit the new behavior. Only subsequent deploys will be affected.\n\n**When Updating:**\n**pantheon.yml**: Updates will fire on the next sequential workflow, not post-deploy.\n**scripts**:  Updates will fire post-deploy.\n**script location**: Updates will fire on next sequential workflow, not post-deploy.\n\n**When Adding:**\n**pantheon.yml**: Updates will fire on the next sequential workflow, not post-deploy.\n**scripts**: Updates will fire on the next sequential workflow.\n\n## Security ##\n\nWhen getting started with Quicksilver scripts, you'll want to first create **two** `private` directories on your website instance.\n\nThe first `private` directory should be created in your `~/files/` directory via SFTP (e.g. `~/files/private/`). This directory is not included in your source code and is used to store a `secrets.json` file where you can confidently store sensitive information like API keys and credentials. You will need to create a separate `private` directory (and subsequent `secrets.json`) for each environment as this directory isn't included in source and will not propagate during deployments. You can easily manage the key-value pairs in the `secrets.json` file per environment (after initially creating the file via SFTP) using Terminus after installing the [Terminus Secrets Plugin](https://github.com/pantheon-systems/terminus-secrets-plugin). The Slack notification example uses this pattern. For high-security keys, we recommend a third party secrets lockbox like [Lockr](https://lockr.io).\n\nThe second `private` directory should be created in your project's web root (e.g. `~/code/private/` OR `~/code/web/private/` depending on the `web_docroot` setting in your `pantheon.yml` file). This `private` directory is part of your repository, so it should not hold any sensitive information like API keys or credentials. Once you've created the `private` directory, we recommend creating a `scripts` directory within it to store all of your Quicksilver scripts.\n\nPantheon automatically limits public access to both of these `private` directories, so no special configuration in `pantheon.yml` is required. Scripts stored here can only be executed by the Pantheon platform.\n\n## Terminus Commands ##\n\nDevelopers making use of Quicksilver will want to make sure they are Terminus savvy. Get the latest release, and a few new commands are included:\n\n```shell\n$ terminus help workflows\n##NAME\n    terminus workflows\n\n##DESCRIPTION\n    Actions to be taken on an individual site\n\n##SYNOPSIS\n    \u003ccommand\u003e\n\n##SUBCOMMANDS\n    list\n        List workflows for a site\n    show\n        Show operation details for a workflow\n    watch\n        Streams new and finished workflows to the console\n```\n\nThe `list` and `show` commands will allow you to explore previous workflows and their Quicksilver operations. The `watch` command is a developers best friend: it will set up Terminus to automatically \"follow\" the workflow activity of your site, dumping back any Quicksilver output along with them.\n\n## Environment variables ##\n\nTo discover what environment variables are available to your scripts then take a look at the [debugging_example](debugging_example) script and instructions.\n\n## Troubleshooting ##\n\n- While your scripts can live anywhere, we recommend `private` since that will prevent the contents from ever being directly accessed via the public internet.\n- You'll know `pantheon.yml` has been added correctly, and your quicksilver actions are registered when you see a message like the following on `git push`:\n  ```\n  remote: PANTHEON NOTICE:\n  remote:\n  remote: Changes to `pantheon.yml` detected.\n  remote:\n  remote: Successfully applied `pantheon.yml` to the 'dev' environment.\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpantheon-systems%2Fquicksilver-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpantheon-systems%2Fquicksilver-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpantheon-systems%2Fquicksilver-examples/lists"}