github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/pkg/ddevapp/dotddev_assets/providers/pantheon.yaml.example (about) 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 # - TERMINUS_MACHINE_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. For `ddev push pantheon` 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. Configure the local checkout for ddev using `ddev config` 26 # 27 # 7. Verify that drush is installed in your project, `ddev composer require drush/drush` 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. If using Colima, may need to set an explicit nameserver in `~/.colima/default/colima.yaml` like `1.1.1.1`. If this configuration is changed, may also need to restart Colima. 32 # 33 # 10. `ddev restart` 34 # 35 # 11. Run `ddev pull pantheon`. The ddev environment will download the Pantheon database and files using terminus and will import the database and files into the ddev environment. You should now be able to access the project locally. 36 # 37 # 12. 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. 38 # 39 40 # Debugging: Use `ddev exec terminus auth:whoami` to see what terminus knows about 41 # `ddev exec terminus site:list` will show available sites 42 43 environment_variables: 44 project: yourproject.dev 45 46 auth_command: 47 command: | 48 set -eu -o pipefail 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 "${TERMINUS_MACHINE_TOKEN:-}" ]; then echo "Please make sure you have set TERMINUS_MACHINE_TOKEN in ~/.ddev/global_config.yaml" && exit 1; fi 51 terminus auth:login --machine-token="${TERMINUS_MACHINE_TOKEN}" || ( echo "terminus auth login failed, check your TERMINUS_MACHINE_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 ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 ) 76 set -eu -o pipefail 77 ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible 78 pushd /var/www/html/.ddev/.downloads >/dev/null; 79 terminus remote:drush ${project} -- sql-drop -y 80 gzip -dc db.sql.gz | terminus remote:drush ${project} -- sql-cli 81 82 # push is a dangerous command. If not absolutely needed it's better to delete these lines. 83 files_push_command: 84 command: | 85 set -x # You can enable bash debugging output by uncommenting 86 ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 ) 87 set -eu -o pipefail 88 ls ${DDEV_FILES_DIR} >/dev/null # This just refreshes stale NFS if possible 89 drush rsync -y @self:%files @${project}:%files