Skip to content

Add gh devlake start command #127

@ewega

Description

@ewega

Summary

Add a gh devlake start command that brings up stopped/crashed DevLake services for an existing deployment. This fills a lifecycle gap — the CLI has deploy (initial setup) and cleanup (teardown) but no way to restart services after a reboot, crash, or stop.

Motivating scenario: After a machine reboot, gh devlake status shows for config-ui (container exited), but offers no remediation. Users must manually find the docker-compose directory and run raw Docker commands.

Proposed Solution

Local deployments (Docker Compose)

  1. Auto-detect deployment from state file (.devlake-local.json) or fall back to docker-compose.yml in cwd
  2. Check Docker availability
  3. Run docker compose up -d (idempotent — starts stopped containers, recreates exited ones, no-op for running ones)
  4. Wait for backend health (/ping) with shorter timeout than deploy (~60s vs 6min — databases/volumes already exist)
  5. Print service URLs and health status

Azure deployments (Container Instances)

  1. Read container names + resource group from .devlake-azure.json
  2. Check Azure CLI login
  3. Run az container start for each container
  4. Wait for backend health
  5. Print endpoints

Key design decisions

  • Uses docker compose up -d (not docker compose start) because up -d handles both stopped AND crashed/exited containers
  • Shorter health timeout since databases and volumes already initialized
  • State file is NOT modified — Docker/Azure is the source of truth for runtime state

Flags

Flag Default Description
--service <name> (all) Start only a specific service (e.g., --service config-ui)
--no-wait false Skip health polling after start
--json false Machine-readable output

Scope of Changes

File Change
cmd/start.go New command implementation
cmd/deploy.go Register start in operate command group
cmd/status.go Add remediation hint when services are unhealthy (see #97)
docs/start.md New documentation
docs/day-2.md Add start to operations list
README.md Add to command reference table

Acceptance Criteria

  • gh devlake start brings up all services for a local deployment
  • gh devlake start --service config-ui restarts only config-ui
  • gh devlake start works for Azure deployments (reads state file)
  • Health polling with appropriate timeout
  • --json output supported
  • Graceful error when no state file or docker-compose.yml found
  • gh devlake status shows hint: "Run gh devlake start" when services are unhealthy

Dependencies

References

  • cmd/deploy_local.gostartLocalContainers() function contains reusable patterns
  • internal/docker/build.goComposeUp() already exists
  • internal/devlake/discovery.go — health polling and endpoint inference

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions