feat(deploy): the instance ends itself after deploying (#65) #65

Merged
mi merged 1 commits from self-deploy-step-2 into main 2026-09-15 11:17:16 +02:00
Owner

RFC 0005 step 2. restartsInstance marks the build that installs the
version the instance is to run next. On SUCCESS the executor drains —
nothing new starts, everything executing is finished and recorded — and
then closes the server context, so Restart=always brings the new version
up. Until now the restart was scheduled from outside and asked whether
the instance happened to be idle, so a build starting between the answer
and the stop was cut short and re-run by the recovery.

The key is pinned like the sandbox policy, and refused on builds.default
and on a definition without trigger.branches: a restart must never come
from whatever branch went green last.

tools/self-deploy reads WERKATOR_RESTARTS_INSTANCE from its environment
and hands the running MainPID to the transient unit, which waits for that
pid to go instead of polling for idleness. The stop afterwards keeps
Restart=always from bringing the old runtime back mid-swap; the swap and
the rollback stay outside, where PR#64 put them.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com

RFC 0005 step 2. `restartsInstance` marks the build that installs the version the instance is to run next. On SUCCESS the executor drains — nothing new starts, everything executing is finished and recorded — and then closes the server context, so Restart=always brings the new version up. Until now the restart was scheduled from outside and asked whether the instance happened to be idle, so a build starting between the answer and the stop was cut short and re-run by the recovery. The key is pinned like the sandbox policy, and refused on builds.default and on a definition without trigger.branches: a restart must never come from whatever branch went green last. tools/self-deploy reads WERKATOR_RESTARTS_INSTANCE from its environment and hands the running MainPID to the transient unit, which waits for that pid to go instead of polling for idleness. The stop afterwards keeps Restart=always from bringing the old runtime back mid-swap; the swap and the rollback stay outside, where PR#64 put them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mi added 1 commit 2026-09-15 11:16:34 +02:00
RFC 0005 step 2. `restartsInstance` marks the build that installs the
version the instance is to run next. On SUCCESS the executor drains —
nothing new starts, everything executing is finished and recorded — and
then closes the server context, so Restart=always brings the new version
up. Until now the restart was scheduled from outside and asked whether
the instance happened to be idle, so a build starting between the answer
and the stop was cut short and re-run by the recovery.

The key is pinned like the sandbox policy, and refused on builds.default
and on a definition without trigger.branches: a restart must never come
from whatever branch went green last.

tools/self-deploy reads WERKATOR_RESTARTS_INSTANCE from its environment
and hands the running MainPID to the transient unit, which waits for that
pid to go instead of polling for idleness. The stop afterwards keeps
Restart=always from bringing the old runtime back mid-swap; the swap and
the rollback stay outside, where PR#64 put them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mi merged commit 2944db7616 into main 2026-09-15 11:17:16 +02:00
mi deleted branch self-deploy-step-2 2026-09-15 11:17:16 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mi/werkator#65