Skip to content

Check the new proxy stays up before letting the old one go - #22

Merged
liamdevss merged 1 commit into
mainfrom
proxy-switch-settle
Nov 16, 2026
Merged

liamdevss merged 1 commit into
mainfrom
proxy-switch-settle

Conversation

@liamdevss

Copy link
Copy Markdown
Contributor

Follow-up to #20, found by testing a switch on a real systemd machine.

When the new proxy started and then fell over a moment later (in the test: something else had port 443, so Traefik exited right after systemctl enable --now returned), the switch counted it as done. The old proxy was already stopped and was then disabled, so every site went offline.

Now, after writing the sites, the switch waits 4 seconds and checks that the new proxy's unit is still active and that port 80 accepts a connection. If not, it fails with the unit's journal, removes the new site files, stops and disables the new proxy (so it doesn't fight for the ports on the next boot), and starts the old one again.

Checked on Ubuntu 24.04 with systemd (a privileged container):

  • Every switch with two sites: Caddy → nginx → Apache → Traefik → Caddy → nginx. Each time the new proxy holds port 80, both sites answer and the old proxy is inactive and disabled.
  • With port 443 held by another program, nginx → Traefik is refused ("Traefik started but stopped again"). nginx is active and enabled again, both sites answer, and Traefik is failed and disabled.
  • cargo fmt, cargo clippy --workspace --all-targets -D warnings, and the daemon-deploy tests.

…running and answering on port 80 before letting the old one go, and puts the old one back if not
@liamdevss
liamdevss requested a review from a team as a code owner November 16, 2026 20:18
@liamdevss
liamdevss merged commit d0e4044 into main Nov 16, 2026
12 checks passed
@liamdevss
liamdevss deleted the proxy-switch-settle branch November 16, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant