Implement qrun stop command #45

Open
opened 2026-01-03 23:45:53 +00:00 by KofTwentyTwo · 0 comments
KofTwentyTwo commented 2026-01-03 23:45:53 +00:00 (Migrated from github.com)

User Story

As a developer, I want to stop my running application so I can perform maintenance or save resources when the service is not needed.

Design

Command Interface

# Stop application
qrun stop --app orders-service --env prod

# Force stop (skip graceful shutdown)
qrun stop --app orders-service --env prod --force

# With confirmation skip
qrun stop --app orders-service --env prod --yes

Output Format

Stopping orders-service in prod...
  Draining connections... done
  Waiting for graceful shutdown (30s timeout)... done
  Instances stopped: 3/3

Application orders-service stopped.
To start again: qrun start --app orders-service --env prod

Voyage API Integration

POST /v1/apps/{app}/stop
Content-Type: application/json

{
  "environment": "prod",
  "force": false,
  "gracePeriodSeconds": 30
}

Response:
{
  "status": "stopping",
  "stoppedInstances": 3,
  "message": "Application stop initiated"
}

Files to Create/Modify

File Action Purpose
qctl-qrun/src/main/java/io/qrun/qctl/qrun/StopCommand.java Create Main stop command
qctl-qrun/src/main/java/io/qrun/qctl/qrun/model/StopResult.java Create Stop response model
qctl-qrun/src/main/java/io/qrun/qctl/qrun/client/VoyageClient.java Modify Add stopApp()
qctl-shared/src/main/java/io/qrun/qctl/shared/Confirmation.java Create Confirmation prompt utility

Implementation Tasks

  • Create StopCommand with Picocli annotations
  • Add --app, --env, --force, --yes options
  • Create StopResult model class
  • Implement VoyageClient.stopApp() method
  • Add confirmation prompt for production environments
  • Implement graceful shutdown progress display
  • Handle timeout scenarios
  • Show helpful next-step commands
  • Write unit tests for StopCommand

Acceptance Criteria

  • qrun stop --app <app> --env <env> stops the application
  • Prompts for confirmation on production (unless --yes)
  • --force skips graceful shutdown
  • Shows progress during shutdown
  • Clear error message if app not running
  • Displays command to restart
  • Works with Voyage mock API
## User Story As a developer, I want to stop my running application so I can perform maintenance or save resources when the service is not needed. ## Design ### Command Interface ```bash # Stop application qrun stop --app orders-service --env prod # Force stop (skip graceful shutdown) qrun stop --app orders-service --env prod --force # With confirmation skip qrun stop --app orders-service --env prod --yes ``` ### Output Format ``` Stopping orders-service in prod... Draining connections... done Waiting for graceful shutdown (30s timeout)... done Instances stopped: 3/3 Application orders-service stopped. To start again: qrun start --app orders-service --env prod ``` ### Voyage API Integration ``` POST /v1/apps/{app}/stop Content-Type: application/json { "environment": "prod", "force": false, "gracePeriodSeconds": 30 } Response: { "status": "stopping", "stoppedInstances": 3, "message": "Application stop initiated" } ``` ## Files to Create/Modify | File | Action | Purpose | |------|--------|---------| | `qctl-qrun/src/main/java/io/qrun/qctl/qrun/StopCommand.java` | Create | Main stop command | | `qctl-qrun/src/main/java/io/qrun/qctl/qrun/model/StopResult.java` | Create | Stop response model | | `qctl-qrun/src/main/java/io/qrun/qctl/qrun/client/VoyageClient.java` | Modify | Add stopApp() | | `qctl-shared/src/main/java/io/qrun/qctl/shared/Confirmation.java` | Create | Confirmation prompt utility | ## Implementation Tasks - [ ] Create StopCommand with Picocli annotations - [ ] Add --app, --env, --force, --yes options - [ ] Create StopResult model class - [ ] Implement VoyageClient.stopApp() method - [ ] Add confirmation prompt for production environments - [ ] Implement graceful shutdown progress display - [ ] Handle timeout scenarios - [ ] Show helpful next-step commands - [ ] Write unit tests for StopCommand ## Acceptance Criteria - [ ] `qrun stop --app <app> --env <env>` stops the application - [ ] Prompts for confirmation on production (unless --yes) - [ ] `--force` skips graceful shutdown - [ ] Shows progress during shutdown - [ ] Clear error message if app not running - [ ] Displays command to restart - [ ] Works with Voyage mock API
Sign in to join this conversation.