From f455d919bd690f6c98c1513e85a0e80a48bf4794 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 29 Feb 2024 03:01:27 +0300 Subject: [PATCH] socat instead of nginx --- hosts/intelnuc/configuration.nix | 65 ++++++++++++-------------------- 1 file changed, 25 insertions(+), 40 deletions(-) diff --git a/hosts/intelnuc/configuration.nix b/hosts/intelnuc/configuration.nix index 41bfb43..e50fa7a 100644 --- a/hosts/intelnuc/configuration.nix +++ b/hosts/intelnuc/configuration.nix @@ -62,46 +62,31 @@ ]; }; - #services.nginx.enable = true; - #services.nginx.virtualHosts."grafana_first" = { - # forceSSL = false; - # listen = [{port = 2000; addr="0.0.0.0"; ssl=false;}]; - # locations."/".extraConfig = '' - # proxy_set_header Host $host; - # proxy_set_header X-Real-IP $remote_addr; - # proxy_pass http://123.123.123.123:3000; - # - # proxy_set_header Upgrade $http_upgrade; - # proxy_set_header Connection "upgrade"; - # ''; - # locations."/api/live/ws".extraConfig = '' - # proxy_pass http://123.123.123.123:3000; - # proxy_read_timeout 120; - # proxy_pass_header X-XSRF-TOKEN; - # proxy_set_header Origin "http://123.123.123.123:3000"; - # proxy_http_version 1.1; - # proxy_set_header Upgrade $http_upgrade; - # proxy_set_header Connection "upgrade"; - # ''; - #}; - #services.nginx.virtualHosts."grafana_second" = { - # forceSSL = false; - # listen = [{port = 2001; addr="0.0.0.0"; ssl=false;}]; - # locations."/".extraConfig = '' - # proxy_set_header Host $host; - # proxy_set_header X-Real-IP $remote_addr; - # proxy_pass http://123.123.123.123:3000; - # ''; - # locations."/api/live/ws".extraConfig = '' - # proxy_pass http://123.123.123.123:3000; - # proxy_read_timeout 120; - # proxy_pass_header X-XSRF-TOKEN; - # proxy_set_header Origin "http://123.123.123.123:3000"; - # proxy_http_version 1.1; - # proxy_set_header Upgrade $http_upgrade; - # proxy_set_header Connection "upgrade"; - # ''; - #}; + systemd.services.grafanasocat43 = { + enable = true; + description = "grafana vpn"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Restart = "on-failure"; + RestartSec = "15"; + Type="simple"; + ExecStart="${pkgs.socat}/bin/socat tcp-l:2000,fork,reuseaddr tcp:123.123.123.123:3000"; + DynamicUser=true; + }; + }; + + systemd.services.grafanasocat44 = { + enable = true; + description = "grafana vpn"; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Restart = "on-failure"; + RestartSec = "15"; + Type="simple"; + ExecStart="${pkgs.socat}/bin/socat tcp-l:2001,fork,reuseaddr tcp:123.123.123.123:3000"; + DynamicUser=true; + }; + }; system.stateVersion = "22.11"; }