|
|
|
@ -8,6 +8,7 @@ import (
|
|
|
|
|
"os" |
|
|
|
|
"os/exec" |
|
|
|
|
"path" |
|
|
|
|
"regexp" |
|
|
|
|
"strings" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
@ -188,6 +189,37 @@ func DockerComposeUp(
|
|
|
|
|
go (func() { |
|
|
|
|
for logLine := range logLinesChannel { |
|
|
|
|
logLines = append(logLines, logLine) |
|
|
|
|
split := strings.Split(logLine, " ... ") |
|
|
|
|
if len(split) == 2 { |
|
|
|
|
leftSide := strings.Split(strings.TrimSpace(split[0]), " ") |
|
|
|
|
status := split[1] |
|
|
|
|
if len(leftSide) == 2 { |
|
|
|
|
action := leftSide[0] |
|
|
|
|
containerName := leftSide[1] |
|
|
|
|
for moduleName, _ := range configs { |
|
|
|
|
moduleNameUnderscore := fmt.Sprintf("%s_", moduleName) |
|
|
|
|
if strings.HasPrefix(containerName, moduleNameUnderscore) { |
|
|
|
|
serviceName := strings.TrimPrefix(containerName, moduleNameUnderscore) |
|
|
|
|
serviceName = regexp.MustCompile("_[0-9]$").ReplaceAllString(serviceName, "") |
|
|
|
|
if simpleStatus.Modules[moduleName] != nil { |
|
|
|
|
for _, service := range simpleStatus.Modules[moduleName].Resources { |
|
|
|
|
if service.DisplayName == serviceName { |
|
|
|
|
if status == "done" { |
|
|
|
|
service.State = "ok" |
|
|
|
|
} else if action == "Recreating" { |
|
|
|
|
service.State = "modifying" |
|
|
|
|
} else if action == "Creating" { |
|
|
|
|
service.State = "creating" |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
})() |
|
|
|
|
|
|
|
|
@ -222,8 +254,8 @@ func DockerComposeUp(
|
|
|
|
|
// TODO handle panics in here with abort
|
|
|
|
|
details := applicationModulesMap[moduleName] |
|
|
|
|
|
|
|
|
|
process := exec.Command("docker-compose", "--no-ansi", "up", "-d") |
|
|
|
|
logLinesChannel <- fmt.Sprintf("\n(%s) $ docker-compose --no-ansi up -d\n", details.WorkingDir) |
|
|
|
|
process := exec.Command("docker-compose", "--no-ansi", "up", "-d", "--remove-orphans") |
|
|
|
|
logLinesChannel <- fmt.Sprintf("\n(%s) $ docker-compose --no-ansi up -d --remove-orphans\n", details.WorkingDir) |
|
|
|
|
process.Dir = details.WorkingDir |
|
|
|
|
|
|
|
|
|
stdoutPipe, err := process.StdoutPipe() |
|
|
|
@ -259,6 +291,9 @@ func DockerComposeUp(
|
|
|
|
|
} |
|
|
|
|
dockerComposeIsRunning = false |
|
|
|
|
|
|
|
|
|
time.Sleep(time.Millisecond * 100) |
|
|
|
|
close(logLinesChannel) |
|
|
|
|
|
|
|
|
|
outputChannel <- TerraformApplyResult{ |
|
|
|
|
Error: nil, |
|
|
|
|
Complete: true, |
|
|
|
|