1
0
Fork 0
docker-easy-haproxy/README.md
Joao Gilberto Magalhaes 87b7b81994 Update README.md
2018-12-25 22:01:22 -06:00

92 lines
1.7 KiB
Markdown

# Easy HAProxy
This Docker image will create dynamically the `haproxy.cfg` based on very simple Yaml.
# Features
- Enable or disable Stats on port 1936 with custom password
- Simple mapping host => host:port
- Simple redirect host => host:port
# Basic Usage
Create a yaml file in your machine called `easyconfig.cfg` and put the contents:
```yaml
stats:
username: admin
password: senha
port: 1936 # Optional (default 1936)
customerrors: true # Optional (default false)
easymapping:
- port: 80
hosts:
host1.com.br: container:5000
host2.com.br: other:3000
redirect:
www.host1.com.br: http://host1.com.br
- port: 8080
hosts:
host3.com.br: domain:8181
```
Then run (remember to enable the proper ports):
```bash
docker run \
-v /path/to/local:/etc/easyconfig \
-p 80:80 \
-p 8080:8080 \
-p 1936:1936 \
--name easy-haproxy-instance \
-d byjg/easy-haproxy
```
# Mapping custom .cfg files
Just create a folder and put files with the extension .cfg. and map the volume to the container.
This will concatenate your config into the main haproxy.cfg
```bash
docker run \
/* other parameters */
-v /your/local/conf.d:/etc/haproxy/conf.d \
-d byjg/easy-haproxy
```
Check if your config is ok:
```bash
docker run \
/* other parameters */
-v /your/local/conf.d:/etc/haproxy/conf.d \
-byjg/easy-haproxy -c -f /etc/haproxy/haproxy.cfg
```
# Docker Compose
```yaml
version: "3.4"
services:
front:
image: byjg/easy-haproxy
volume:
- /path/to/local:/etc/easyconfig
ports:
- 80:80
- 8080:8080
- 1936:1936
```
# Build
```
docker build -t byjg/easy-haproxy .
```