diff --git a/.ddev/providers/acquia.yaml b/.ddev/providers/acquia.yaml new file mode 100755 index 0000000..a9d9716 --- /dev/null +++ b/.ddev/providers/acquia.yaml @@ -0,0 +1,71 @@ +#ddev-generated +# Acquia provider configuration. + +# To use this configuration, + +# 1. Get your Acquia API token from your Account Settings->API Tokens. +# 2. Make sure your ssh key is authorized on your Acquia account at Account Settings->SSH Keys +# 3. `ddev auth ssh` (this typically needs only be done once per ddev session, not every pull). +# 4. Add / update the web_environment section in ~/.ddev/global_config.yaml +# or your project config.yamlwith the API keys: +# ```yaml +# web_environment: +# - ACQUIA_API_KEY=xxxxxxxx +# - ACQUIA_API_SECRET=xxxxx +# ``` +# 5. Add the ACQUIA_ENVIRONMENT_ID environment variable to your project config.yaml, for example: +# ```yaml +# web_environment: +# - ACQUIA_ENVIRONMENT_ID=project1.dev +# - On the Acquia Cloud Platform you can find this out by navigating to the environments page, +# clicking 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` +# 6. `ddev restart` +# 7. Use `ddev pull acquia` to pull the project database and files. +# 8. 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. + +# Debugging: Use `ddev exec acli command` and `ddev exec acli auth:login` + +# Instead of setting the environment variables in configuration files, you can use +# `ddev pull acquia --environment=ACQUIA_ENVIRONMENT_ID=yourproject.dev` for example + +auth_command: + command: | + set -eu -o pipefail + 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 + if [ -z "${ACQUIA_ENVIRONMENT_ID:-}" ] ; then echo "Please set ACQUIA_ENVIRONMENT_ID via config.yaml or with '--environment=ACQUIA_ENVIRONMENT_ID=xxx'" && exit 1; fi + ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 ) + acli -n auth:login -n --key="${ACQUIA_API_KEY}" --secret="${ACQUIA_API_SECRET}" + +db_pull_command: + command: | + set -eu -o pipefail + # xargs here just trims whitespace + # We could use an easier technique when https://github.com/acquia/cli/issues/1629 is resolved + # just using `acli pull:db ${ACQUIA_ENVIRONMENT_ID}` + echo "Using ACQUIA_ENVIRONMENT_ID=${ACQUIA_ENVIRONMENT_ID}" + set -x # You can enable bash debugging output by uncommenting + db_dump=$(acli pull:db ${ACQUIA_ENVIRONMENT_ID} --no-interaction --no-import | tail -2l | xargs) + ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible + cp ${db_dump} /var/www/html/.ddev/.downloads/db.sql.gz + +files_import_command: + command: | + # set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + acli -n pull:files ${ACQUIA_ENVIRONMENT_ID} + +# push is a dangerous command. If not absolutely needed it's better to delete these lines. +db_push_command: + command: | + set -eu -o pipefail + export ACLI_DB_HOST=db ACLI_DB_NAME=db ACLI_DB_USER=db ACLI_DB_PASSWORD=db + set -x # You can enable bash debugging output by uncommenting + acli push:db ${ACQUIA_ENVIRONMENT_ID} --no-interaction + +# push is a dangerous command. If not absolutely needed it's better to delete these lines. +files_push_command: + command: | + # set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + acli push:files ${ACQUIA_ENVIRONMENT_ID} --no-interaction diff --git a/.ddev/providers/lagoon.yaml b/.ddev/providers/lagoon.yaml new file mode 100755 index 0000000..78cbf6e --- /dev/null +++ b/.ddev/providers/lagoon.yaml @@ -0,0 +1,49 @@ +#ddev-generated +# Lagoon provider configuration. + +# To use this configuration, + +# 1. Check out the project and then configure it with 'ddev config'. You'll want to use 'ddev start' and make sure the basic functionality is working. Your project must have a .lagoon.yml properly configured. +# 2. Configure an SSH key for your Lagoon user https://docs.lagoon.sh/using-lagoon-advanced/ssh/ +# 3. `ddev auth ssh`. +# 4. Add LAGOON_PROJECT and LAGOON_ENVIRONMENT variables to your project in 'web_environment' or a '.ddev/.env' +# 5. `ddev restart` +# +# 'ddev pull lagoon' + +auth_command: + command: | + set -eu -o pipefail + ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 ) + if [ -z "${LAGOON_PROJECT:-}" ]; then echo "Please make sure you have set the LAGOON_PROJECT environment variable in your 'web_environment' or .ddev/.env." && exit 1; fi + if [ -z "${LAGOON_ENVIRONMENT}" ]; then echo "Please make sure you have set the LAGOON_ENVIRONMENT environment variable in your 'web_environment' or .ddev/.env." && exit 1; fi + + +db_import_command: + command: | + # set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + export MARIADB_HOST=db MARIADB_USERNAME=db MARIADB_PASSWORD=db MARIADB_DATABASE=db + lagoon-sync sync mariadb -p ${LAGOON_PROJECT} -e ${LAGOON_ENVIRONMENT} --no-interaction + +files_import_command: + command: | + #set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + lagoon-sync sync files -p ${LAGOON_PROJECT} -e ${LAGOON_ENVIRONMENT} --no-interaction + +# push is a dangerous command. If not absolutely needed it's better to delete these lines. +db_push_command: + command: | + set -eu -o pipefail + #set -x # You can enable bash debugging output by uncommenting + export MARIADB_HOST=db MARIADB_USERNAME=db MARIADB_PASSWORD=db MARIADB_DATABASE=db + lagoon-sync sync mariadb -p ${LAGOON_PROJECT} -t ${LAGOON_ENVIRONMENT} -e local --no-interaction + +# push is a dangerous command. If not absolutely needed it's better to delete these lines. +files_push_command: + command: | + set -eu -o pipefail + #set -x # You can enable bash debugging output by uncommenting + lagoon-sync sync files -p ${LAGOON_PROJECT} -e local -t ${LAGOON_ENVIRONMENT} --no-interaction + diff --git a/.ddev/providers/upsun.yaml b/.ddev/providers/upsun.yaml new file mode 100755 index 0000000..5770e7a --- /dev/null +++ b/.ddev/providers/upsun.yaml @@ -0,0 +1,71 @@ +#ddev-generated +# Upsun provider configuration. This works out of the box, but can be edited to add +# your own preferences. If you edit it, remove the `ddev-generated` line from the top so +# that it won't be overwritten. + +# To use this configuration, + +# 1. Check out the site from Upsun and then configure it with `ddev config`. You'll want to use `ddev start` and make sure the basic functionality is working. +# 2. Obtain and configure an API token. +# a. Login to the Upsun Dashboard and go to My Profile->API Tokens to create an API token for DDEV to use. +# b. Add the API token to the `web_environment` section in your global ddev configuration at ~/.ddev/global_config.yaml: +# ```yaml +# web_environment: +# - UPSUN_CLI_TOKEN=abcdeyourtoken +# ``` +# 3. Add UPSUN_PROJECT and UPSUN_ENVIRONMENT variables to your project `.ddev/config.yaml` or a `.ddev/config.upsun.yaml` +# ```yaml +# web_environment: +# - UPSUN_PROJECT=nf4amudfn23biyourproject +# - UPSUN_ENVIRONMENT=main +# 4. `ddev restart` +# 5. Run `ddev pull upsun`. After you agree to the prompt, the current upstream database and files will be downloaded. +# 6. Optionally use `ddev push upsun` to push local files and database to Upsun. Note that `ddev push` is a command that can potentially damage your production site, so this is not recommended. + +# Debugging: Use `ddev exec upsun` to see what Upsun knows about +# your configuration and whether it's working correctly. + +auth_command: + command: | + set -eu -o pipefail + if [ -z "${UPSUN_CLI_TOKEN:-}" ]; then echo "Please make sure you have set UPSUN_CLI_TOKEN." && exit 1; fi + if [ -z "${UPSUN_PROJECT:-}" ]; then echo "Please make sure you have set UPSUN_PROJECT." && exit 1; fi + if [ -z "${UPSUN_ENVIRONMENT:-}" ]; then echo "Please make sure you have set UPSUN_ENVIRONMENT." && exit 1; fi + +db_pull_command: + command: | + # set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + export UPSUN_CLI_NO_INTERACTION=1 + ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible + upsun db:dump --yes --gzip --file=/var/www/html/.ddev/.downloads/db.sql.gz --project="${UPSUN_PROJECT}" --environment="${UPSUN_ENVIRONMENT}" + +files_import_command: + command: | + # set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + export UPSUN_CLI_NO_INTERACTION=1 + # Use $UPSUN_MOUNTS if it exists to get list of mounts to download, otherwise just web/sites/default/files (drupal) + declare -a mounts=(${UPSUN_MOUNTS:-/web/sites/default/files}) + upsun mount:download --all --yes --quiet --project="${UPSUN_PROJECT}" --environment="${UPSUN_ENVIRONMENT}" --target=/var/www/html + + +# push is a dangerous command. If not absolutely needed it's better to delete these lines. +db_push_command: + command: | + # set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + export UPSUN_CLI_NO_INTERACTION=1 + ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible + pushd /var/www/html/.ddev/.downloads >/dev/null + gzip -dc db.sql.gz | upsun db:sql --project="${UPSUN_PROJECT}" --environment="${UPSUN_ENVIRONMENT}" + +# push is a dangerous command. If not absolutely needed it's better to delete these lines. +# TODO: This is a naive, Drupal-centric push, which needs adjustment for the mount to be pushed. +files_push_command: + command: | + # set -x # You can enable bash debugging output by uncommenting + set -eu -o pipefail + export UPSUN_CLI_NO_INTERACTION=1 + ls "${DDEV_FILES_DIR}" >/dev/null # This just refreshes stale NFS if possible + upsun mount:upload --yes --quiet --project="${UPSUN_PROJECT}" --environment="${UPSUN_ENVIRONMENT}" --source="${DDEV_FILES_DIR}" --mount=web/sites/default/files