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

Implement ability to configure (and persist) dnsmasq configuration for alternate TLDs #214

Closed
davidalger opened this issue Aug 20, 2020 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@davidalger
Copy link
Collaborator

davidalger commented Aug 20, 2020

Warden will currently run a site on any TLD (based on the TRAEFIK_DOMAIN setting in a projects .env file) but dnsmasq will only respond with 127.0.0.1 for the default .test TLD.

There is a workaround, but it involves modifying a configuration file and is rather clunky…

a) Add a line like the following to the config/dnsmasq.conf (this will be wherever Warden is installed)

address=/.mytld/127.0.0.1

b) Update and restart the dnsmasq container:

warden svc up --force-recreate dnsmasq

c) Tell MacOS to send DNS lookups for the custom TLD to the local dnsmasq service (Linux does not have the ability to specify per-TLD resolvers so this is not required on Linux hosts where it's all-or-nothing passing through the dnsmasq service)

echo 'nameserver 127.0.0.1' | sudo tee /etc/resolver/mytld

When implemented Warden should have a configuration setting WARDEN_SVC_DNSMASQ_TLDS which supports a comma-delimited list of TLDs to generate rules for in the configuration provided to dnsmasq.

@davidalger davidalger added the enhancement New feature or request label Aug 20, 2020
@davidalger davidalger added this to the Warden 0.10.0 milestone Aug 20, 2020
@davidalger
Copy link
Collaborator Author

This has been implemented in commit 514e674 by removing the copy-file/mount mechanism and replacing it with writing the config via docker-compose environment variables and a custom entrypoint.

For example, configuring a custom TLD can now be accomplished by adding the following to ~/.warden/.env to inject additional configuration into the dnsmasq container via standard docker-compose .env file processing:

WARDEN_DNSMASQ_CONF_ADDITIONAL="address=/.local/127.0.0.1"

or

WARDEN_DNSMASQ_CONF_ADDITIONAL="address=/.local/127.0.0.1\naddress=/.dev/127.0.0.1"

This implementation also now allows for easily overriding the use of CloudFlare DNS by setting custom values on WARDEN_DNSMASQ_NS1 and WARDEN_DNSMASQ_NS2.

After changing settings in the env file, simply run warden svc up to recreate dnsmasq with the new configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant