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
71
nixos/hosts/asxpio-services/default.nix
Normal file
71
nixos/hosts/asxpio-services/default.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# asxpio-services: CI runners, Minecraft, XMPP, Xray, SillyTavern.
|
||||
# Services are added here as they move over from ../../ansible (see
|
||||
# MIGRATION.md at the repo root); until then this is the base system only.
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
./acme-forward.nix
|
||||
./minecraft.nix
|
||||
./sillytavern.nix
|
||||
./xmpp.nix
|
||||
./xray.nix
|
||||
];
|
||||
|
||||
asxpio.publicIPv4 = lib.mkDefault "46.62.228.216";
|
||||
|
||||
networking.hostName = lib.mkDefault "asxpio-services";
|
||||
networking.domain = "asxp.io";
|
||||
system.stateVersion = "26.05";
|
||||
|
||||
systemd.network.networks."10-public".address = [ "2a01:4f9:c013:8269::1/64" ];
|
||||
# No swap, by choice
|
||||
|
||||
sops.defaultSopsFile = lib.mkDefault ../../secrets/asxpio-services.yaml;
|
||||
|
||||
# --- WireGuard spoke of asxpio-ops ---------------------------------------
|
||||
asxpio.wireguard = {
|
||||
interface = "asxpio-services";
|
||||
address = [
|
||||
"10.20.0.20/32"
|
||||
"fd69:69:69::20/128"
|
||||
];
|
||||
listenPort = 52820;
|
||||
peers = lib.mkDefault [
|
||||
{
|
||||
name = "asxpio-ops";
|
||||
publicKey = "0gRrNiV4FjP6ipczZCRD3dsnK7k7rl6IyjG84fPaJB4=";
|
||||
endpoint = "135.181.27.77:60101";
|
||||
allowedIPs = [
|
||||
"10.20.0.0/24"
|
||||
"fd69:69:69::/64"
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# --- Backup ---------------------------------------------------------------
|
||||
# ejabberd's Mnesia through its own backup command, its SQLite through
|
||||
# the online backup API. The Paper world is copied live (RCON is off, so
|
||||
# there is no save-off); its autosave keeps that close enough.
|
||||
asxpio.backup = {
|
||||
hostName = "asxpio-services";
|
||||
schedule = "*-*-* 04:15:00";
|
||||
paths = [
|
||||
"/etc/ssh" # the host key decrypts this host's secrets
|
||||
"/opt"
|
||||
"/var/lib/minecraft"
|
||||
"/var/lib/SillyTavern"
|
||||
"/var/lib/containers/storage/volumes/xmpp_database"
|
||||
"/var/lib/containers/storage/volumes/xmpp_tackygram"
|
||||
];
|
||||
excludes = [
|
||||
"/var/lib/minecraft/cache"
|
||||
"/var/lib/minecraft/libraries"
|
||||
"/var/lib/minecraft/versions"
|
||||
];
|
||||
hooks = [
|
||||
"podman exec xmpp-ejabberd ejabberdctl backup /opt/ejabberd/database/nightly.backup"
|
||||
''sqlite3 /var/lib/containers/storage/volumes/xmpp_database/_data/ejabberd.sqlite ".backup '$STAGE/ejabberd.sqlite'"''
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue