Docs / Explanation

What an Otto server holds

Most of an Otto server is rebuilt from git. Moving one means copying the part that is not.

Built from git, every time

An Otto server keeps a checkout of the Otto repository at /opt/otto, and every deploy builds every image from that checkout, on the server. The images, the containers, the phone app, the marketing site and the hot layer the sessions run are all reproducible from a commit. A new server does not need any of them copied: a deploy makes them again.

State: what only the server has

What a deploy cannot make is state, written while Otto runs. A move copies exactly this:

StateWhere it livesWhy it matters
Sessions and their journalvolume otto-stateThe daemon writes a journal of its sessions as it stops, and resumes every one from it when it starts. Copied, the journal resumes your sessions on the new server.
The Claude login and transcriptsvolume otto-homeWithout it you would log in again, and the sessions' conversations would be gone.
Repositories and worktreesvolume otto-reposWork that has not landed exists nowhere else: not on GitHub, not on a Mac. Every worktree's files and git history are copied; its installed dependencies and build output are not (below).
The phone's pending vault editsvolume otto-vault-pendingEdits made on the phone wait here until a Mac commits them to the vault.
TLS certificatesvolume caddy_dataCopied, the new server serves HTTPS at once, without asking Let's Encrypt for every name again.
Passkeys/srv/otto-authA passkey belongs to the domain name, not the machine, so with this copied your phone stays signed in.
Deploy keys~otto/.ssh, /srv/otto-vaultThe read-only keys GitHub knows the server by. The same keys work from the new machine, so nothing changes on GitHub.
The server's SSH host keys/etc/ssh/ssh_host_*The identity your Macs know the server by. Copied, the new server is the same server to them (below).
The Macs' login keys~otto/.ssh/authorized_keysYour Macs log in to the new server with the keys they already use.
Server settings/srv/otto-hostWhich repositories may push after finalize, and the Keeper's autonomy settings.
Sign-ups/srv/ottobot-api/dataWhat the site's early-access form collected, if your server runs it.

What is left behind

Why the export leaves dependencies behind

Most of what sits in the repositories is not work. On one server, the first dry run counted 21 GB to copy, with 24 GB free: node_modules folders and Yarn caches made up about 10 GB of the repositories, and downloaded browsers and package caches 2.5 GB of the home volume. Every worktree has its own copy of them, and an install makes each one again from the lockfile that is copied. Leaving them out took the same server's export to about 6 GB.

So the export leaves out only what a tool will make again, and decides that the cautious way. Something is left out only when git says it is ignored and untracked, and its name is one only an install or a build uses, such as node_modules or dist. An ignored file with another name, like .env, may be the only copy of a secret, so it is copied. So is anything git tracks, even in a folder named build, and anything git does not ignore. A worktree git cannot read is copied whole. When it is unsure, the export copies.

The git history is always copied, even for a repository a fresh clone could reproduce. A worktree's branch, its unpushed commits and the stashes all live in the main checkout's git folder, and nearly every main checkout has worktrees. The git folders are also small next to their dependencies: about 300 MB in all on that server. Cloning again would need the network and GitHub's permission during the import, for almost no saving.

The dependencies come back when they are needed, not during the import. The import marks every worktree it took them from, the same way Otto marks the worktree of a session paused for a long time. When a session starts there, it first runs the project's own install, as the session's user, with the toolchain the session uses, and you see it on the session's terminal. Only the worktrees you go back to pay for it, the import does not wait on dozens of installs, and an install that fails leaves the session usable and is tried again next time. To copy everything as it is instead, run the export with --full.

Why Otto stops during the move

Sessions write transcripts and files all the time. A copy made while they run could hold half of a change. So the export stops Otto first, and copies a server that is standing still.

Stopping is also what makes sessions move. When the session daemon stops, it records every running session in its journal, and the new daemon resumes them from it. What it cannot resume is a turn cut off halfway, a tool call that was running. That is why the export waits until no session is mid-turn.

A static site, if your server serves one, stays up during the move. The phone app, sign-in and sign-ups are down from the export until DNS reaches the new server.

