forge-sync: reconcile a forge VM to the deployment's declared state #84
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/nexus#84
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A forge VM boots serving an empty Forgejo: no accounts, no organisations, no repositories, and no way for an agent to open a pull request.
forge-syncreconciles it to the deployment's declared state, and does so on every run rather than once.Primary goals:
--userfor the non-interactive path. Forgejo's own random password is printed once to the operator's terminal and flagged must-change;adminis reserved by Forgejo and cannot be used.allod/toolsbecomes organisationallod, repositorytools; a bare id goes to an organisation named for the deployment. Clone remotes keep matching the ids already in use, so nothing in the registry changes.forgejo admin user generate-access-tokenand piped straight intoage, encrypted to the recipientssecrets.nixdeclares, withforgeAccessflipped in the same edit because that flag is what derives the token's recipients.git/protected-branches, reconciled to the file on every run, so a push to master is refused by the server and not only by a client hook.forge-syncand notforge-bootstrap.The custody rule, binding on every step
No password or token is ever an argument: not to
ssh,curl,forge,jqorforgejo. Shell tracing is off around every such pipe.curlreads any header from a config on stdin. TheforgeCLI reads its token from its file. The admin password is printed once to the operator's terminal and never stored; the agent account's password is random and kept by nobody.Current state and specifics
Scripts live in
scripts/, one shell test each undertests/, wired into the flake's checks —forge-ssh-key.sh,vm-ssh-host-key.shandprovision-vm.share the closest shapes to follow for argument handling, registry resolution and failure behaviour.vm-ssh-host-keyis the precedent for a command that mutates the secrets clone and then prints the exact commit and re-lock lines for the operator rather than committing itself;allod/nexus#82asks for that shape to also print the check that the re-lock took. Follow it: this command should not commit or push on the operator's behalf.Reachability: the forge answers on its guest address, administrative ssh on 22 as root with the hypervisor's key, the clone daemon on 2222, Forgejo over http on 80.
services.forgejoDeployment.domainis the guest's own address, supplied by the service builder, so the command should read the machine's address from the registry rather than taking a URL.Scope
In: the command, its shell test, and the README. Out: the two-node VM test witness, which needs the NixOS test harness this repository does not have and lands as its own issue in
allod/archetypes; the dev VM's flip to cloning from the forge; andallod forge up.Part of allod/strategy#65
Landed on master as
81eb244.