func main() { flag.Parse() if *printVersionInfo { fmt.Println("oort version:", oortVersion) fmt.Println("ring version:", ringVersion) fmt.Println("cmdctrl version:", cmdctrlVersion) fmt.Println("valuestore version:", valuestoreVersion) fmt.Println("build date:", buildDate) fmt.Println("go version:", goVersion) return } updater := cmdctrl.NewGithubUpdater( GithubRepo, GithubProject, BinaryName, BinaryPath, fmt.Sprintf("%s/%s.canary", *cwd, ServiceName), oortVersion, ) o, err := oort.New(ServiceName, *cwd, updater) if err != nil { log.Fatalln("Unable to obtain config:", err) } log.Println("Using groupstore backend") backend, err := oortstore.NewGroupStore(o) if err != nil { log.Fatalln("Unable to initialize GroupStore:", err) } sysmetrics.StartupMetrics(backend.Config.MetricsAddr, backend.Config.MetricsCollectors) o.SetBackend(backend) o.Serve() ch := make(chan os.Signal) signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) for { select { case <-ch: o.Exit() <-o.ShutdownComplete return case <-o.ShutdownComplete: return } } }
func main() { flag.Parse() if *printVersionInfo { fmt.Println("oort version:", oortVersion) fmt.Println("ring version:", ringVersion) fmt.Println("cmdctrl version:", cmdctrlVersion) fmt.Println("valuestore version:", valuestoreVersion) fmt.Println("build date:", buildDate) fmt.Println("go version:", goVersion) return } o, err := oort.New("group", *cwd) if err != nil { log.Fatalln("Unable to obtain config:", err) } log.Println("Using groupstore backend") backend, err := oortstore.NewGroupStore(o) if err != nil { log.Fatalln("Unable to initialize GroupStore:", err) } o.SetBackend(backend) o.Serve() http.Handle("/metrics", prometheus.Handler()) go http.ListenAndServe(":9100", nil) ch := make(chan os.Signal) signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) for { select { case <-ch: o.Exit() <-o.ShutdownComplete return case <-o.ShutdownComplete: return } } }