strategy: recreate for stateful apps (message brokers, databases)
New
-
strategy: recreatefor stateful apps (message brokers, databases).What was wrong. Every redeploy is blue-green: Neo starts
app-<name>-nextnext to the running container, switches traffic, then removes the old one withdocker rm -f. For a web app that's zero-downtime. For RabbitMQ it was three problems at once: two brokers ran on the same volume during the swap, the old one was killed without a clean shutdown, and the new container got a new random hostname. RabbitMQ names its noderabbit@<hostname>and keeps data per node name, so every redeploy came up as a fresh, empty node — vhosts, users, durable queues and messages seemed to vanish, while the old data sat orphaned on the volume. Reproduced on the Debian 12 sandbox withrabbitmq:4.What changed. With
strategy: recreatein.neo.yml(top level or per environment), a redeploy stops the old container first — up to 60 seconds for a clean shutdown — then starts the new one under the same name, with a fixed hostname: the app name, orhostname:if you set one. Verified on the sandbox: the vhost survivedneo deploy,neo deploy --env-onlyandneo env set; at most one container ran at any moment; the old broker exited with code 0.The hostname is saved in server state and applied on every path that recreates the container —
neo deploy,--env-only,--all,neo env set/unset/import,neo updateandneo volumes mount.Trade-off. The app is down while the new container starts, and a failed deploy has no old version to fall back to. Neo then says the app is down, exits non-zero, and keeps the failed container so
neo logs <app>works.strategy: recreatecan't be combined withscale:. The default stays blue-green.What to do. Add
strategy: recreateto the.neo.ymlof each broker or database app. For an existing RabbitMQ app, the first deploy with it changes the node name once (torabbit@<app-name>), so it starts empty — do it before the data matters, orrabbitmqctl export_definitionsfirst and import after. If you already setRABBITMQ_NODENAME, the node name doesn't change.
Fixes
neo env set/unset/import,neo updateandneo volumes mountkeptcommand:. They rebuilt the container from server state but dropped the savedcommand:override, so the container restarted with the image's default process. All three now use one shared builder that carries every saved field.