nixos: add bananasimulator-beta service + vhost

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) <noreply@anthropic.com>
This commit is contained in:
DannyDannyDanny 2026-06-08 23:25:34 +02:00
parent f8a873bd06
commit 0eab0d47ae
2 changed files with 41 additions and 1 deletions

View file

@ -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.

View file

@ -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