Ejemplo n.º 1
0
func main() {
	u := flag.String("u", "127.0.0.1:7676", "updater location")
	p := flag.String("p", "", "pidfile of haproxy")
	t := flag.String("t", "", "config template path")
	c := flag.String("c", "/etc/haproxy/haproxy.cfg", "haproxy config path")
	b := flag.String("b", "127.0.0.1", "ip address to bind")
	m := flag.Int("m", 60, "maximum number seconds to keep previous haproxy running")
	flag.Parse()

	if *p == "" || *t == "" {
		flag.PrintDefaults()
		os.Exit(1)
	}

	timeout := time.Duration(*m) * time.Second

	ct, err := readTemplate(*t)
	if err != nil {
		log.Fatal("error reading template:", err)
	}

	conf := marathoner.NewHaproxyConfigurator(ct, *c, *b, *p, timeout)

	l := marathoner.NewListener(strings.Split(*u, ","), conf)
	l.Start()
}
Ejemplo n.º 2
0
func main() {
	u := flag.String("u", "127.0.0.1:7676", "updater location")
	flag.Parse()

	c := marathoner.NewStateLogger(stdOutStateLogger{})

	l := marathoner.NewListener(strings.Split(*u, ","), c)
	l.Start()
}