예제 #1
0
파일: daemon.go 프로젝트: NetSys/quilt
// Run starts the daemon.
func (dCmd *Daemon) Run() int {
	conn := db.New()
	go engine.Run(conn)
	go server.Run(conn, dCmd.host)
	cluster.Run(conn)
	return 0
}
예제 #2
0
파일: run.go 프로젝트: NetSys/quilt
// Run blocks executing the minion.
func Run() {
	// XXX Uncomment the following line to run the profiler
	//runProfiler(5 * time.Minute)

	log.Info("Minion Start")

	conn := db.New()
	dk := docker.New("unix:///var/run/docker.sock")

	// Not in a goroutine, want the plugin to start before the scheduler
	plugin.Run()

	go minionServerRun(conn)
	go supervisor.Run(conn, dk)
	go scheduler.Run(conn, dk)
	go network.Run(conn, dk)
	go etcd.Run(conn)
	go syncAuthorizedKeys(conn)

	go apiServer.Run(conn, fmt.Sprintf("tcp://0.0.0.0:%d", api.DefaultRemotePort))

	loopLog := util.NewEventTimer("Minion-Update")
	for range conn.Trigger(db.MinionTable).C {
		loopLog.LogStart()
		conn.Transact(func(view db.Database) error {
			minion, err := view.MinionSelf()
			if err != nil {
				return err
			}

			updatePolicy(view, minion.Role, minion.Spec)
			return nil
		})
		loopLog.LogEnd()
	}
}