Closed elmar-hinz closed 8 years ago
Easiest solution: Map the webserver to different ports and use a reverse proxy
With WebDevOps Vagrant VM there is a basic setup for this - you only have to change the defaullt configuration.
I'm using a local haproxy in conjunction with dnsmasq for that. So each instance is called by s.th. such as http://project1.dev that maps to localhost:8001 and so on
haproxy example config:
global
daemon
maxconn 4096
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http-in
bind *:80
acl is_site1 hdr_end(host) -i www.dev
acl is_site2 hdr_end(host) -i intranet.dev
acl is_site3 hdr_end(host) -i test.dev
use_backend www if is_site1
use_backend intranet if is_site2
use_backend test if is_site3
backend www
balance roundrobin
option httpclose
option forwardfor
server s2 127.0.0.1:8000 maxconn 32
...
I describe an approach that is working on OS X with a vagrant based docker machine.
brew install haproxy
127.0.0.1 elmarhinz.typo3
[...]
acl is_site1 hdr_end(host) -i elmarhinz.typo3
[...]
server server1 192.168.56.2:8000 maxconn 32
All in all it is a lot of configuration to do by hand. To be improved.
Reflection:
Mapping domains to servers is the natural field of a DNS. Ipf suggests dnsmasq. Additionally a loadbalancer is used to map to ports. Like bying a whole factory to get a hammer.
Is it the right approach to map the docker servers to ports instead of giving them IP addresses? IP based a DNS alone would do the job or even simple entries in /etc/hosts.
New boilerplate (devel
branch) is prepared for dinghy or dory and automatic nginx reverse proxy using VIRTUAL_HOST
as docker environment variable
see https://github.com/codekitchen/dinghy and https://github.com/FreedomBen/dory
New boilerplate (devel
branch) is prepared for dinghy or dory and automatic nginx reverse proxy using VIRTUAL_HOST
as docker environment variable
see https://github.com/codekitchen/dinghy and https://github.com/FreedomBen/dory
This may be a little off topic. However, once having multiple dockers running locally the question pops up, how to address them easily.
How to map
192.168.56.2:8007
totypo7:80
and192.168.56.2:8008
totypo8:80
? Just to pick up 2 examples.Is there an easy setup, maybe a graphical tool?