Corne
Corne

Reputation: 17

Multiple instances of Redmine on Docker

I've been trying to host multiple instances of Redmine on two seperate subdomains, so for example redmine.domain-a.com and redmine.domain-b.com. I need both of them to have SSL certificates and I normally use Let's Encrypt for that, and I found this.

https://github.com/glego/redmine-nginx-letsencrypt

I managed to set up one Redmine, but I can't figure out a way to set up the second one. Either I run into port conflicts for nginx or I only add the redmine container with different virtual domains and ports and it starts fine, but then it's still not accessable on the subdomain. This is the first time I'm using Docker and perhaps it's worth mentioning that my VPS is running Debian 8.

Upvotes: 1

Views: 575

Answers (1)

Sebastian
Sebastian

Reputation: 1722

If you want to run 2 web-server (docker container) on the same machine under the same ip-address and port you have to add a reverse proxy like HAProxy to your configuration. This is because the network connection will always be based on your servers IP and the port (80, 443 for web). But the HTTP(s) request will contain the hostname. A reverse proxy like HAProxy takes the HTTP request, looks at the hostname and forwards the request to the container wich may have a different port or even a different IP address (You could forward the request to the containers internal IP, this way no port mapping would be required).

Your certificates will also be served by the load-balancer, which may this way function as HTTPS termiation proxy.

This would be the request flow:

                         ┌-> Container 1
Client --> ReverseProxy -|
                         └-> Container 2
  • Your ReverseProxy (eg. HaProxy) listens on your public ip and port 80/443.
  • The both container are only reachable on your host and may be accessd via their internal docker ip or a prot mapping.

Upvotes: 1

Related Questions