From 0eab0d47ae1c7c3ff3fbc5f058df653a40a636bb Mon Sep 17 00:00:00 2001 From: DannyDannyDanny Date: Mon, 8 Jun 2026 23:25:34 +0200 Subject: [PATCH] nixos: add bananasimulator-beta service + vhost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cheat instance for the bananasim project. Mirrors the production service on phantom-ship but: - own DB at /home/danny/.local/share/bananasimulator-beta/ - own working dir /home/danny/bananasimulator-beta/ - port 8084 (added to zt+ firewall allowlist + new vps-relay vhost at bananasimulator-beta.dannydannydanny.me) - BS_RIPE_MIN_PER_STAGE=0.2 so a banana cycles in ~3 min (testable) - BS_BETA_MODE=1 so the server exposes /api/cheat/* + sets beta:true in /api/me, which makes the frontend render the ๐Ÿงช cheat menu Same code base; deploy with the same tar-over-ssh ritual into the sibling dir. apps.json gets a private 'bananasim (beta)' entry that only my user sees. Co-Authored-By: Claude Opus 4.7 (1M context) --- nixos/hosts/phantom-ship.nix | 37 +++++++++++++++++++++++++++++++++++- nixos/hosts/vps-relay.nix | 5 +++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/nixos/hosts/phantom-ship.nix b/nixos/hosts/phantom-ship.nix index 99bec0e..26b3e90 100644 --- a/nixos/hosts/phantom-ship.nix +++ b/nixos/hosts/phantom-ship.nix @@ -54,7 +54,7 @@ in # the vps-relay Caddy reverse-proxies into them. Same pattern as # sunken-ship's bbbot. Not in global allowedTCPPorts, so the WAN side # stays closed. - networking.firewall.interfaces."zt+".allowedTCPPorts = [ 3000 8080 8081 8082 8083 8090 8091 8092 8093 ]; + networking.firewall.interfaces."zt+".allowedTCPPorts = [ 3000 8080 8081 8082 8083 8084 8090 8091 8092 8093 ]; hardware.enableRedistributableFirmware = true; # iwlwifi (Intel 8260) + GPU + BT firmware @@ -176,6 +176,7 @@ in "d /home/danny/.local/share/shelfish 0755 danny users - -" "d /home/danny/.local/share/scuttle 0755 danny users - -" "d /home/danny/.local/share/bananasimulator 0755 danny users - -" + "d /home/danny/.local/share/bananasimulator-beta 0755 danny users - -" "d /home/danny/.local/share/komtolk 0755 danny users - -" "d /home/danny/.local/share/escape_hormuz 0755 danny users - -" "d /home/danny/.local/share/scuttle/tiles 0755 danny users - -" @@ -385,6 +386,40 @@ in }; }; + # Bananasimulator BETA โ€” cheat-instance for testing the full progression + # end-to-end. Separate DB, exposes /api/cheat/* (gated by BS_BETA_MODE=1) + # so the frontend cheat menu can seed canonical states and reset. + # Faster ripening (0.2 min/stage = ~3 min to compost) so cycles are + # testable in real time. Same code base; deploy to a sibling dir. + # vhost in vps-relay.nix โ†’ bananasimulator-beta.dannydannydanny.me. + systemd.services.bananasimulator-beta = let + pythonEnv = pkgs.python3.withPackages (ps: with ps; [ + fastapi + uvicorn + httpx + python-telegram-bot + ]); + in { + description = "Bananasimulator BETA (cheat instance) FastAPI server"; + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; + wantedBy = [ "multi-user.target" ]; + path = [ pythonEnv ]; + environment = { + SHIPYARD_BOT_TOKEN_FILE = "/home/danny/.secrets/telegram-bot-token-shipyard"; + BS_DB_PATH = "/home/danny/.local/share/bananasimulator-beta/bananasimulator.db"; + BS_RIPE_MIN_PER_STAGE = "0.2"; # ~3 min to compost โ€” testable in real time + BS_BETA_MODE = "1"; # exposes /api/cheat/* + flips beta=true in /api/me + }; + serviceConfig = { + WorkingDirectory = "/home/danny/bananasimulator-beta"; + ExecStart = "${pythonEnv}/bin/python -m uvicorn server:app --host :: --port 8084"; + Restart = "on-failure"; + RestartSec = 10; + User = "danny"; + }; + }; + # Escape Hormuz โ€” turn-based boat-race Mini App (Hara's first build). # Code lives at /home/danny/escape_hormuz/. Same vps-relay-fronted ZT path # as the others; binds :: so the ZeroTier IPv6 address is reachable. diff --git a/nixos/hosts/vps-relay.nix b/nixos/hosts/vps-relay.nix index 207e8b8..cedcbfa 100644 --- a/nixos/hosts/vps-relay.nix +++ b/nixos/hosts/vps-relay.nix @@ -124,6 +124,11 @@ "bananasimulator.dannydannydanny.me".extraConfig = '' reverse_proxy http://[fdd5:53a2:de33:d269:6499:936c:48a:bbdc]:8083 ''; + # Bananasimulator BETA โ€” separate service on port 8084 with + # BS_BETA_MODE=1 (cheat menu + faster ripening for testing). + "bananasimulator-beta.dannydannydanny.me".extraConfig = '' + reverse_proxy http://[fdd5:53a2:de33:d269:6499:936c:48a:bbdc]:8084 + ''; # KomTolk (formerly translate-platform) โ€” same backend, port 8080. "komtolk.dannydannydanny.me".extraConfig = '' reverse_proxy http://[fdd5:53a2:de33:d269:6499:936c:48a:bbdc]:8080