informatica:linux:docker:webserver
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| informatica:linux:docker:webserver [2016/06/07 22:24] – created jose | informatica:linux:docker:webserver [2016/06/07 23:13] (current) – jose | ||
|---|---|---|---|
| Line 35: | Line 35: | ||
| | | ||
| Ahora creamos un balanceador de carga: | Ahora creamos un balanceador de carga: | ||
| + | |||
| + | **Dockefile** | ||
| + | FROM haproxy | ||
| + | COPY haproxy.cfg / | ||
| + | |||
| + | **haproxy.cfg** | ||
| + | < | ||
| + | global | ||
| + | log 127.0.0.1 | ||
| + | log 127.0.0.1 | ||
| + | maxconn 4096 | ||
| + | daemon | ||
| + | |||
| + | defaults | ||
| + | log | ||
| + | mode http | ||
| + | option | ||
| + | retries 3 | ||
| + | option redispatch | ||
| + | maxconn 2000 | ||
| + | contimeout | ||
| + | clitimeout | ||
| + | srvtimeout | ||
| + | |||
| + | frontend http | ||
| + | |||
| + | bind *:80 | ||
| + | |||
| + | | ||
| + | |||
| + | backend www | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | Creamos la imagen | ||
| + | docker build -t local/ | ||
| + | Arrancamos el container: | ||
| + | docker run -d -p 8800:80 local/ | ||
| + | | ||
| + | Si navegmos a localhost: | ||
| + | |||
| + | ===== Añadir otro servidor a la granja ===== | ||
| + | Podemos hacer que el fichero de configuración sea persistente: | ||
| + | docker run -p 8800:80 -d --name my-running-haproxy -v / | ||
| + | | ||
| + | Entonces hacemos un cambio y reiniciamos container: | ||
| + | docker restart my-running-haproxy | ||
| + | |||
| + | |||
informatica/linux/docker/webserver.1465338288.txt.gz · Last modified: by jose
