Esempio n. 1
0
File: main.go Progetto: lht/termite
func main() {
	port := flag.Int("port", 1233, "Where to listen for work requests.")
	secretFile := flag.String("secret", "secret.txt", "file containing password.")
	flag.Parse()

	secret, err := ioutil.ReadFile(*secretFile)
	if err != nil {
		log.Fatal("ReadFile", err)
	}

	c := termite.NewCoordinator(secret)
	c.Mux.HandleFunc("/bin/worker", serveBin("worker"))
	c.Mux.HandleFunc("/bin/shell-wrapper", serveBin("shell-wrapper"))

	go c.PeriodicCheck()
	c.ServeHTTP(*port)
}
Esempio n. 2
0
func main() {
	port := flag.Int("port", 1230, "Where to listen for work requests.")
	webPassword := flag.String("web-password", "killkillkill", "password for authorizing worker kills.")
	secretFile := flag.String("secret", "secret.txt", "file containing password or SSH identity.")
	flag.Parse()
	log.SetPrefix("C")

	secret, err := ioutil.ReadFile(*secretFile)
	if err != nil {
		log.Fatal("ReadFile", err)
	}

	opts := termite.CoordinatorOptions{
		Secret:      secret,
		WebPassword: *webPassword,
	}
	c := termite.NewCoordinator(&opts)
	c.Mux.HandleFunc("/bin/worker", serveBin("worker"))
	c.Mux.HandleFunc("/bin/shell-wrapper", serveBin("shell-wrapper"))

	log.Println(termite.Version())
	go c.PeriodicCheck()
	c.ServeHTTP(*port)
}