Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
32 changes: 32 additions & 0 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,37 @@ 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
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."

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