github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/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. 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. 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      ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 )
    50      if ! command -v drush >/dev/null ; then echo "Please make sure your project contains drush, ddev composer require drush/drush" && exit 1; fi
    51      if [ -z "${TERMINUS_MACHINE_TOKEN:-}" ]; then echo "Please make sure you have set TERMINUS_MACHINE_TOKEN in ~/.ddev/global_config.yaml" && exit 1; fi
    52      terminus auth:login --machine-token="${TERMINUS_MACHINE_TOKEN}" || ( echo "terminus auth login failed, check your TERMINUS_MACHINE_TOKEN" && exit 1 )
    53      terminus aliases 2>/dev/null
    54  
    55  db_pull_command:
    56    command: |
    57      set -x   # You can enable bash debugging output by uncommenting
    58      set -eu -o pipefail
    59      ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible
    60      pushd /var/www/html/.ddev/.downloads >/dev/null
    61      terminus backup:get ${project} --element=db --to=db.sql.gz
    62  
    63  files_pull_command:
    64    command: |
    65      set -x   # You can enable bash debugging output by uncommenting
    66      set -eu -o pipefail
    67      ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible
    68      pushd /var/www/html/.ddev/.downloads >/dev/null;
    69      terminus backup:get ${project} --element=files --to=files.tgz
    70      mkdir -p files && tar --strip-components=1 -C files -zxf files.tgz
    71  
    72  # push is a dangerous command. If not absolutely needed it's better to delete these lines.
    73  db_push_command:
    74    command: |
    75      set -x   # You can enable bash debugging output by uncommenting
    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      set -eu -o pipefail
    87      ls ${DDEV_FILES_DIR} >/dev/null # This just refreshes stale NFS if possible
    88      drush rsync -y @self:%files @${project}:%files