nixos: describe both servers as NixOS systems
Start of the move from Ansible to NixOS. Services run as native NixOS services where nixpkgs has a module and as Podman containers otherwise; there is no Docker. Shared: users with their Debian UIDs, SSH with the Ansible role's crypto settings, nftables firewall, WireGuard (ops is the hub), sops-nix secrets per host, the restic backup script with its schedule and retention, mail on unit failure. asxpio-services: Xray, SillyTavern, Minecraft (Paper) and the ACME forwarder natively; XMPP stays in containers because the server is a custom build. asxpio-ops: Postgres, Garage and Forgejo natively. Roles, buckets, keys and grants move here from the storage repo's init scripts. Services that own data wait for /var/lib/.data-in-place, so an install never creates empty state where a restore is about to land. migration/*-data.sh move the Debian-era data into the new layout. hosts/rehearsal turns the two hosts into a test pair with its own keys and dummy secrets. Everything here ran there, Postgres, Garage, Forgejo, Minecraft and SillyTavern on a restored copy of production data. Three differences from the containers showed up and are handled: Garage rejects a 0440 credential file, Geyser needs libcrypto and netlink, SillyTavern ignores the module's listen flags. Production is untouched: both servers still run Debian under Ansible. Assisted-by: Claude:fable-5-2
This commit is contained in:
parent
c51522d371
commit
be68c5adef
1 changed files with 1981 additions and 0 deletions
51
nixos/hosts/rehearsal/services.nix
Normal file
51
nixos/hosts/rehearsal/services.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# asxpio-services on a throwaway server; see ./ops.nix.
|
||||
{ lib, ... }:
|
||||
{
|
||||
networking.hostName = "rehearsal-services";
|
||||
sops.defaultSopsFile = ../../secrets/rehearsal-services.yaml;
|
||||
asxpio.sshFrom = [ "*" ];
|
||||
|
||||
# Same script and schedule, into repositories on its own disk
|
||||
asxpio.backup.repositories = lib.mkForce {
|
||||
hel1 = "/var/backups/test-repo-hel1";
|
||||
fsn1 = "/var/backups/test-repo-fsn1";
|
||||
};
|
||||
systemd.network.networks."10-public".address = lib.mkForce [ "2a01:4f9:c01d:6f9::1/64" ];
|
||||
|
||||
asxpio.publicIPv4 = "2.29.197.9";
|
||||
|
||||
# A 4 GB server
|
||||
services.minecraft-server.jvmOpts = lib.mkForce "-Xmx2G -Xms1G";
|
||||
|
||||
# A restored world brings its plugins and their credentials along.
|
||||
# Those that talk to the outside (the Discord bot logs in with the
|
||||
# production token and edits the real server's slash commands) are
|
||||
# put aside before every start.
|
||||
systemd.services.minecraft-server.preStart = lib.mkBefore ''
|
||||
mkdir -p plugins/disabled-on-rehearsal
|
||||
for p in DiscordSRV ServerBackup AutoUpdateGeyser; do
|
||||
for f in plugins/$p*.jar; do
|
||||
[ ! -e "$f" ] || mv "$f" plugins/disabled-on-rehearsal/
|
||||
done
|
||||
done
|
||||
'';
|
||||
|
||||
# With production data restored these would act as production: a second
|
||||
# asxp.io XMPP server and Telegram session. Start them by hand, and
|
||||
# only with test data.
|
||||
virtualisation.oci-containers.containers = lib.genAttrs [ "xmpp-ejabberd" "xmpp-apushd" "xmpp-tackygram" ] (_: {
|
||||
autoStart = false;
|
||||
});
|
||||
|
||||
asxpio.wireguard.peers = [
|
||||
{
|
||||
name = "asxpio-ops";
|
||||
publicKey = "Zuufncq9a9UZGvgRBjattzuoomJtWREjFeoB0POt620=";
|
||||
endpoint = "62.238.40.174:60101"; # rehearsal-ops
|
||||
allowedIPs = [
|
||||
"10.20.0.0/24"
|
||||
"fd69:69:69::/64"
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
Loading…
Reference in a new issue