Repository navigation
fix(deploy): --migrate brings an earlier server to the guarded layout (closes #490) - #516
Merged
Merged
Conversation
…closes #490) Signed-off-by: samuel mbabhazi <[email protected]>
…restarts Signed-off-by: samuel mbabhazi <[email protected]>
Signed-off-by: samuel mbabhazi <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The second half of #490.
deploy/install.sh --migrate yesbrings a server set up by an earlier version of the installer to the current layout, in place. It keeps the node's identity and credentials, its journal, its containers and volumes, and Caddy's configuration and certificates. The first half,shipkeep-agent adopt-routes, merged in #514.Recognized layouts, checked before any change
shipkeep,shipkeep-caddyand (optional)shipkeep-egressaccounts and groups.shipkeep.legacy_agent_unit) or today's, and no drop-in on either.agent.yamlfor the control plane and CA of the command being run, and not a control plane machine's.--local-control-plane,--agent-fileand--control-plane-onlyoptions, are refused too: those installs already have the current layout.Steps. Each step leaves a server that runs, and an EXIT trap starts the agent again whatever stops the run.
agent.yamlwith it.shipkeep-egressaccount and the root-owned guard copy.adopt-routesasshipkeep.install_egress.Texts
the agent's service predates upgrades: run the server installer with --migrate yes. The control plane still maps the old text, which agents of alpha.4–alpha.7 send.--migrate yes, which does restore the proxy (tested below). French translation updated.--migrate yes.Docs: INSTALL.md (Upgrade), ADR 0028, SPEC 3.4's reason table, and
deploy/README.md(acceptance step 6).Why
Closes #490. The documented recovery was to run the installer again, which refuses any existing installation, and the only alternative was a full reinstall.
How it was tested
Real lab (run28, Ubuntu 24.04 systemd containers with their own Docker):
tls internal, because.testnames never get a public certificate.install.shand the published alpha.3 agent, itschecksums.txtcosign-verified. Twowhoamiapplications (hello,world), each with a domain.What the lab showed:
The danger, without migrating. One Docker restart swapped the two containers' addresses.
hello.shipkeep.testthen answered fromworld's container and vice versa, and the alpha.3 agent never corrected it.Migration on that server: refused.
routes: 0 already followed, 0 adopted, 2 refusedwithother_applicationfor both, and exit 1.Both applications deployed again, as the message says, then the same command.
2 adoptedandMigrated (from the legacy layout).shipkeep.slicewith the guard table loaded, and reportsHttpProxy/HttpsProxyhttp://127.0.0.1:7480and an emptyNoProxy.hellofrom .4 to .2 andworldfrom .5 to .3. Each route followed its own container: each domain answered with its own application's hostname.ready, andcredentials.jsonandagent.yamlbyte-identical. The journal kept every operation (24) and gained one route record per application.Run again:
2 already followed,Migrated (from the current layout), and Docker's start time unchanged.Upgrade agents to 0.1.0-alpha.7 from the control plane.
upgrade confirmed, version0.1.0-alpha.7 (commit 4ef57df). The rollout endedsucceeded, and both routes were still right.Interruptions, on a second fresh alpha.3 server with one pinned application. Four lab copies of the installer sent themselves SIGTERM at each boundary:
After each, the agent was active (alpha.3, then the new one under the old unit, then under the guarded unit), no temporary file was left, and the route served its application. The next run went on from there.
The final run found a race, which is fixed in the last commit. It exited 1 with "The agent did not come back after Docker": Docker's restart restarts the agent, and the check read it while it was
activating. The installer now waits.To retest the exact case, I removed Docker's egress drop-in on that server, which is also the
egress_unguardedcase, and restarted Docker out of the slice.--migrate yesthen exited 0: Docker was back behind the proxy, the agent active, and the route right.Local checks
bash deploy/install_test.shpasses. It adds migration checks:--migratevalue or combination is refused before anything else, and never shows the token.shellcheckis clean.agent/internal/actionspass, as doapi:lint,api:typecheckand the touched API specs.Security considerations
sudo, from the checksum-verified command the control plane shows. It installs only the agent binary pinned in that command.