fix(stacks): RestartStack now uses up -d with env vars
Previously used bare "docker compose restart" which doesn't inject env vars or pick up template changes. Now matches StartStack behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -450,14 +450,18 @@ func (m *Manager) RestartStack(name string) error {
|
||||
m.logger.Printf("[INFO] Restarting stack: %s", name)
|
||||
start := time.Now()
|
||||
dir := filepath.Dir(stack.ComposePath)
|
||||
env := m.stackEnv(dir)
|
||||
|
||||
if _, err := m.composeExec(dir, "restart"); err != nil {
|
||||
// Use "up -d" instead of bare "restart" so that env vars from app.yaml
|
||||
// are injected and any template changes (new images, healthchecks) are
|
||||
// picked up. Plain "docker compose restart" only sends SIGTERM+start
|
||||
// to existing containers without re-reading the compose file or env.
|
||||
if _, err := m.composeExecCustomEnv(dir, env, "up", "-d"); err != nil {
|
||||
m.logger.Printf("[ERROR] Stack %s restart failed after %.1fs: %v", name, time.Since(start).Seconds(), err)
|
||||
return fmt.Errorf("restarting stack %s: %w", name, err)
|
||||
}
|
||||
|
||||
m.logger.Printf("[INFO] Stack %s restarted successfully (took %.1fs)", name, time.Since(start).Seconds())
|
||||
env := m.stackEnv(dir)
|
||||
m.logPostStartStatus(name, dir, env)
|
||||
return m.RefreshStatus()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user