Skip to content

Commit

Permalink
fds
Browse files Browse the repository at this point in the history
  • Loading branch information
angrybrad committed Nov 25, 2023
1 parent 734842d commit de94780
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .ddev/providers/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ Providers README

DDEV's hosting provider integration lets you integrate with any upstream source of database dumps and files (such as your production or staging server) and provides examples of configuration for Acquia, Platform.sh, Pantheon, rsync, etc.

The best part of this is you can change them and adapt them in any way you need to, they're all short scripted recipes. There are several example recipes created in the .ddev/providers directory of every project or see them in the code at https://github.com/ddev/ddev/tree/master/cmd/ddev/cmd/dotddev_assets/providers.
The best part of this is you can change them and adapt them in any way you need to, they're all short scripted recipes. There are several example recipes created in the .ddev/providers directory of every project or see them in the code at https://github.com/ddev/ddev/tree/master/pkg/ddevapp/dotddev_assets/providers.

ddev provides the `pull` command with whatever recipes you have configured. For example, `ddev pull acquia` if you have created `.ddev/providers/acquia.yaml`.

ddev also provides the `push` command to push database and files to upstream. This is very dangerous to your upstream site and should only be used with extreme caution. It's recommended not even to implement the push stanzas in your yaml file, but if it fits your workflow, use it well.

Each provider recipe is a yaml file that can be named any way you want to name it. The examples are mostly named after the hosting providers, but they could be named "upstream.yaml" or "live.yaml", so you could `ddev pull upstream` or `ddev pull live`. If you wanted different upstream environments to pull from, you could name one "prod" and one "dev" and `ddev pull prod` and `ddev pull dev`.

Several example recipes are at https://github.com/ddev/ddev/tree/master/cmd/ddev/cmd/dotddev_assets/providers and in this directory.
Several example recipes are at https://github.com/ddev/ddev/tree/master/pkg/ddevapp/dotddev_assets/providers and in this directory.

Each provider recipe is a file named `<provider>.yaml` and consists of several mostly-optional stanzas:

* `environment_variables`: Environment variables will be created in the web container for each of these during pull or push operations. They're used to provide context (project id, environment name, etc.) for each of the other stanzas.
* `db_pull_command`: A script that determines how ddev should pull a database. It's job is to create a gzipped database dump in /var/www/html/.ddev/.downloads/db.sql.gz.
* `files_pull_command`: A script that determines how ddev can get user-generated files from upstream. Its job is to copy the files from upstream to /var/www/html/.ddev/.downloads/files.
* `db_push_command`: A script that determines how ddev should push a database. It's job is to take a gzipped database dump from /var/www/html/.ddev/.downloads/db.sql.gz and load it on the hosting provider.
* `files_pull_command`: A script that determines how ddev push user-generated files to upstream. Its job is to copy the files from the project's user-files directory ($DDEV_FILES_DIR) to the correct place on the upstream provider.
* `files_pull_command`: A script that determines how ddev push user-generated files to upstream. Its job is to copy the files from the project's user-files directories ($DDEV_FILES_DIRS) to the correct places on the upstream provider.

The environment variables provided to custom commands (see https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/#environment-variables-provided) are also available for use in these recipes.

Expand Down
4 changes: 2 additions & 2 deletions .ddev/providers/git.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ db_import_command:
command: |
set -eu -o pipefail
# set -x
ddev import-db --src="${checkout_dir}/db.sql.gz"
ddev import-db --file="${checkout_dir}/db.sql.gz"

files_import_command:
service: host
command: |
set -eu -o pipefail
# set -x
ddev import-files --src="${checkout_dir}/files"
ddev import-files --source="${checkout_dir}/files"
5 changes: 3 additions & 2 deletions .ddev/providers/pantheon.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
# 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.)
#
# 4. Make sure your public ssh key is configured in Pantheon (Account->SSH Keys)
# 4. For `ddev push pantheon` sure your public ssh key is configured in Pantheon (Account->SSH Keys)
#
# 5. Check out project codebase from Pantheon. Enable the "Git Connection Mode" and use `git clone` to check out the code locally.
#
Expand Down Expand Up @@ -46,7 +46,6 @@ environment_variables:
auth_command:
command: |
set -eu -o pipefail
ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 )
if ! command -v drush >/dev/null ; then echo "Please make sure your project contains drush, ddev composer require drush/drush" && exit 1; fi
if [ -z "${TERMINUS_MACHINE_TOKEN:-}" ]; then echo "Please make sure you have set TERMINUS_MACHINE_TOKEN in ~/.ddev/global_config.yaml" && exit 1; fi
terminus auth:login --machine-token="${TERMINUS_MACHINE_TOKEN}" || ( echo "terminus auth login failed, check your TERMINUS_MACHINE_TOKEN" && exit 1 )
Expand All @@ -73,6 +72,7 @@ files_pull_command:
db_push_command:
command: |
set -x # You can enable bash debugging output by uncommenting
ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 )
set -eu -o pipefail
ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible
pushd /var/www/html/.ddev/.downloads >/dev/null;
Expand All @@ -83,6 +83,7 @@ db_push_command:
files_push_command:
command: |
set -x # You can enable bash debugging output by uncommenting
ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 )
set -eu -o pipefail
ls ${DDEV_FILES_DIR} >/dev/null # This just refreshes stale NFS if possible
drush rsync -y @self:%files @${project}:%files
4 changes: 3 additions & 1 deletion .ddev/providers/platform.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#ddev-generated
# Example Platform.sh provider configuration.
# Platform.sh 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.

# Consider using `ddev get ddev/ddev-platformsh` (https://github.com/ddev/ddev-platformsh) for more
# complete platform integration.
Expand Down

0 comments on commit de94780

Please sign in to comment.