Beispiel #1
0
func envOpts() (opts []string) {
	for _, env := range cfg.Env {
		opts = append(opts, "-e", env)
	}

	old_cfg := cfg
	old_process := process

	for _, process := range config.List() {
		settings := config.Process(process)
		if settings.IncludeEnv {
			SetProcess(process)
			SetConfig(config.Process(process))

			for i := 0; i < cfg.Instances; i++ {
				if running() {
					net := networkSettings(i)
					name := fmt.Sprintf("%s_%d_IP=%s", process, i, net.Ip)
					opts = append(opts, "-e", strings.ToUpper(name))
					name = fmt.Sprintf("%s_%d_PORT=%s", process, i, net.Private.tcp)
					opts = append(opts, "-e", strings.ToUpper(name))
				}
			}
		}
	}

	cfg = old_cfg
	process = old_process
	return
}
Beispiel #2
0
func BundleInstall(args ...string) {
	if cfg == nil {
		config.LoadConfigs()
		for _, process := range config.List() {
			SetProcess(process)
			SetConfig(config.Process(process))
			BundleInstall(args...)
		}
	} else if cfg.UseBundler {
		runExec("bundle", "install", "--path", ".gems")
	}
}
Beispiel #3
0
func postUpdate() {
	if cfg == nil {
		config.LoadConfigs()
		for _, process := range config.List() {
			SetProcess(process)
			SetConfig(config.Process(process))
			postInstall()
		}
	} else if cfg.PostUpdate != "" {
		cmd := exec.Command(cfg.PostUpdate)
		cmd.Stdout = os.Stdout
		cmd.Stderr = os.Stderr
		cmd.Run()
	}
}
Beispiel #4
0
// Build will create the container if nessary
func Build(args ...string) {
	wd, _ := os.Getwd()
	logger.Log(fmt.Sprintf("In %s to build.", wd))
	if cfg != nil {
		logger.Log(fmt.Sprintf("Building...%s\n", cfg.App))
		cmd := exec.Command("docker", "build", "-t", cfg.Container, cfg.BuildFile)
		cmd.Stdout = os.Stdout
		cmd.Stderr = os.Stderr
		cmd.Stdin = os.Stdin
		cmd.Run()
	} else {
		config.LoadConfigs()
		for _, process := range config.List() {
			SetProcess(process)
			SetConfig(config.Process(process))
			Build(args...)
		}
	}
}