commit 87711c24e182cf9eced4d25c0b871c6581160a6f
parent 9f38ef1496296af75ce8a311684ab0e8d3fcf061
Author: Silas Brack <silasbrack@gmail.com>
Date: Sat, 13 Jun 2026 12:43:18 +0200
chore: update simple-web-app (random JWT, remove sops secret)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 7 insertions(+), 27 deletions(-)
diff --git a/flake.lock b/flake.lock
@@ -318,11 +318,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
- "lastModified": 1781345102,
- "narHash": "sha256-TDZEsRMYP2TRKJP8RXNBlbV2/sgvOKMP9XErTH2EcsI=",
+ "lastModified": 1781347390,
+ "narHash": "sha256-VHtCjAUEIhFLwfqgjo6wi0AAX9CNRRjM/KRP8bACWF0=",
"ref": "refs/heads/main",
- "rev": "52dfc51052fd43c9e08fc1977a9f76bca3f6fc7c",
- "revCount": 140,
+ "rev": "d1a959863e0625d2968db158bf0dd23381c1c35c",
+ "revCount": 142,
"type": "git",
"url": "ssh://forgejo@git.fnarglebeast.com/silas/simple-web-app.git"
},
diff --git a/modules/simple-web-app.nix b/modules/simple-web-app.nix
@@ -20,34 +20,21 @@ in
};
port = mkOption {
- type = types.nullOr types.int;
+ type = types.int;
default = 8000;
- example = 8080;
- description = ''
- The port to bind simple web app server to.
- '';
+ description = "The port to bind the server to.";
};
dbPath = mkOption {
type = types.str;
default = "/var/lib/simple-web-app/data/app.db";
- description = ''
- Path to the SQLite database file.
- '';
+ description = "Path to the SQLite database file.";
};
- jwtSecret = mkOption {
- type = types.str;
- default = "";
- description = ''
- JWT secret for authentication. If empty, a random secret is generated on each restart.
- '';
- };
};
};
config = mkIf cfg.enable {
- # Run simple web app service
systemd.services.simple-web-app = {
wantedBy = [ "multi-user.target" ];
description = "Run simple web app.";
@@ -63,7 +50,6 @@ in
PORT = builtins.toString cfg.port;
DEBUG = "false";
DB_PATH = cfg.dbPath;
- JWT_SECRET = cfg.jwtSecret;
SMTP_HOST = "localhost";
SMTP_PORT = "25";
SMTP_FROM = "noreply@silasbrack.com";
@@ -72,7 +58,6 @@ in
};
};
- # Route requests via nginx
networking.firewall.allowedTCPPorts = [ cfg.port ];
services.nginx.virtualHosts."simple.fnarglebeast.com" = {
forceSSL = true;
@@ -86,14 +71,9 @@ in
# Archive logs to volume
systemd.services.simple-web-app-log-collection = {
script = ''
- # Add a small 5 minute buffer to catch delayed logs
export PREVIOUS_HOUR=$(${pkgs.coreutils}/bin/date -d '1 hour ago 5 minutes ago' +%Y-%m-%dT%H:00:00)
export CURRENT_HOUR=$(${pkgs.coreutils}/bin/date -d '5 minutes ago' +%Y-%m-%dT%H:00:00)
-
- # Create log storage folders if they don't exist
mkdir -p $LOG_STORAGE_LOCATION/$(date -d "$PREVIOUS_HOUR" +%Y/%m/%d)
-
- # Extract logs from journalctl, compress, and save to volume
journalctl -u $SERVICE_NAME \
--since=$PREVIOUS_HOUR \
--until=$CURRENT_HOUR \