Пример #1
0
func (s *server) DoDeploy(w io.Writer, project, environment string, force bool) *DeployResult {
	start := time.Now()
	r := &DeployResult{}
	defer func() {
		r.Elapsed = time.Since(start)
	}()

	core.Info(
		"Starting deploy",
		"project", project, "environment", environment, "force", force,
	)

	p, ok := s.config.Projects[project]
	if !ok {
		core.Error("Project not found", "project", p)

		r.Errors = []error{ErrProjectNotFound}
		return r
	}

	r.Errors = p.Deploy(environment, w, force)
	if len(r.Errors) == 0 {
		r.Done = true
		core.Info("Deploy success", "project", p, "environment", environment)
	} else {
		for _, e := range r.Errors {
			core.Critical(e.Error(), "project", p, "environment", environment)
		}
	}

	return r
}
Пример #2
0
func (s *server) run() {
	writer := NewSockJSWriter(s.sockjs, "log")
	subs := subscribeWriteToEvents(writer)
	defer unsubscribeEvents(subs)

	core.Info("HTTP server running", "host:port", s.config.HTTP.Listen)
	if err := http.ListenAndServe(s.config.HTTP.Listen, s); err != nil {
		panic(err)
	}
}
Пример #3
0
func Start(version, build string) {
	core.Info("Starting HTTP daemon", "version", version, "build", build)
	flag.StringVar(&configFile, "config", config.DefaultConfig, "config file")
	flag.Parse()

	s := &server{serverID: fmt.Sprintf("dockership %s, build %s", version, build)}
	s.readConfig(configFile)
	s.configure()
	s.configStaticAssets()
	s.configureAuth()
	s.run()
}