From a8a06688c3df16bc94097963f03fb144f830b314 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 17 Mar 2021 20:04:50 +0100 Subject: [PATCH] ma storj: expose web-ui --- 2configs/storj/client.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/2configs/storj/client.nix b/2configs/storj/client.nix index e37e2ce..5e67534 100644 --- a/2configs/storj/client.nix +++ b/2configs/storj/client.nix @@ -1,4 +1,8 @@ { lib, ... }: +let + port = "14002"; +internal-ip = "192.168.1.11"; +in { networking.firewall.allowedTCPPorts = [ 28967 ]; virtualisation.oci-containers.containers.storj-storagenode = { @@ -6,7 +10,7 @@ ports = [ # TODO: omo ip "0.0.0.0:28967:28967" - "127.0.0.1:14002:14002" + "127.0.0.1:${port}:${port}" ]; environment = { # SETUP = "true"; # must be run only once ... @@ -24,4 +28,18 @@ StandardOutput = lib.mkForce "journal"; StandardError = lib.mkForce "journal"; }; + + services.nginx.virtualHosts."storj" = { + serverAliases = [ + "storj.lan" + ]; + + locations."/".proxyPass = "http://localhost:${port}"; + locations."/".proxyWebsockets = true; + extraConfig = '' + if ( $server_addr != "${internal-ip}" ) { + return 403; + } + ''; + }; }