Skip to content

Instantly share code, notes, and snippets.

@jhmartin

jhmartin/createpoints.rb

Last active Aug 19, 2018
Embed
What would you like to do?
DNS LB Test compose
#!/usr/bin/env ruby
# Input is an ip address. Map it to a position in a list.
positioncount=0
linecount=0
indexes=Hash.new
STDIN.read.split("\n").each do |a|
a=a.chomp
if (! indexes.has_key?(a))
indexes[a]=positioncount
positioncount += 1
end
puts "#{linecount}\t#{indexes[a]}\n"
linecount += 1
end
version: "3.2"
networks:
net1:
services:
nginx:
# replace username/repo:tag with your name and image details
image: jhmartin/iptest-nginx:latest
deploy:
endpoint_mode: dnsrr
replicas: 100
restart_policy:
condition: on-failure
networks:
net1:
aliases:
- ip
ruby:
# replace username/repo:tag with your name and image details
image: jhmartin/iptest-ruby:latest
depends_on:
- nginx
deploy:
replicas: 1
restart_policy:
condition: none
networks:
- net1
node:
# replace username/repo:tag with your name and image details
image: jhmartin/iptest-node:latest
depends_on:
- nginx
deploy:
replicas: 1
restart_policy:
condition: none
networks:
- net1
python:
# replace username/repo:tag with your name and image details
image: jhmartin/iptest-python:latest
depends_on:
- nginx
deploy:
replicas: 1
restart_policy:
condition: none
networks:
- net1
java:
# replace username/repo:tag with your name and image details
image: jhmartin/iptest-java:latest
depends_on:
- nginx
deploy:
replicas: 1
restart_policy:
condition: none
networks:
- net1
php:
# replace username/repo:tag with your name and image details
image: jhmartin/iptest-php:latest
depends_on:
- nginx
deploy:
replicas: 1
restart_policy:
condition: none
networks:
- net1
set term png
set title "Ruby Simple LB"
plot "ruby.SIMPLE.dat"
set output "ruby.persist.png
plot "ruby.PERSIST.dat"
set output "python.simple.png"
plot "python.SIMPLE.dat"
set output "python.persist.png"
plot "python.PERSIST.dat"
set output "java.simple.png"
plot "java.SIMPLE.dat"
set output "java.persist.png"
plot "java.PERSIST.dat"
set output "php.simple.png"
plot "php.SIMPLE.dat"
set output "php.persist.png"
plot "php.PERSIST.dat"
set output "node.simple.png"
plot "node.SIMPLE.dat"
set output "node.persist.png"
plot "node.PERSIST.dat"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.