Implement qrun restart command #47

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

User Story

As a developer, I want to restart my application so I can apply configuration changes or recover from issues without manual stop/start.

Design

Command Interface

# Rolling restart (default)
qrun restart --app orders-service --env prod

# Immediate restart (all at once)
qrun restart --app orders-service --env prod --strategy immediate

# Restart specific instance
qrun restart --app orders-service --env prod --instance orders-service-abc12

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

Output Format

Restarting orders-service in prod (rolling)...
  
  Instance orders-service-abc12: Stopping... Starting... Ready
  Instance orders-service-def34: Stopping... Starting... Ready
  Instance orders-service-ghi56: Stopping... Starting... Ready

Application orders-service restarted. (3/3 ready)
Downtime: 0s (rolling restart)

Voyage API Integration

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

{
  "environment": "prod",
  "strategy": "rolling",
  "instance": null
}

Response:
{
  "status": "restarting",
  "strategy": "rolling",
  "instances": ["abc12", "def34", "ghi56"],
  "message": "Restart initiated"
}

Files to Create/Modify

File Action Purpose
qctl-qrun/src/main/java/io/qrun/qctl/qrun/RestartCommand.java Create Main restart command
qctl-qrun/src/main/java/io/qrun/qctl/qrun/model/RestartResult.java Create Restart response model
qctl-qrun/src/main/java/io/qrun/qctl/qrun/model/RestartStrategy.java Create Strategy enum
qctl-qrun/src/main/java/io/qrun/qctl/qrun/client/VoyageClient.java Modify Add restartApp()

Implementation Tasks

  • Create RestartCommand with Picocli annotations
  • Add --app, --env, --strategy, --instance, --yes options
  • Create RestartResult model and RestartStrategy enum
  • Implement VoyageClient.restartApp() method
  • Support rolling (default) and immediate strategies
  • Track restart progress per instance
  • Calculate and display total downtime
  • Add confirmation prompt for production
  • Write unit tests for RestartCommand

Acceptance Criteria

  • qrun restart --app <app> --env <env> performs rolling restart
  • --strategy immediate restarts all at once
  • --instance restarts only specified instance
  • Shows progress for each instance
  • Reports total downtime
  • Prompts for confirmation on production (unless --yes)
  • Works with Voyage mock API
## User Story As a developer, I want to restart my application so I can apply configuration changes or recover from issues without manual stop/start. ## Design ### Command Interface ```bash # Rolling restart (default) qrun restart --app orders-service --env prod # Immediate restart (all at once) qrun restart --app orders-service --env prod --strategy immediate # Restart specific instance qrun restart --app orders-service --env prod --instance orders-service-abc12 # With confirmation skip qrun restart --app orders-service --env prod --yes ``` ### Output Format ``` Restarting orders-service in prod (rolling)... Instance orders-service-abc12: Stopping... Starting... Ready Instance orders-service-def34: Stopping... Starting... Ready Instance orders-service-ghi56: Stopping... Starting... Ready Application orders-service restarted. (3/3 ready) Downtime: 0s (rolling restart) ``` ### Voyage API Integration ``` POST /v1/apps/{app}/restart Content-Type: application/json { "environment": "prod", "strategy": "rolling", "instance": null } Response: { "status": "restarting", "strategy": "rolling", "instances": ["abc12", "def34", "ghi56"], "message": "Restart initiated" } ``` ## Files to Create/Modify | File | Action | Purpose | |------|--------|---------| | `qctl-qrun/src/main/java/io/qrun/qctl/qrun/RestartCommand.java` | Create | Main restart command | | `qctl-qrun/src/main/java/io/qrun/qctl/qrun/model/RestartResult.java` | Create | Restart response model | | `qctl-qrun/src/main/java/io/qrun/qctl/qrun/model/RestartStrategy.java` | Create | Strategy enum | | `qctl-qrun/src/main/java/io/qrun/qctl/qrun/client/VoyageClient.java` | Modify | Add restartApp() | ## Implementation Tasks - [ ] Create RestartCommand with Picocli annotations - [ ] Add --app, --env, --strategy, --instance, --yes options - [ ] Create RestartResult model and RestartStrategy enum - [ ] Implement VoyageClient.restartApp() method - [ ] Support rolling (default) and immediate strategies - [ ] Track restart progress per instance - [ ] Calculate and display total downtime - [ ] Add confirmation prompt for production - [ ] Write unit tests for RestartCommand ## Acceptance Criteria - [ ] `qrun restart --app <app> --env <env>` performs rolling restart - [ ] `--strategy immediate` restarts all at once - [ ] `--instance` restarts only specified instance - [ ] Shows progress for each instance - [ ] Reports total downtime - [ ] Prompts for confirmation on production (unless --yes) - [ ] Works with Voyage mock API
Sign in to join this conversation.