Source: TUTUM / DOCKER
DEPRECATED: use tutum/haproxy instead. HAProxy image that load balances between any linked container that listens in port 80. It also auto-reconfigures itself if deployed in Tutum.
DEPRECATED: use tutum/haproxy instead. HAProxy image that load balances between any linked container that listens in port 80. It also auto-reconfigures itself if deployed in Tutum.
tutum-docker-clusterproxy
HAproxy image that balances between linked containers and, if launched in Tutum, reconfigures itself when a linked cluster member joins or leaves
Usage
Make sure your application container exposes port 80. Then, launch it:
docker run -d -p 8000:80 --name web1 tutum/hello-world
docker run -d -p 8001:80 --name web2 tutum/hello-world
Then, run tutum/haproxy-http linking it to the target containers:
docker run -d -p 80:80 --link web1:web1 --link web2:web2 tutum/haproxy-http
Usage within Tutum
Make sure your application container exposes port 80, and launch it within Tutum's web interface in a cluster.
Then, launch a container (or a cluster) with tutum/haproxy-http which is linked to the application cluster created earlier, and with “Full Access” API role (or other appropiate read-only role).
That's it - the proxy container will start querying Tutum's API for an updated list of application cluster members and reconfigure itself automatically.
The Dockerfile is :
-------------------------------------------------------------
FROM ubuntu:latest MAINTAINER Bernardo Pericacho <bernardo@tutum.co> # Install required packages RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y haproxy supervisor python-pip # Add configuration and scripts ADD haproxy.cfg /etc/haproxy/haproxy.cfg ADD haproxy.cfg.json /etc/haproxy/empty_haproxy.cfg.json ADD haproxy.cfg.json /etc/haproxy/haproxy.cfg.json ADD requirements.txt /requirements.txt ADD supervisord-balancer.conf /etc/supervisor/conf.d/supervisord-balancer.conf ADD main.py /main.py ADD run.sh /run.sh RUN chmod 755 /*.sh RUN pip install -r /requirements.txt ENV PORT 80 EXPOSE 80 CMD ["/run.sh"]
----------------------------------------------
The Dockerfile is :
-------------------------------------------------------------
FROM ubuntu:latest MAINTAINER Bernardo Pericacho <bernardo@tutum.co> # Install required packages RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y haproxy supervisor python-pip # Add configuration and scripts ADD haproxy.cfg /etc/haproxy/haproxy.cfg ADD haproxy.cfg.json /etc/haproxy/empty_haproxy.cfg.json ADD haproxy.cfg.json /etc/haproxy/haproxy.cfg.json ADD requirements.txt /requirements.txt ADD supervisord-balancer.conf /etc/supervisor/conf.d/supervisord-balancer.conf ADD main.py /main.py ADD run.sh /run.sh RUN chmod 755 /*.sh RUN pip install -r /requirements.txt ENV PORT 80 EXPOSE 80 CMD ["/run.sh"]
----------------------------------------------
Comentarios
Publicar un comentario