How the public server moves to a newly built folder from the README without losing an app or a repository.
The conditions
The maintainer's conditions (ollama posts 6a87b6383e and 36efc394ff): no restart that loses an app or a repository; the data moved out of the folder once, clearly, after the processes stop, and bound from then on; and every app deployed with no step repeated by hand. Apps live in the release root, so once it is bound from DATA, every folder after it starts with all of them.
The steps
A host session outside both folders runs steps 1 to 5, writing only to
copies. SERVER, and any REPOSITORIES and MIRRORS the live start command binds,
are found as in step 2 of the README's rehearsal. DATA goes on the same disk as SERVER,
such as /mnt/data/fossil/data, so that the move is a rename.
- The new build:
crystal run build-rootfs.cr -- server COPY/new BQ2 DOWNLOADS. - Its HTTPS:
COPY/new/usr/bin/bq2 sysroot-namespace --rootfs=COPY/new -- git ls-remote https://github.com/jadonk/tt-jadonk-tiny-tapeoutlistsrefs/heads/main. The live folder's git prints "Empty enumerable" instead (ollama post 77682186eb). - Changes made by hand:
crystal run compare-rootfs.cr -- SERVER COPY/new. Each difference outside the four places DATA holds and this build's own changes is something the switch would lose: say so on the thread before going on. - The copies, into COPY on the same disk:
cp -a SERVER COPY/old, thencrystal run move-data.cr -- COPY/old COPY/data --apply, which moves out of the copy what it holds. Then copy each repository again withsqlite3 SERVER/var/lib/fossil/NAME.fossil ".backup COPY/data/repos/NAME.fossil", so a repository being written is still copied whole. Where the live start command binds REPOSITORIES and MIRRORS instead, copy those intoCOPY/data/repos(with.backup) andCOPY/data/mirror. The comparison:
crystal build compare-serve.cr -o COPY/compare-serve unshare --map-root-user --net --pid --fork --mount --mount-proc COPY/compare-serve COPY/old COPY/new BQ2 COPY/data COPY/compare
compare-serve.cr gives both folders the same copy of
the data. It starts the old one with BQ2, as today, and the new one with
the bubblewrap command of the README's "Start", around its own bq2. Each is asked each
repository's timeline and status, every CGI program on each repository,
and every app's page and preview. It ends PASS when every answer matches
the old server's. Post its output on the thread.
- The switch, at the time the maintainer gives:
- Stop the server.
- Run
crystal run move-data.cr -- SERVER DATA. It changes nothing and says what it would move. Then run it again with--apply. Where the start command bound REPOSITORIES and MIRRORS, move those toDATA/reposandDATA/mirrorinstead, as move-data says. - Put the new folder where it will stay, and start it with either command of the README's "Start".
The way back: start the old folder with BQ2 and the same four --binds.
Nothing in it changed but its emptied places, which the binds fill.