https://github.com/prabaprakash/docker_haproxy_base
Docker build HAProxy Base Setup
https://github.com/prabaprakash/docker_haproxy_base
docker haproxy proxy-server
Last synced: 4 months ago
JSON representation
Docker build HAProxy Base Setup
- Host: GitHub
- URL: https://github.com/prabaprakash/docker_haproxy_base
- Owner: prabaprakash
- Created: 2018-01-30T10:37:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-30T12:34:22.000Z (over 7 years ago)
- Last Synced: 2025-01-14T09:54:40.869Z (5 months ago)
- Topics: docker, haproxy, proxy-server
- Homepage:
- Size: 50.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Haproxy for Docker Containers
Steps:
1. Create Isolated Network for docker
`docker network create isolated_network`
2. For every container docker compose file, add the network configuration to use the `isolated_network`
```
networks:
default:
Use a custom driver
external:
name: isolated_network
```
3. For ex: containers for nginx running on port 8080
get the container name : `docker_container_a:8080`4. Add the subdomain config & container config in haproxy config for redirect subdomain route to `docker_container_a:8080`
```
defaults
mode http
timeout connect 5s
timeout client 120s
timeout server 120s
frontend mywebsite
bind *:80
acl host_sub2 hdr(host) -i subdomain.domain.com
use_backend sub2_nodes if host_sub2
default_backend webservers
backend webservers
balance roundrobin
server web1 docker_container_0:80 check
server web2 docker_container_0:80 checkbackend sub2_nodes
mode http
balance roundrobin
stick-table type ip size 200k expire 30m
stick on src
server node1 docker_container_a:8080 check
```