Beispiel #1
0
func (p *dockerProvisioner) Deploy(a provision.App, w io.Writer) error {
	var deploy = func() error {
		c, err := newContainer(a)
		if err != nil {
			return err
		}
		err = c.deploy(w)
		if err != nil {
			c.remove()
		}
		return err
	}
	if containers, err := listAppContainers(a.GetName()); err == nil && len(containers) > 0 {
		for _, c := range containers {
			err = deploy()
			if err != nil {
				return err
			}
			a.RemoveUnit(c.Id)
		}
	} else if err := deploy(); err != nil {
		return err
	}
	a.Restart(w)
	app.Enqueue(queue.Message{
		Action: app.RegenerateApprcAndStart,
		Args:   []string{a.GetName()},
	})
	return nil
}
Beispiel #2
0
func startInBackground(a provision.App, c container, imageId string, w io.Writer, started chan bool) {
	_, err := start(a, imageId, w)
	if err != nil {
		log.Printf("error on start the app %s - %s", a, err)
	}
	if c.ID != "" {
		if a.RemoveUnit(c.ID) != nil {
			c.remove()
		}
	}
	started <- true
}
func startInBackground(a provision.App, c container, imageId string, w io.Writer, started chan bool) {
	newContainer, err := start(a, imageId, w)
	if err != nil {
		log.Printf("error on start the app %s - %s", a.GetName(), err)
	}
	msg := queue.Message{Action: app.BindService, Args: []string{a.GetName(), newContainer.ID}}
	go app.Enqueue(msg)
	if c.ID != "" {
		if a.RemoveUnit(c.ID) != nil {
			removeContainer(&c)
		}
	}
	started <- true
}
Beispiel #4
0
func startInBackground(a provision.App, c container, imageId string, w io.Writer, started chan bool) {
	_, err := start(a, imageId, w)
	if err != nil {
		log.Errorf("error on start the app %s - %s", a.GetName(), err)
		started <- false
		return
	}
	if c.ID != "" {
		if a.RemoveUnit(c.ID) != nil {
			removeContainer(&c)
		}
	}
	started <- true
}