From e3a7cbc9bf986d0f27b4808b12899548a4a552c3 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Fri, 27 Jan 2023 20:36:12 +0100 Subject: chaski: tracktrain deployment is no longer live just keep it as a test deployment at my own domain, so I'm less likely to break it accidentally. --- chaski/services/tracktrain.nix | 29 +++++++++++++++++------------ flake.lock | 8 ++++---- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/chaski/services/tracktrain.nix b/chaski/services/tracktrain.nix index 34391b0..f1a7d13 100644 --- a/chaski/services/tracktrain.nix +++ b/chaski/services/tracktrain.nix @@ -11,6 +11,20 @@ let ''; phases = [ "buildPhase" ]; }; + + tracktrain-config = '' + dbstring: "dbname=tracktrain user=tracktrain" + gtfs: ./gtfs.zip + + warp: + port: 4000 + + login: + enable: false + url: "http://dings" + clientname: not + clientsecret: used + ''; in { services.nginx.recommendedProxySettings = true; @@ -19,16 +33,6 @@ in proxyPass = "http://192.168.42.41:4000"; proxyWebsockets = true; }; - # don't expose prometheus endpoint - locations."/metrics".return = "404"; - - enableACME = true; - forceSSL = true; - extraConfig = '' - add_header 'Access-Control-Allow-Origin' '*' always; - ''; - }; - services.nginx.virtualHosts."tracktrain.ilztalbahn.eu" = { locations."/api" = { proxyPass = "http://192.168.42.41:4000"; proxyWebsockets = true; @@ -100,7 +104,8 @@ in path = [ pkgs.wget ]; script = '' cd /tmp - # wget "https://ilztalbahn.eu/wp-content/uploads/2020/07/gtfs.zip" + ln -sf ${pkgs.writeText "config.yaml" tracktrain-config} "config.yaml" + wget "https://ilztalbahn.eu/wp-content/uploads/2020/07/gtfs.zip" ${stripLib (((import inputs.tracktrain {nixpkgs = pkgs;})) # have to remove version constraints because some aren't in 22.05 .overrideAttrs (old: { patchPhase = '' @@ -108,7 +113,7 @@ in sed -i "s/^>=.*//g" *.cabal sed -i "s/>=.*//g" *.cabal ''; })) - }/bin/tracktrain --dbString="dbname=tracktrain user=tracktrain" --warp.port=4000 +RTS -T + }/bin/tracktrain +RTS -T ''; startAt = "daily"; }; diff --git a/flake.lock b/flake.lock index 08a7ad2..c2008fd 100644 --- a/flake.lock +++ b/flake.lock @@ -398,11 +398,11 @@ "tracktrain": { "flake": false, "locked": { - "lastModified": 1670887821, - "narHash": "sha256-z92LccEiqyaIlrrC+eI93RJ5OfejzxCerM1PqO0fBUY=", + "lastModified": 1674405034, + "narHash": "sha256-zKGuktcZ47kC+Jo0Mc0dvB1rMTZN1HprouZ7uRm9VoU=", "ref": "main", - "rev": "6c0f21b276ad73f383a80fe00729c6520a6b874a", - "revCount": 77, + "rev": "53e7884ec03e870431064062519d3a94302bc480", + "revCount": 80, "type": "git", "url": "https://stuebinm.eu/git/tracktrain" }, -- cgit v1.2.3