From 85e97bf1ebe339513ab0661f6cc1ab1ff17a46cb Mon Sep 17 00:00:00 2001 From: bndw Date: Sun, 25 Jan 2026 08:06:56 -0800 Subject: 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. --- internal/templates/templates.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/templates/templates.go') diff --git a/internal/templates/templates.go b/internal/templates/templates.go index feb6c10..ce1cbe5 100644 --- a/internal/templates/templates.go +++ b/internal/templates/templates.go @@ -19,6 +19,12 @@ Restart=always RestartSec=5s NoNewPrivileges=true PrivateTmp=true +{{- if .Memory}} +MemoryMax={{.Memory}} +{{- end}} +{{- if .CPU}} +CPUQuota={{.CPU}} +{{- end}} [Install] WantedBy=multi-user.target -- cgit v1.2.3