Created
June 25, 2018 17:36
-
-
Save danihodovic/c89d685b95b1023fc16591b6e74d1134 to your computer and use it in GitHub Desktop.
Testing HAProxy backend DNS resolution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http'); | |
const os = require('os'); | |
let num = 0; | |
setTimeout(() => { | |
console.log(os.hostname(), num); | |
process.exit(0); | |
}, 60000); | |
http.createServer(function (req, res) { | |
num++; | |
res.write('OK'); | |
res.end(); | |
}).listen(8000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: '2' | |
services: | |
haproxy: | |
image: haproxy | |
ports: | |
- '80:80' | |
volumes: | |
- './haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg' | |
api: | |
image: node | |
command: node /app.js | |
volumes: | |
- './app.js:/app.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resolvers docker | |
nameserver default 127.0.0.11:53 | |
hold valid 1000ms | |
frontend proxy | |
mode http | |
bind 0.0.0.0:80 maxconn 10000 | |
option http-server-close | |
option forwardfor | |
timeout client 5000 | |
default_backend api | |
backend api | |
mode http | |
timeout connect 100 | |
timeout server 5000 | |
option httpchk GET / | |
server-template api 5 api:8000 maxconn 10000 check inter 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment