{"id":19696143,"url":"https://github.com/k911/haproxy-keepalived-docker","last_synced_at":"2025-04-29T11:31:54.781Z","repository":{"id":49382695,"uuid":"195693929","full_name":"k911/haproxy-keepalived-docker","owner":"k911","description":"R\u0026D project: Set-up Highly Available HAProxy via Keepalived using Docker-compose on bare metal or AWS","archived":false,"fork":false,"pushed_at":"2019-12-03T22:08:44.000Z","size":14,"stargazers_count":20,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T15:04:44.085Z","etag":null,"topics":["aws","docker","haproxy","keepalived"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/k911.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-07T20:25:20.000Z","updated_at":"2024-07-31T15:45:46.000Z","dependencies_parsed_at":"2022-08-25T10:41:28.345Z","dependency_job_id":null,"html_url":"https://github.com/k911/haproxy-keepalived-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k911%2Fhaproxy-keepalived-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k911%2Fhaproxy-keepalived-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k911%2Fhaproxy-keepalived-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k911%2Fhaproxy-keepalived-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k911","download_url":"https://codeload.github.com/k911/haproxy-keepalived-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251493955,"owners_count":21598204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","docker","haproxy","keepalived"],"created_at":"2024-11-11T19:34:00.332Z","updated_at":"2025-04-29T11:31:53.441Z","avatar_url":"https://github.com/k911.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Highly Available Load Balancing with Floating IP\n\nUsing Docker, Keepalived and HAProxy with NGINX server as a web application.\n\nNote: Cloud environments require manual configuration for creating/attaching/detaching Floating IP. For AWS see `aws/keepalived/notify.sh`.\n\n## Set-up\n\n```sh\n# enable ip_vs\nsudo modprobe ip_vs\n\n# configure system\n# see: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/load_balancer_administration/s1-initial-setup-forwarding-vsa\nsudo sysctl -w net.ipv4.ip_forward=1\nsudo sysctl -w net.ipv4.ip_nonlocal_bind=1\n```\n\n## Running\n\n### Config\n\n```yaml\nVirtual Server:\n    IP: 192.168.0.150/24\n    Port H2: 8080\n    Port HTTP: 80\nHost 1:\n    IP: 192.168.0.24/24\n    Interface: enp2s0\n    Instances:\n        - keepalived-a\n        - haproxy-a\n        - haproxy-b\n        - web-a\n        - web-b\nHost 2:\n    IP: 192.168.0.66/24\n    Interface: wlp3s0\n    Instances:\n        - keepalived-b\n        - haproxy-a\n        - haproxy-b\n        - web-a\n        - web-b\n```\n\n### Host 1\n\n```sh\ndocker-compose up -d keepalived-a haproxy-a haproxy-b web-a web-b\n```\n\n### Host 2\n\n```sh\ndocker-compose up -d keepalived-b haproxy-a haproxy-b web-a web-b\n```\n\n### Usage\n\n```sh\n##############\n# h2 protocol\n##############\ncurl 192.168.0.150:8080 --http2-prior-knowledge\n# Server B\ncurl 192.168.0.150:8080 --http2-prior-knowledge\n# Server A\n\n################\n# http protocol\n################\ncurl 192.168.0.150\n# Server B\ncurl 192.168.0.150\n# Server A\n```\n\n## Debugging\n\n### Wireshark\n\nLook for `vrrp` packets.\n\n### Getting docker's private ip address\n\n```sh\ndocker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker-compose ps -q)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk911%2Fhaproxy-keepalived-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk911%2Fhaproxy-keepalived-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk911%2Fhaproxy-keepalived-docker/lists"}