Make container restart-policy configurable (currently hardcoded RESTART_MODE = 'unless-stopped') #10259
netholics
started this conversation in
Feature Requests
Replies: 1 comment
|
The |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Coolify hardcodes
RESTART_MODE = 'unless-stopped'inbootstrap/helpers/constants.php:18and applies it to every managed service on (re)deploy. There's no way (UI, env var, per-service override) to use a different restart policy without editing the source.Use case: our
coolify-proxyneedsrestart: always, notunless-stopped. Under certain host-shutdown signals (exit 255), Docker treatsunless-stoppedcontainers as user-stopped and skips auto-restart after the host comes back — leaving the proxy down post-recovery. All other Coolify core containers (coolify,coolify-db,coolify-realtime,coolify-redis) ship withalways. Onlycoolify-proxyis onunless-stopped, and that's the practical difference.We can
docker update --restart=always coolify-proxyas a runtime workaround, but Coolify regenerates the proxy compose on every proxy redeploy and the workaround is silently reverted. We currently run an hourly cron just to alert on the drift.Current behavior
RESTART_MODEis referenced from 18 sites in the codebase:bootstrap/helpers/constants.php:18— the constant definitionbootstrap/helpers/proxy.php:277, 362— proxy compose generationbootstrap/helpers/shared.php:2571, 3366— service helpersbootstrap/helpers/parsers.php:653, 1985— service parsersapp/Jobs/ApplicationDeploymentJob.php:2616— app deploymentsapp/Actions/Database/Start{Mariadb,Postgresql,DatabaseProxy,Mysql,Redis,Clickhouse,Mongodb,Keydb,Dragonfly}.php— database deployments (9 files)app/Actions/Server/ConfigureCloudflared.php:22— CloudflaredIn
proxy.phpspecifically,data_forget($config, 'services.traefik.restart')is called before the restart key is re-injected fromRESTART_MODE, so any user edit to the regenerated compose file is stripped on next deploy.Proposal
Two options, ordered by smallness of change:
Option A — env-overridable constant. Single line in
constants.php:Lets operators set
COOLIFY_RESTART_MODE=alwaysin Coolify's own.envand have it apply system-wide. Backward compatible: default unchanged.Option B — per-service override. A config map keyed by service:
More flexible, but a larger change touching ~14 call sites.
Either closes our use case. Option A is the smallest possible fix; happy to PR it if you're open.
Environment
4.0.0(ghcr.io/coollabsio/coolify:4.0.0)Receipts
Bug surfaced via a kernel soft-lockup incident on our VPS (2026-05-17). All four
always-policy core containers auto-restarted on host recovery; onlycoolify-proxy(theunless-stoppedone) required manualdocker start. Recovery delay: ~30 minutes from host-up to proxy-up.All reactions