nixos/hosts/architect/teslamate.nix
Giulio De Pasquale 2dc8e1b1a3 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
2024-11-17 20:28:53 +00:00

52 lines
1.1 KiB
Nix

{ config, pkgs, ... }:
let
domain = "tesla.giugl.io";
teslamatePort = 11234;
grafanaPort = 11334;
allowLan = true;
allowWAN = false;
in
{
architect.vhost.${domain} = with config.architect.networks; {
dnsInterfaces = [ "lan" "tailscale" ];
locations = {
"/" = {
inherit allowLan allowWAN;
port = teslamatePort;
proxyWebsockets = true;
allow = [
tailscale.net
];
};
"/live/websocket" = {
inherit allowLan allowWAN;
port = teslamatePort;
proxyWebsockets = true;
allow = [
tailscale.net
];
};
"/grafana" = {
inherit allowLan allowWAN;
port = grafanaPort;
proxyWebsockets = true;
allow = [
tailscale.net
];
};
};
};
services.teslamate = {
enable = true;
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"; };
};
}