github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/pkg/ddevapp/dotddev_assets/providers/acquia.yaml.example (about)

     1  #ddev-generated
     2  # Example Acquia provider configuration.
     3  
     4  # To use this configuration,
     5  
     6  # 1. Get your Acquia API token from your Account Settings->API Tokens.
     7  # 2. Make sure your ssh key is authorized on your Acquia account at Account Settings->SSH Keys
     8  # 3. `ddev auth ssh` (this typically needs only be done once per ddev session, not every pull.)
     9  # 4. Add / update the web_environment section in ~/.ddev/global_config.yaml with the API keys:
    10  #    ```yaml
    11  #    web_environment:
    12  #    - ACQUIA_API_KEY=xxxxxxxx
    13  #    - ACQUIA_API_SECRET=xxxxx
    14  #    ```
    15  # 5. Copy .ddev/providers/acquia.yaml.example to .ddev/providers/acquia.yaml.
    16  # 6. Update the project_id and database corresponding to the environment you want to work with.
    17  #   - If have acli install, you can use the following command: `acli remote:aliases:list`
    18  #   - Or, on the Acquia Cloud Platform navigate to the environments page, click on the header and look for the "SSH URL" line. Eg. `project1.dev@cool-projects.acquia-sites.com` would have a project ID of `project1.dev`
    19  # 7. Your project must include drush; `ddev composer require drush/drush` if it isn't there already.
    20  # 8. `ddev restart`
    21  # 9. Use `ddev pull acquia` to pull the project database and files.
    22  # 10. Optionally use `ddev push acquia` to push local files and database to Acquia. Note that `ddev push` is a command that can potentially damage your production site, so this is not recommended.
    23  
    24  # Debugging: Use `ddev exec acli command` and `ddev exec acli auth:login`
    25  # Make sure you remembered to `ddev auth ssh`
    26  
    27  environment_variables:
    28    project_id: yourproject.dev
    29    database_name: yourproject
    30  
    31  auth_command:
    32    command: |
    33      set -eu -o pipefail
    34      if [ -z "${ACQUIA_API_KEY:-}" ] || [ -z "${ACQUIA_API_SECRET:-}" ]; then echo "Please make sure you have set ACQUIA_API_KEY and ACQUIA_API_SECRET in ~/.ddev/global_config.yaml" && exit 1; fi
    35      if ! command -v drush >/dev/null ; then echo "Please make sure your project contains drush, ddev composer require drush/drush" && exit 1; fi
    36      ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 )
    37  
    38      acli -n auth:login -n --key="${ACQUIA_API_KEY}" --secret="${ACQUIA_API_SECRET}"
    39      acli -n remote:aliases:download --all --destination-dir $HOME/.drush -n >/dev/null
    40  
    41  db_pull_command:
    42    command: |
    43      #set -x   # You can enable bash debugging output by uncommenting
    44      set -eu -o pipefail
    45      # If no database_name is configured, infer it from project_id
    46      if [ -z "${database_name:-}" ]; then database_name=${project_id%%.*}; fi
    47      backup_time=$(acli -n api:environments:database-backup-list ${project_id} ${database_name} --limit=1 | jq -r .[].completed_at)
    48      backup_id="$(acli -n api:environments:database-backup-list ${project_id} ${database_name} --limit=1 | jq -r .[].id)"
    49      backup_url=$(acli -n api:environments:database-backup-download ${project_id} ${database_name} ${backup_id} | jq -r .url)
    50      ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible
    51      echo "Downloading backup $backup_id from $backup_time"
    52      curl -o /var/www/html/.ddev/.downloads/db.sql.gz ${backup_url}
    53  
    54  files_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      drush -r docroot rsync --exclude-paths='styles:css:js' --alias-path=~/.drush -q -y @${project_id}:%files ./files
    61  
    62  # push is a dangerous command. If not absolutely needed it's better to delete these lines.
    63  db_push_command:
    64    command: |
    65      set -x   # You can enable bash debugging output by uncommenting
    66      set -eu -o pipefail
    67      TIMESTAMP=$(date +%y%m%d%H%M%S)
    68      ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible
    69      cd /var/www/html/.ddev/.downloads
    70      drush rsync -y --alias-path=~/.drush ./db.sql.gz @${project_id}:/tmp/db.${TIMESTAMP}.sql.gz
    71      acli -n remote:ssh -n ${project_id} -- "cd /tmp && gunzip db.${TIMESTAMP}.sql.gz"
    72      acli -n remote:drush -n ${project_id} -- "sql-cli </tmp/db.${TIMESTAMP}.sql"
    73      acli -n remote:drush -n ${project_id} -- cr
    74      acli -n remote:ssh -n ${project_id} -- "rm /tmp/db.${TIMESTAMP}.*"
    75  
    76  # push is a dangerous command. If not absolutely needed it's better to delete these lines.
    77  files_push_command:
    78    command: |
    79      # set -x   # You can enable bash debugging output by uncommenting
    80      set -eu -o pipefail
    81      ls ${DDEV_FILES_DIR} >/dev/null # This just refreshes stale NFS if possible
    82      drush rsync -y --alias-path=~/.drush @self:%files @${project_id}:%files