Where the domain names come from

Which domain names a server answers to is in its own configuration, the web/Caddyfile it deploys. The export reads them from there and carries them in its manifest, so the import tells you exactly which names to move, and verify checks those.

Why the old server stays as it was

The export copies; it never deletes. Until you delete the old server, it is a complete fallback: undo-export starts Otto there again, exactly as it was when the export began. Keeping it for a few days costs little and leaves time to find anything the new server lacks.

Why there is a point of no return

The fallback holds only while nothing new happens on the new server. Once the sessions resume there, they commit, push and edit, and the old server knows nothing of it. Going back would then bring back the server as it was at the export and quietly lose that work.

So the move stops and asks before it resumes the sessions, and says what yes means. It also records the yes on the old server, whose undo-export refuses from then on unless you force it. A mistaken undo days later cannot lose the work without a warning.

Why the old website stops too

The export leaves the old server's Caddy running, so a static site stays up while DNS changes. Once DNS points at the new server, a client with a stale DNS answer would still reach the old Caddy: an old copy of the site, and an app that cannot sign in. That half-working server is harder to notice than one that does not answer. So once the new server is verified, the move stops the old Caddy too, and a stale client fails plainly until its cache clears. The Mac's own DNS cache is flushed on request for the same reason: ssh to the server's name must not land on the fenced box.

Why the old server is fenced

A stopped server does not stay stopped by itself. Docker starts its containers again after a reboot, the autodeploy timer deploys the next commit, and a deploy starts everything. Then two servers would run the same sessions, push the same branches and take the same CI jobs, each from its own copy.

So the export fences the old server. Its containers lose their restart policy, the timer is turned off, and a marker file makes vps-deploy.sh refuse. Only undo-export, which you run on purpose, lifts it. The move's last check warns when the old server still answers and is not fenced.

Why the server keeps its identity

SSH knows a server by its host key, not its address. A new machine comes with its own keys, and every Mac would then refuse it with "REMOTE HOST IDENTIFICATION HAS CHANGED", a warning meant for an attack. Each would need fixing by hand, and Otto's own connections would fail until then.

The host keys are part of what the server is, so the export carries them. The import installs them on the new machine, keeps its own keys aside, and checks that SSH really answers with the old key before it relies on it. If not, it puts the new machine's keys back, and you confirm the new key once. On your Mac, the move also tells SSH that the new address has the old key, but only if your Mac already trusted that key.

Why the server has a name

When a Mac knows the server by its address, every Mac must be changed by hand on move day. When it knows it by a name, such as vps.example.com, the move changes one DNS record and every Mac follows. With the host keys moved too, a Mac cannot tell that anything changed.

That is why the guide has you set up the name a day before the move: then the move day needs nothing on the Macs.

Why the TTLs come down first

A DNS record's TTL is how long resolvers may keep its old answer. With a TTL of a day, some phones and Macs keep reaching the old server for a day after you change the record, and find it stopped. A lower TTL counts only once the old one has run out, so it must be lowered a day ahead. With 300 seconds, the switch takes about five minutes. The move reads the TTLs and warns about any above 600 seconds.

Why some steps stay manual

Two things that point at your server are not on it. DNS lives at your DNS provider, and each Mac keeps the server's name or address in its own SSH config. The move cannot change your DNS, so it lists the names and waits until DNS has followed. It changes the SSH config only on the Mac it runs on; with a server name, the other Macs need no change.

Why checksums

The export crosses the internet, possibly as many gigabytes. A file cut short would restore a broken volume without an error. The checksums let import refuse a damaged copy before it changes anything.

Why the copy goes server to server

Through a Mac, every byte crosses a home connection twice, and a cut connection starts the copy over. Between two servers in data centres the same copy takes a fraction of the time, and rsync carries on where a cut one stopped. The servers need a key between them for that, and a key left behind is a door into the old server. So the move makes a key for this copy only, lets it in from the new server's address only, with no shell, checks the old server's identity with the host key your Mac already trusts, and removes the key from both servers when the copy ends. When the servers cannot reach each other, it copies through the Mac as before.