From 2dc8e1b1a3d80a2e76b90d0215a0acadf6b043a6 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Sun, 17 Nov 2024 20:28:53 +0000 Subject: [PATCH] factor(teslamate.nix): update domain, ports, and service configuration - Updated domain to `tesla.giugl.io` - Added separate ports for TeslaMate (`11234`) and Grafana (`11334`) - Configured proxy settings for websockets in `/` and `/live/websocket` locations - Added `/grafana` location with appropriate configuration - Updated `services.teslamate` to include port, listen address, secrets file, virtual host, PostgreSQL server, and Grafana settings --- hosts/architect/teslamate.nix | 39 +++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/hosts/architect/teslamate.nix b/hosts/architect/teslamate.nix index 03e924a..ac83bec 100644 --- a/hosts/architect/teslamate.nix +++ b/hosts/architect/teslamate.nix @@ -1,28 +1,35 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, ... }: let - domain = "media.giugl.io"; - port = 8096; + domain = "tesla.giugl.io"; + teslamatePort = 11234; + grafanaPort = 11334; allowLan = true; + allowWAN = false; in { - # needed since StateDirectory does not accept symlinks - systemd.services.jellyfin.serviceConfig.StateDirectory = lib.mkForce ""; - architect.vhost.${domain} = with config.architect.networks; { dnsInterfaces = [ "lan" "tailscale" ]; locations = { "/" = { - inherit port allowLan; - + inherit allowLan allowWAN; + port = teslamatePort; + proxyWebsockets = true; allow = [ tailscale.net ]; }; - - "/socket" = { - inherit port allowLan; - + "/live/websocket" = { + inherit allowLan allowWAN; + port = teslamatePort; + proxyWebsockets = true; + allow = [ + tailscale.net + ]; + }; + "/grafana" = { + inherit allowLan allowWAN; + port = grafanaPort; proxyWebsockets = true; allow = [ tailscale.net @@ -33,6 +40,12 @@ in services.teslamate = { enable = true; - package = pkgs.teslamatePkgs.teslamate; + port = teslamatePort; + + listenAddress = "127.0.0.1"; + secretsFile = "/secrets/teslamate/teslamate.env"; + virtualHost = domain; + postgres.enable_server = true; + grafana = { enable = true; port = grafanaPort; listenAddress = "127.0.0.1"; urlPath = "/grafana"; }; }; }