Skip to content

feat: add ps restart command with --force flag#160

Open
blsmth wants to merge 2 commits into
mainfrom
agent/go-engineer/adhoc-0a5e6e32
Open

feat: add ps restart command with --force flag#160
blsmth wants to merge 2 commits into
mainfrom
agent/go-engineer/adhoc-0a5e6e32

Conversation

@blsmth

@blsmth blsmth commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds apppack ps restart <process_type> CLI command (closes Add ps restart command #39)
  • Graceful path (default): calls ECS UpdateService with ForceNewDeployment: true for a zero-downtime rolling restart
  • Forced path (--force): stops all running containers matching the apppack:processType tag via StopTask; ECS relaunches them automatically
  • Pipelines without a review app are blocked (same guard as ps scale)

Implementation

  • app/app.go: new RestartProcess(processType string, force bool) error method + unexported getTagFromTask helper
  • cmd/ps.go: new psRestartCmd registered under psCmd, with --force bool flag

Notes

The required IAM permissions (ecs:UpdateService, ecs:StopTask, ecs:ListTasks, ecs:DescribeTasks scoped by ecs:cluster) were already added to WebOperatorRole in apppack-backend commit 45261d2 - this is CLI-only work.

Closes #39

blsmth added 2 commits July 23, 2026 13:03
Implements #39. Adds `apppack ps restart <process_type>`
with two modes:

- Graceful (default): calls ECS UpdateService with ForceNewDeployment=true
  to trigger a rolling restart without downtime.
- Forced (--force): calls DescribeTasks to find running tasks matching the
  apppack:processType tag, then stops each via StopTask so ECS relaunches
  them immediately.

The required IAM permissions (ecs:UpdateService, ecs:StopTask, ecs:ListTasks,
ecs:DescribeTasks scoped by ecs:cluster) were already added to WebOperatorRole
in apppack-backend commit 45261d2.
@blsmth

blsmth commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Tested on sandbox

Deployed apppackio/apppack-demo-python to the apppack-sandbox account (cluster apppack, us-east-1), built it (build #1 SUCCEEDED), and exercised both paths against the live web service:

Test Result
ps restart --help renders
Graceful ps restart web ForceNewDeployment — new task rolled in, old task drained (zero-downtime)
Force ps restart web --force ✅ running task killed, ECS relaunched a fresh one
WebOperatorRole carries perms ecs:UpdateService + ecs:StopTask present on the app's ManageExecution policy

Note: ran via --aws-credentials (admin), so the command logic is proven; I separately confirmed the WebOperatorRole inline policy grants both actions, so federated users are covered too.

Follow-up added

Added an AccessDenied handler (commit 2dabd9d): older stacks created before the WebOperatorRole gained these ECS permissions now get a helpful hint (apppack upgrade app <name>) instead of a raw error. This addresses the "needs additional permissions on the WebOperatorRole" concern from #39 — the perms ship in the current formation (apppack-backend 45261d2), but already-deployed stacks need an upgrade to pick them up.

@blsmth blsmth mentioned this pull request Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ps restart command

1 participant