github.com/ddev/ddev@v1.23.2-0.20240519125000-d824ffe36ff3/pkg/ddevapp/dotddev_assets/providers/upsun.yaml (about)

     1  #ddev-generated
     2  # Upsun provider configuration. This works out of the box, but can be edited to add
     3  # your own preferences. If you edit it, remove the `ddev-generated` line from the top so
     4  # that it won't be overwritten.
     5  
     6  # To use this configuration,
     7  
     8  # 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.
     9  # 2. Obtain and configure an API token.
    10  #    a. Login to the Upsun Dashboard and go to My Profile->API Tokens to create an API token for DDEV to use.
    11  #    b. Add the API token to the `web_environment` section in your global ddev configuration at ~/.ddev/global_config.yaml:
    12  #    ```yaml
    13  #    web_environment:
    14  #    - UPSUN_CLI_TOKEN=abcdeyourtoken
    15  #    ```
    16  # 3. Add UPSUN_PROJECT and UPSUN_ENVIRONMENT variables to your project `.ddev/config.yaml` or a `.ddev/config.upsun.yaml`
    17  #    ```yaml
    18  #    web_environment:
    19  #    - UPSUN_PROJECT=nf4amudfn23biyourproject
    20  #    - UPSUN_ENVIRONMENT=main
    21  # 4. `ddev restart`
    22  # 5. Run `ddev pull upsun`. After you agree to the prompt, the current upstream database and files will be downloaded.
    23  # 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.
    24  
    25  # Debugging: Use `ddev exec upsun` to see what Upsun knows about
    26  # your configuration and whether it's working correctly.
    27  
    28  auth_command:
    29    command: |
    30      set -eu -o pipefail
    31      if [ -z "${UPSUN_CLI_TOKEN:-}" ]; then echo "Please make sure you have set UPSUN_CLI_TOKEN." && exit 1; fi
    32      if [ -z "${UPSUN_PROJECT:-}" ]; then echo "Please make sure you have set UPSUN_PROJECT." && exit 1; fi
    33      if [ -z "${UPSUN_ENVIRONMENT:-}" ]; then echo "Please make sure you have set UPSUN_ENVIRONMENT." && exit 1; fi
    34  
    35  db_pull_command:
    36    command: |
    37      # set -x   # You can enable bash debugging output by uncommenting
    38      set -eu -o pipefail
    39      export UPSUN_CLI_NO_INTERACTION=1
    40      ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible
    41      upsun db:dump --yes --gzip --file=/var/www/html/.ddev/.downloads/db.sql.gz --project="${UPSUN_PROJECT}" --environment="${UPSUN_ENVIRONMENT}"
    42  
    43  files_import_command:
    44    command: |
    45      # set -x   # You can enable bash debugging output by uncommenting
    46      set -eu -o pipefail
    47      export UPSUN_CLI_NO_INTERACTION=1
    48      # Use $UPSUN_MOUNTS if it exists to get list of mounts to download, otherwise just web/sites/default/files (drupal)
    49      declare -a mounts=(${UPSUN_MOUNTS:-/web/sites/default/files})
    50      upsun mount:download --all --yes --quiet --project="${UPSUN_PROJECT}" --environment="${UPSUN_ENVIRONMENT}"  --target=/var/www/html
    51  
    52  
    53  # push is a dangerous command. If not absolutely needed it's better to delete these lines.
    54  db_push_command:
    55    command: |
    56      # set -x   # You can enable bash debugging output by uncommenting
    57      set -eu -o pipefail
    58      export UPSUN_CLI_NO_INTERACTION=1
    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      gzip -dc db.sql.gz | upsun db:sql --project="${UPSUN_PROJECT}" --environment="${UPSUN_ENVIRONMENT}"
    62  
    63  # push is a dangerous command. If not absolutely needed it's better to delete these lines.
    64  # TODO: This is a naive, Drupal-centric push, which needs adjustment for the mount to be pushed.
    65  files_push_command:
    66    command: |
    67      # set -x   # You can enable bash debugging output by uncommenting
    68      set -eu -o pipefail
    69      export UPSUN_CLI_NO_INTERACTION=1
    70      ls "${DDEV_FILES_DIR}" >/dev/null # This just refreshes stale NFS if possible
    71      upsun mount:upload --yes --quiet --project="${UPSUN_PROJECT}" --environment="${UPSUN_ENVIRONMENT}" --source="${DDEV_FILES_DIR}" --mount=web/sites/default/files