A development environment combining battle-proven Dsnmasq as a local DNS server and Httpd as reliable webhost. You can take advantage of httpd's multitude of modules, with mod_rewrite, mod_ssl and mod_wsgi enabled by default. Thus the webhost can be a combination of file server, reverse proxy and WSGI for Flask and Django applications.
Keeping multiple development environments in sync can be a pain. Both the
configuration directory, hosted directory and DNS records can be
versioned. Pass the git repo addresses and branches as environment variables,
as described in stack.sample.env
.
It's a simple way of ensuring that dependencies and environments are the same in both live and multiple development environments, especially Apache setup and Python version.
./srv/webprojects
: served directory./srv/apache
: HTTPD config files./srv/certs
: An obvious place for SSL certificates./srv/ssh
: SSH folder for the webhost. Place your Github/Gitlab/Gitea private key here, if you intend to use private git repos. You can configure it by placing aconfig
file here../dnsmasq
: Should contain ahosts
file and adnsmasq.d
directory. All files with extension.conf
inside ofdnsmasq.d
will be included in the Dnsmasq configuration. Bind to a volume to take advantage of configuration versioned in git.
A startup script will setup the local DNS for you if you use MacOS. By default
it assumes you use Wi-Fi. If you use a different network, set it as a NETWORK
variable before running the script, e.g.:
export NETWORK=Ethernet; scripts/start
If you struggle with getting the local DNS to work on MacOS, a combination of these commands might help you troubleshoot your issues:
dscacheutil -q host -a name example.com
[1]scutil --dns
[2]
Docker's default setup prevents setting localhost as your DNS servers. To allow that, make sure that setting Use kernel networking for UDP is unchecked. You will find this setting under Docker Desktop > Settings > Resources > Network.