Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add support for multiple hostnames #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Then restart your project
ddev restart
```

> [!NOTE]
> If you change `additional_hostnames` or `additional_fqdns`, you have to re-run `ddev add-on get ddev/ddev-selenium-standalone-chrome`

### Optional steps

1. Update the provided `.ddev/config.selenium-standalone-chrome.yaml` as you see fit (and remove the #ddev-generated line). You can also just override lines in your `.ddev/config.yaml`
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.selenium-chrome.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ services:
- HTTPS_EXPOSE=7900:7900
- HTTP_EXPOSE=7910:7900
- VNC_NO_PASSWORD=1
external_links:
- ddev-router:${DDEV_SITENAME}.${DDEV_TLD}
# To enable VNC access for traditional VNC clients like macOS "Screen Sharing",
# uncomment the following two lines.
#ports:
Expand Down
36 changes: 33 additions & 3 deletions install.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,38 @@
name: ddev-selenium-standalone-chrome
pre_install_actions:

project_files:
- docker-compose.selenium-chrome.yaml
- config.selenium-standalone-chrome.yaml
global_files:

post_install_actions:
yaml_read_files:
- |
#ddev-nodisplay
#ddev-description:Checking docker-compose.selenium-chrome_extras.yaml for changes
if [ -f docker-compose.selenium-chrome_extras.yaml ] && ! grep -q '#ddev-generated' docker-compose.selenium-chrome_extras.yaml; then
echo "Existing docker-compose.selenium-chrome_extras.yaml does not have #ddev-generated, so can't be updated"
exit 2
fi
- |
#ddev-nodisplay
#ddev-description:Adding all hostnames to the selenium-chrome container to make them available
cat <<-END >docker-compose.selenium-chrome_extras.yaml
#ddev-generated
services:
selenium-chrome:
external_links:
{{- $selenium_chrome_hostnames := splitList "," (env "DDEV_HOSTNAME") -}}
{{- range $i, $n := $selenium_chrome_hostnames }}
- "ddev-router:{{- replace (env "DDEV_TLD") "\\${DDEV_TLD}" (replace (env "DDEV_PROJECT") "\\${DDEV_PROJECT}" $n) -}}"
{{- end }}
END
removal_actions:
- |
#ddev-nodisplay
#ddev-description:Remove docker-compose.selenium-chrome_extras.yaml file
if [ -f docker-compose.selenium-chrome_extras.yaml ]; then
if grep -q '#ddev-generated' docker-compose.selenium-chrome_extras.yaml; then
rm -f docker-compose.selenium-chrome_extras.yaml
else
echo "Unwilling to remove '$DDEV_APPROOT/.ddev/docker-compose.selenium-chrome_extras.yaml' because it does not have #ddev-generated in it; you can manually delete it if it is safe to delete."
fi
fi
Loading