Code Monkey home page Code Monkey logo

eos-docker-haproxy's Introduction

Alt text How to run a HAproxy docker container on Arista EOS as a reverse proxy.

This is a simple example of running a load balancer on a switch to proxy all web connections to two servers connected to it. In this example we are using HAproxy as a container which is running in both --host network and --priveledged mode so it can talk directly to the kernel. So any web traffic that wants to connect to the switch on port 8888 will be redirected to either host1 or host2 on port 5000. Both hosts are running small flask apps that return the hostname and IP that they are use to reverse proxy to.

All haproxy,ansible and bash scripts are located in the scripts folder.

Instructions..

git clone github.com/burnyd/eos-docker-haproxy cd eos-docker-haproxy

vagrant up leaf1a spine1 spine2 mgt1 host1 host2 vagrant ssh mgt1 cd /vagrant/scripts/ansible/ ansible-playbook leaf_bgp.yaml spine_bgp.yaml mgt1.yaml #Password is vagrant

disconnect from mgt1 vagrant ssh leaf1a sudo su docker service start

docker run --privileged --network=host --rm -it -v /mnt/flash/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro -v /dev/log:/dev/log haproxy &

vagrant@mgt1:~$ curl leaf1a:8888/hostname/ Web connection from host1 to 10.0.5.2

vagrant@mgt1:~$ curl leaf1a:8888/hostname/ Web connection from host2 to 10.0.5.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.