From 5a28bafeb27bb96aa9b151d239a0e88d60236415 Mon Sep 17 00:00:00 2001 From: Bill Seremetis Date: Fri, 18 Apr 2025 11:50:11 +0300 Subject: [PATCH 1/3] Fix for multiple DDEV hostnames --- README.md | 7 +++++-- install.yaml | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1e886e6..d87fa24 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,12 @@ After that you need to restart the ddev project: ddev restart ``` -**Note: If you haven't downloaded the backstopjs base image before, then it will be downloaded when ddev is restarted. -The backstopjs/backstopjs is about 2.6GB, so this may take some time.** +> [!NOTE] +> If you haven't downloaded the backstopjs base image before, then it will be downloaded when ddev is restarted. +> The backstopjs/backstopjs is about 2.6GB, so this may take some time. +> [!WARNING] +> If you change `additional_hostnames` or `additional_fqdns`, you have to re-run `ddev add-on get mmunz/ddev-backstopjs` ## Using backstopjs diff --git a/install.yaml b/install.yaml index 61c2a46..0e712a8 100644 --- a/install.yaml +++ b/install.yaml @@ -17,5 +17,18 @@ project_files: - commands/host/backstop-results post_install_actions: + - | + #ddev-nodisplay + #ddev-description:Adding all hostnames to the backstop container to make them available + cat <<-END >docker-compose.backstop_extras.yaml + #ddev-generated + services: + backstop: + external_links: + {{- $backstop_hostnames := splitList "," (env "DDEV_HOSTNAME") -}} + {{- range $i, $n := $backstop_hostnames }} + - "ddev-router:{{- replace (env "DDEV_TLD") "\\${DDEV_TLD}" (replace (env "DDEV_PROJECT") "\\${DDEV_PROJECT}" $n) -}}" + {{- end }} + END - echo "Install finished. Please restart ddev with 'ddev restart'" - echo "After that create your backstop config, e.g. run ddev backstop init." From d5d746d9448234a6e2ff27cd3d5c9e4f5856a88d Mon Sep 17 00:00:00 2001 From: Bill Seremetis Date: Fri, 18 Apr 2025 11:54:58 +0300 Subject: [PATCH 2/3] Ignore modified extras file on install --- install.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/install.yaml b/install.yaml index 0e712a8..9815d47 100644 --- a/install.yaml +++ b/install.yaml @@ -17,6 +17,13 @@ project_files: - commands/host/backstop-results post_install_actions: + - | + #ddev-nodisplay + #ddev-description:Checking docker-compose.backstop_extras.yaml for changes + if [ -f docker-compose.backstop_extras.yaml ] && ! grep -q '#ddev-generated' docker-compose.backstop_extras.yaml; then + echo "Existing docker-compose.backstop_extras.yaml does not have #ddev-generated, so can't be updated" + exit 2 + fi - | #ddev-nodisplay #ddev-description:Adding all hostnames to the backstop container to make them available From e4800333246103926a5f71494cf72bc54f73617e Mon Sep 17 00:00:00 2001 From: Bill Seremetis Date: Fri, 18 Apr 2025 11:55:14 +0300 Subject: [PATCH 3/3] Proper cleanup on add-on remove --- install.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/install.yaml b/install.yaml index 9815d47..6bf8edc 100644 --- a/install.yaml +++ b/install.yaml @@ -39,3 +39,15 @@ post_install_actions: END - echo "Install finished. Please restart ddev with 'ddev restart'" - echo "After that create your backstop config, e.g. run ddev backstop init." + +removal_actions: + - | + #ddev-nodisplay + #ddev-description:Remove docker-compose.backstop_extras.yaml file + if [ -f docker-compose.backstop_extras.yaml ]; then + if grep -q '#ddev-generated' docker-compose.backstop_extras.yaml; then + rm -f docker-compose.backstop_extras.yaml + else + echo "Unwilling to remove '$DDEV_APPROOT/.ddev/docker-compose.backstop_extras.yaml' because it does not have #ddev-generated in it; you can manually delete it if it is safe to delete." + fi + fi \ No newline at end of file