diff options
| author | bndw <ben@bdw.to> | 2026-01-25 08:06:56 -0800 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2026-01-25 08:06:56 -0800 |
| commit | 85e97bf1ebe339513ab0661f6cc1ab1ff17a46cb (patch) | |
| tree | bd65f952b632375d0512aaf32ce17fd79ae1b262 /internal/state/state.go | |
| parent | 8a3cff0dd7eb88cadb73a6df4e14f85450d63317 (diff) | |
Add CPU and memory limits for apps
Adds --memory and --cpu flags to set systemd resource limits:
ship --binary ./app --memory 512M --cpu 100%
Also adds config update mode - use --name without --binary to
update an existing app's config without redeploying the binary:
ship --name myapp --cpu 50%
ship --name myapp --memory 256M --env DEBUG=true
Limits are stored in state and preserved on redeploy.
Diffstat (limited to 'internal/state/state.go')
| -rw-r--r-- | internal/state/state.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/state/state.go b/internal/state/state.go index c6de34a..38657cb 100644 --- a/internal/state/state.go +++ b/internal/state/state.go | |||
| @@ -22,12 +22,14 @@ type Host struct { | |||
| 22 | 22 | ||
| 23 | // App represents a deployed application or static site | 23 | // App represents a deployed application or static site |
| 24 | type App struct { | 24 | type App struct { |
| 25 | Type string `json:"type"` // "app" or "static" | 25 | Type string `json:"type"` // "app" or "static" |
| 26 | Domain string `json:"domain"` | 26 | Domain string `json:"domain"` |
| 27 | Port int `json:"port,omitempty"` // only for type="app" | 27 | Port int `json:"port,omitempty"` // only for type="app" |
| 28 | Env map[string]string `json:"env,omitempty"` // only for type="app" | 28 | Env map[string]string `json:"env,omitempty"` // only for type="app" |
| 29 | Args string `json:"args,omitempty"` // only for type="app" | 29 | Args string `json:"args,omitempty"` // only for type="app" |
| 30 | Files []string `json:"files,omitempty"` // only for type="app" | 30 | Files []string `json:"files,omitempty"` // only for type="app" |
| 31 | Memory string `json:"memory,omitempty"` // only for type="app" | ||
| 32 | CPU string `json:"cpu,omitempty"` // only for type="app" | ||
| 31 | } | 33 | } |
| 32 | 34 | ||
| 33 | const ( | 35 | const ( |
