示例#1
0
func main() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	s := app.NewQingletServer()
	s.AddFlags(pflag.CommandLine)

	util.InitFlags()
	util.InitLogs()
	defer util.FlushLogs()

	verflag.PrintAndExitIfRequested()

	if err := s.Run(pflag.CommandLine.Args()); err != nil {
		fmt.Fprintf(os.Stderr, "%v\n", err)
		os.Exit(1)
	}
}
示例#2
0
func NewQingletExecutorServer() *QingletExecutorServer {
	k := &QingletExecutorServer{
		QingletServer:  app.NewQingletServer(),
		RunProxy:       true,
		ProxyExec:      "./qing-proxy",
		ProxyLogfile:   "./proxy-log",
		SuicideTimeout: config.DefaultSuicideTimeout,
	}
	if pwd, err := os.Getwd(); err != nil {
		log.Warningf("failed to determine current directory: %v", err)
	} else {
		k.RootDirectory = pwd // mesos sandbox dir
	}
	k.Address = util.IP(net.ParseIP(defaultBindingAddress()))
	k.ShutdownFD = -1 // indicates unspecified FD
	return k
}
示例#3
0
// NewQinglet creates a new hyperqing Server object that includes the
// description and flags.
func NewQinglet() *Server {
	s := qinglet.NewQingletServer()
	hks := Server{
		SimpleUsage: "qinglet",
		Long: `The qinglet binary is responsible for maintaining a set of containers on a
		particular node. It syncs data from a variety of sources including a
		QingYuan API server, an etcd cluster, HTTP endpoint or local file. It then
		queries Docker to see what is currently running.  It synchronizes the
		configuration data, with the running set of containers by starting or stopping
		Docker containers.`,
		Run: func(_ *Server, args []string) error {
			return s.Run(args)
		},
	}
	s.AddFlags(hks.Flags())
	return &hks
}