func (s *DirectorService) Start() error {
	err := s.directorConfig.Write()
	if err != nil {
		return err
	}

	migrationCommand := bltcom.CreateCommand(s.directorMigrationCommand)
	migrationCommand.Args = append(migrationCommand.Args, "-c", s.directorConfig.DirectorConfigPath())
	_, _, _, err = s.cmdRunner.RunComplexCommand(migrationCommand)
	if err != nil {
		return bosherr.WrapError(err, "running migrations")
	}

	directorCommand := bltcom.CreateCommand(s.directorStartCommand)
	directorCommand.Args = append(directorCommand.Args, "-c", s.directorConfig.DirectorConfigPath())
	s.directorProcess, err = s.cmdRunner.RunComplexCommandAsync(directorCommand)
	if err != nil {
		return bosherr.WrapError(err, "starting director")
	}

	s.directorProcess.Wait()

	err = s.portWaiter.Wait("DirectorService", "127.0.0.1", s.directorConfig.DirectorPort())
	if err != nil {
		return bosherr.WrapError(err, "Waiting for director to start up")
	}

	for i := 1; i <= s.numWorkers; i++ {
		workerStartCommand := bltcom.CreateCommand(s.workerStartCommand)
		workerStartCommand.Env["QUEUE"] = "normal"
		workerStartCommand.Args = append(workerStartCommand.Args, "-c", s.directorConfig.WorkerConfigPath(i), "-i", strconv.Itoa(i))

		workerProcess, err := s.cmdRunner.RunComplexCommandAsync(workerStartCommand)
		if err != nil {
			return bosherr.WrapError(err, "starting worker")
		}
		workerProcess.Wait()
		s.workerProcesses = append(s.workerProcesses, workerProcess)

		if err != nil {
			return bosherr.WrapError(err, "Waiting for worker to start up")
		}
	}

	return s.waitForWorkersToStart()
}
func (s *NatsService) Start() error {
	var err error
	natsStartCommand := bltcom.CreateCommand(s.natsStartCommand)
	natsStartCommand.Args = append(natsStartCommand.Args, "-p", strconv.Itoa(s.natsPort), "-T")
	s.process, err = s.cmdRunner.RunComplexCommandAsync(natsStartCommand)
	if err != nil {
		return bosherr.WrapError(err, "starting nats")
	}

	s.process.Wait()

	return s.portWaiter.Wait("NatsService", "127.0.0.1", s.natsPort)
}
func (s *NginxService) Start() error {
	nginxStartCommand := bltcom.CreateCommand(s.nginxStartCommand)
	configPath, err := s.assetsProvider.FullPath("nginx.yml")
	if err != nil {
		return bosherr.WrapError(err, "Getting nginx config path")
	}

	nginxStartCommand.Args = append(nginxStartCommand.Args, "-c", configPath)

	s.process, err = s.cmdRunner.RunComplexCommandAsync(nginxStartCommand)
	if err != nil {
		return bosherr.WrapError(err, "starting nginx")
	}

	s.process.Wait()
	return s.portWaiter.Wait("NginxService", "127.0.0.1", s.nginxPort)
}
func (f *factory) Create() Runner {
	cmd := bltcom.CreateCommand(f.cliPath)

	return NewRunner(cmd, f.cmdRunner, f.fs)
}