|
| 1 | +#ddev-generated |
| 2 | +# Example Pantheon.io provider configuration. |
| 3 | +# This example is Drupal/drush oriented, |
| 4 | +# but can be adapted for other CMSs supported by Pantheon |
| 5 | + |
| 6 | +# To use this configuration: |
| 7 | +# |
| 8 | +# 1. Get your Pantheon.io machine token: |
| 9 | +# a. Login to your Pantheon Dashboard, and [Generate a Machine Token](https://pantheon.io/docs/machine-tokens/) for ddev to use. |
| 10 | +# b. Add the API token to the `web_environment` section in your global ddev configuration at ~/.ddev/global_config.yaml |
| 11 | +# |
| 12 | +# ``` |
| 13 | +# web_environment: |
| 14 | +# - PROJECT_TERMINUS_TOKEN=abcdeyourtoken |
| 15 | +# ``` |
| 16 | +# |
| 17 | +# 2. Choose a Pantheon site and environment you want to use with ddev. You can usually use the site name, but in some environments you may need the site uuid, which is the long 3rd component of your site dashboard URL. So if the site dashboard is at <https://dashboard.pantheon.io/sites/009a2cda-2c22-4eee-8f9d-96f017321555#dev/>, the site ID is 009a2cda-2c22-4eee-8f9d-96f017321555. |
| 18 | +# |
| 19 | +# 3. On the pantheon dashboard, make sure that at least one backup has been created. (When you need to refresh what you pull, do a new backup.) |
| 20 | +# |
| 21 | +# 4. Make sure your public ssh key is configured in Pantheon (Account->SSH Keys) |
| 22 | +# |
| 23 | +# 5. Check out project codebase from Pantheon. Enable the "Git Connection Mode" and use `git clone` to check out the code locally. |
| 24 | +# |
| 25 | +# 6. Verify that drush is installed in your project, `ddev composer require drush/drush` |
| 26 | +# |
| 27 | +# 7. Configure the local checkout for ddev using `ddev config` |
| 28 | +# |
| 29 | +# 8. In your project's .ddev/providers directory, copy pantheon.yaml.example to pantheon.yaml and edit the "project" under `environment_variables` (change it from `yourproject.dev`). If you want to use a different environment than "dev", change `dev` to the name of the environment. |
| 30 | +# |
| 31 | +# 9. `ddev restart` |
| 32 | +# |
| 33 | +# 10. Run `ddev pull pantheon`. The ddev environment download the Pantheon database and files, and import the database and files into the ddev environment. You should now be able to access the project locally. |
| 34 | +# |
| 35 | +# 11. Optionally use `ddev push pantheon` to push local files and database to Pantheon. Note that `ddev push` is a command that can potentially damage your production site, so this is not recommended. |
| 36 | +# |
| 37 | + |
| 38 | +# Debugging: Use `ddev exec terminus auth:whoami` to see what terminus knows about |
| 39 | +# `ddev exec terminus site:list` will show available sites |
| 40 | + |
| 41 | +# @Todo: update the project name and pantheon environment name (dev/test/live/etc.) |
| 42 | +environment_variables: |
| 43 | + project: project_name.pantheon_environment_name |
| 44 | + |
| 45 | +auth_command: |
| 46 | + command: | |
| 47 | + set -eu -o pipefail |
| 48 | + ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 ) |
| 49 | + if ! command -v drush >/dev/null ; then echo "Please make sure your project contains drush, ddev composer require drush/drush" && exit 1; fi |
| 50 | + if [ -z "${PROJECT_TERMINUS_TOKEN:-}" ]; then echo "Please make sure you have set PROJECT_TERMINUS_TOKEN in ~/.ddev/global_config.yaml" && exit 1; fi |
| 51 | + terminus auth:login --machine-token="${PROJECT_TERMINUS_TOKEN}" || ( echo "terminus auth login failed, check your PROJECT_TERMINUS_TOKEN" && exit 1 ) |
| 52 | + terminus aliases 2>/dev/null |
| 53 | +
|
| 54 | +db_pull_command: |
| 55 | + command: | |
| 56 | + set -x # You can enable bash debugging output by uncommenting |
| 57 | + set -eu -o pipefail |
| 58 | + ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible |
| 59 | + pushd /var/www/html/.ddev/.downloads >/dev/null |
| 60 | + terminus backup:get ${project} --element=db --to=db.sql.gz |
| 61 | +
|
| 62 | +files_pull_command: |
| 63 | + command: | |
| 64 | + set -x # You can enable bash debugging output by uncommenting |
| 65 | + set -eu -o pipefail |
| 66 | + ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible |
| 67 | + pushd /var/www/html/.ddev/.downloads >/dev/null; |
| 68 | + terminus backup:get ${project} --element=files --to=files.tgz |
| 69 | + mkdir -p files && tar --strip-components=1 -C files -zxf files.tgz |
| 70 | +
|
| 71 | +# push is a dangerous command. If not absolutely needed it's better to delete these lines. |
| 72 | +db_push_command: |
| 73 | + command: | |
| 74 | + set -x # You can enable bash debugging output by uncommenting |
| 75 | + set -eu -o pipefail |
| 76 | + ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible |
| 77 | + pushd /var/www/html/.ddev/.downloads >/dev/null; |
| 78 | + terminus remote:drush ${project} -- sql-drop -y |
| 79 | + gzip -dc db.sql.gz | terminus remote:drush ${project} -- sql-cli |
| 80 | +
|
| 81 | +# push is a dangerous command. If not absolutely needed it's better to delete these lines. |
| 82 | +files_push_command: |
| 83 | + command: | |
| 84 | + set -x # You can enable bash debugging output by uncommenting |
| 85 | + set -eu -o pipefail |
| 86 | + ls ${DDEV_FILES_DIR} >/dev/null # This just refreshes stale NFS if possible |
| 87 | + drush rsync -y @self:%files @${project}:%files |
0 commit comments