diff options
Diffstat (limited to '')
-rw-r--r-- | chaski/configuration.nix | 1 | ||||
-rw-r--r-- | chaski/services/tracktrain.nix | 168 | ||||
-rw-r--r-- | npins/sources.json | 11 |
3 files changed, 0 insertions, 180 deletions
diff --git a/chaski/configuration.nix b/chaski/configuration.nix index d2b1233..da8fdaf 100644 --- a/chaski/configuration.nix +++ b/chaski/configuration.nix @@ -9,7 +9,6 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix # ./services/uplcg.nix - ./services/tracktrain.nix ./services/chat.nix ./services/bahnhof-name.nix ./services/conduit.nix diff --git a/chaski/services/tracktrain.nix b/chaski/services/tracktrain.nix deleted file mode 100644 index 50ba440..0000000 --- a/chaski/services/tracktrain.nix +++ /dev/null @@ -1,168 +0,0 @@ -{ config, lib, pkgs, inputs, ... }: - -let - # this gets rid of the implicit dependency on ghc, reducing closure size - stripLib = drv: pkgs.stdenv.mkDerivation { - name = drv.name + "-without-lib"; - src = drv.outPath; - buildPhase = '' - mkdir -p $out - cp -r $src/bin $out - ''; - phases = [ "buildPhase" ]; - }; - - tracktrain-config = '' - dbstring: "dbname=tracktrain user=tracktrain" - gtfs: ${pkgs.copyPathToStore ./gtfs.zip} - - warp: - port: 4000 - - login: - enable: false - url: "http://dings" - clientname: not - clientsecret: used - ''; -in -{ - services.nginx.recommendedProxySettings = true; - services.nginx.virtualHosts."tracktrain.stuebinm.eu" = { - locations."/" = { - proxyPass = "http://192.168.42.41:4000"; - proxyWebsockets = true; - }; - locations."/api" = { - proxyPass = "http://192.168.42.41:4000"; - proxyWebsockets = true; - extraConfig = '' - add_header 'Access-Control-Allow-Origin' '*' always; - ''; - }; - locations."/metrics/" = { - proxyPass = "http://localhost:2342"; - proxyWebsockets = true; - extraConfig = '' - rewrite ^/metrics/(.*) /$1 break; - ''; - }; - locations."/assets" = { - proxyPass = "http://192.168.42.41:4567"; - }; - enableACME = true; - forceSSL = true; - }; - - - services.prometheus = { - enable = true; - port = 9001; - scrapeConfigs = [ { - job_name = "tracktrain"; - static_configs = [{ - targets = [ "192.168.42.41:4000" ]; - }]; - } ]; - }; - - services.grafana = { - enable = true; - settings.server = { - serve_from_sub_path = true; - domain = "tracktrain.ilztalbahn.eu"; - root_url = "%(protocol)s://%(domain)s:/metrics/"; - http_port = 2342; - http_addr = "0.0.0.0"; - }; - - provision = { - enable = true; - datasources.settings.datasources = [ { - url = "http://localhost:9001"; - type = "prometheus"; - name = "prometheus"; - } ]; - }; - }; - - networking.firewall.allowedTCPPorts = [ 443 ]; - - containers.tracktrain = { - autoStart = true; - privateNetwork = true; - hostAddress6 = "fd00::42:40"; - localAddress6 = "fd00::42:41"; - hostAddress = "192.168.42.40"; - localAddress = "192.168.42.41"; - - config = { config, pkgs, ... }: { - - environment.noXlibs = true; - systemd.services.dufs = { - enable = true; - description = "assets for tracktrain's frontend"; - wantedBy = [ "tracktrain.service" ]; - serviceConfig.Type = "simple"; - path = [ pkgs.dufs ]; - script = '' - dufs -b 0.0.0.0 -p 4567 --path-prefix /assets --auth /@$(cat /username):$(cat /password)"@*" --auth-method basic --allow-upload --allow-delete /assets - ''; - }; - - systemd.services.tracktrain = { - enable = true; - - description = "tracks trains, hopefully"; - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - serviceConfig.Type = "simple"; - path = [ pkgs.wget ]; - script = '' - cd /tmp - ln -sf ${pkgs.writeText "config.yaml" tracktrain-config} "config.yaml" - ${ - import inputs.tracktrain { - nixpkgs = pkgs; - compiler = "default"; - } - }/bin/tracktrain +RTS -T - ''; - startAt = "daily"; - }; - - services.postgresql = { - enable = true; - - ensureDatabases = [ "tracktrain" ]; - ensureUsers = [ { - name = "tracktrain"; - ensureDBOwnership = true; - } ]; - authentication = '' - local all all trust - host all all 127.0.0.1/32 trust - ''; - }; - - networking.firewall.enable = false; - system.stateVersion = "22.05"; - - services.coredns = { - enable = true; - config = '' - .:53 { - forward . 1.1.1.1 - } - ''; - }; - }; - }; - - networking.nat = { - enable = true; - internalInterfaces = [ "ve-tracktrain" ]; - externalInterface = "ens3"; - }; - -} diff --git a/npins/sources.json b/npins/sources.json index 5fa3905..f232b27 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -207,17 +207,6 @@ "url": "https://github.com/Mic92/sops-nix/archive/b6cb5de2ce57acb10ecdaaf9bbd62a5ff24fa02e.tar.gz", "hash": "1wzm5hs3cda6l7q9ls5nw16bifb00v5kan1xcab57bb5fg6qqnyb" }, - "tracktrain": { - "type": "Git", - "repository": { - "type": "Git", - "url": "https://stuebinm.eu/git/tracktrain" - }, - "branch": "main", - "revision": "ffc0a842ae29db53dd92e276c089a6d5914c6456", - "url": null, - "hash": "059hc1wrx4wbnj9kvhsj78xwc9w4pknh0bak9sr4w29qmb52b3fm" - }, "traveltext": { "type": "Git", "repository": { |