This repository manages the Nix-based infrastructure for the Noisebridge MediaWiki deployment.
The flake currently deploys a two-host setup:
wiki.extremist.software: primary wiki, writable MediaWiki, MariaDB primary, Caddy, PHP-FPMreplica.wiki.extremist.software: read-only wiki, MariaDB replica, Caddy, PHP-FPM
Change siteConfig.baseDomain in flake.nix to move the public wiki hostnames together.
flake.nix: top-level flake, deploy definitions, checks, and app entrypointshosts/main-wiki.nix: primary host configurationhosts/replica-wiki.nix: replica host configurationmodules/mediawiki-packages.nix: pinned MediaWiki extensions and skinsscripts/: migration, export/import, and bootstrap helperssecrets/: agenix-encrypted secrets and host recipients
Validate the repo and build both host configurations:
nix run .#checkDeploy both hosts as a specific SSH user:
nix run .#deploy -- jetDeploy a single host:
nix run .#deploy -- jet .#main-wiki
nix run .#deploy -- jet .#replica-wikiCI deploys with:
nix run .#deploy -- github-actionsBootstrap fresh Ubuntu hosts into NixOS:
nix run .#bootstrap-host -- --admin <name> <main-wiki|replica-wiki> <target-host> [ssh-identity-file]
nix run .#bootstrap-host -- --admin <name> <main-target-host> <replica-target-host> [ssh-identity-file]- The deploy app always requires an explicit SSH user.
jetis the normal interactive admin deploy user.github-actionsis the CI deploy user.- Deploys use
deploy-rs. nix run .#checkis the intended pre-deploy validation step.- Deploys require a local signing key at
$LOCAL_KEY,$NOISEBRIDGE_DEPLOY_SIGNING_KEY, or$HOME/.config/noisebridge-wiki/deploy-signing-key. - Admin SSH users live in
siteConfig.adminUsersinflake.nix. - Each admin user can set
sshKeys = [ ... ],githubUsers = [ ... ], or both. - Every GitHub username in
githubUserscontributes all keys fromhttps://github.com/<user>.keysduring activation. - GitHub-backed keys update only when a deploy runs. After deploy, removed GitHub keys stop working and newly added ones start working.
Example:
adminUsers = {
alice = {
sshKeys = [
"ssh-ed25519 AAAA... alice@laptop"
];
githubUsers = [ "alice" ];
};
bob = {
githubUsers = [ "bob" ];
};
};- MediaWiki core is pinned to
1.39.13. - Wikimedia extensions and skins are pinned in
modules/mediawiki-packages.nix. - Uploaded files live at
/srv/mediawiki/images. - Local static assets live at
/srv/mediawiki/img. - Nightly dumps run at
02:00local time onreplica-wiki: a private full-history dump with uploads/files for backup and a public current-only dump for bots. - Public dumps are served from
dumps.extremist.softwareout of/var/www/dumps.extremist.software.
Useful helpers in scripts/:
scripts/migrate-all.sh: full content migration flowscripts/import-db-to-main.sh: import the database into primary and reseed replicascripts/import-files-to-main.sh: copy files into primaryscripts/export-prod-db.sh: export the current production databasescripts/export-prod-files.sh: export the current production filesscripts/export-and-import-db.sh: export and import the database in one stepscripts/export-and-import-files.sh: export and import files in one stepscripts/bootstrap-host.sh: bootstrap one or both hosts from Ubuntu to NixOS
agenixmanages runtime secrets.- Encrypted secret definitions live under
secrets/shared/. - Host age recipients live under
secrets/hosts/. - Recipient wiring lives in
secrets/secrets.nix. - Hosts decrypt secrets using their local age identity.
To add a new person for secret decryption:
- add their age public key to
adminKeysinsecrets/secrets.nix - enter the dev shell with
nix developsoagenixis available (or install agenix any other way) - run
agenix -rfrom the repo root to rekey all secrets using./secrets.nix
Example adminKeys entry:
adminKeys = [
# Example Person
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFakeKeyForExampleOnlyDontUseThis"
];Changing secrets/secrets.nix updates the intended recipient list, but the new person cannot actually decrypt anything until agenix -r has re-encrypted the existing .age files.
Typical admin flow:
- Edit the Nix configuration.
- Run
nix run .#check. - Deploy with
nix run .#deploy -- <user>. - Verify the primary and replica hosts.
When making repo changes, use jj for commits.