-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Summary
Add a gh devlake stop command that gracefully stops DevLake services without destroying containers, volumes, or state. This is the counterpart to gh devlake start (#127) and distinct from gh devlake cleanup which tears everything down permanently.
Mental model for users:
start— bring services up (safe, idempotent)stop— pause services (safe, non-destructive, data preserved)cleanup— permanent teardown (removes containers, volumes, files)
Proposed Solution
Local deployments (Docker Compose)
- Auto-detect deployment from state file (
.devlake-local.json) ordocker-compose.ymlin cwd - Run
docker compose stop(graceful stop — preserves containers and volumes for quick restart) - Print confirmation
Azure deployments (Container Instances)
- Read container names + resource group from
.devlake-azure.json - Check Azure CLI login
- Run
az container stopfor each container - Print confirmation
Key design decisions
- Uses
docker compose stop(notdocker compose down) — preserves containers and volumes for fast restart viastart - State file is NOT modified — Docker/Azure is the source of truth for runtime state
- No confirmation prompt needed (unlike
cleanup) since the operation is non-destructive
Prerequisites: ComposeStop in docker package
Add ComposeStop(dir string) error to internal/docker/build.go:
func ComposeStop(dir string) error {
cmd := execCommand("docker", "compose", "stop")
cmd.Dir = dir
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("docker compose stop failed: %s\n%s", err, string(out))
}
return nil
}Flags
| Flag | Default | Description |
|---|---|---|
--service <name> |
(all) | Stop only a specific service (e.g., --service grafana) |
Scope of Changes
| File | Change |
|---|---|
internal/docker/build.go |
Add ComposeStop() function |
internal/docker/docker_test.go |
Add test for ComposeStop (mock pattern exists) |
cmd/stop.go |
New command implementation |
cmd/deploy.go |
Register stop in operate command group |
docs/stop.md |
New documentation |
docs/day-2.md |
Add stop to operations list |
README.md |
Add to command reference table |
Acceptance Criteria
-
gh devlake stopgracefully stops all local services -
gh devlake stop --service grafanastops only Grafana -
gh devlake stopworks for Azure deployments (reads state file) - Containers and volumes preserved after stop (verifiable with
docker ps -a) -
gh devlake startbrings everything back up cleanly afterstop - Error message guides user when no state file or docker-compose.yml found
Dependencies
- Blocked by:
gh devlake start(Addgh devlake startcommand #127) — should be implemented together for lifecycle completeness
References
internal/docker/build.go—ComposeDown()andComposeUp()patternscmd/cleanup.go—runLocalCleanup()usesComposeDown(destructive counterpart)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request