From 607694dec917c2022e99ef0eb85321f7b08f8329 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Fri, 27 Sep 2024 13:47:18 -0500 Subject: [PATCH] chore: add nixops ssh wrapper scripts - add utilities for measuring resource usage - use root nginx location for nixops --- nix/nginx/conf/custom.conf | 4 ++++ nix/nginx/conf/nginx.conf | 4 ---- nix/nixops.nix | 4 ++++ nix/nixopsScripts.nix | 20 ++++++++++++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/nix/nginx/conf/custom.conf b/nix/nginx/conf/custom.conf index 2658fab..3c21083 100644 --- a/nix/nginx/conf/custom.conf +++ b/nix/nginx/conf/custom.conf @@ -1,3 +1,7 @@ +location / { + echo 'Hello world'; +} + location /slow-reply { echo_sleep 2; echo 'this text will come in response body with HTTP 200 after 2 seconds'; diff --git a/nix/nginx/conf/nginx.conf b/nix/nginx/conf/nginx.conf index a080e04..52cd231 100644 --- a/nix/nginx/conf/nginx.conf +++ b/nix/nginx/conf/nginx.conf @@ -14,10 +14,6 @@ http { server { listen 8080; - location / { - echo 'Hello world'; - } - include custom.conf; } diff --git a/nix/nixops.nix b/nix/nixops.nix index 918b5c8..ca4ac26 100644 --- a/nix/nixops.nix +++ b/nix/nixops.nix @@ -126,6 +126,10 @@ in { }; environment.systemPackages = [ + pkgs.bcc + pkgs.pgmetrics + pkgs.pg_activity + pkgs.htop pkgs.vegeta ( pkgs.writeShellScriptBin "vegeta-bench" '' diff --git a/nix/nixopsScripts.nix b/nix/nixopsScripts.nix index 6f99f98..282e23e 100644 --- a/nix/nixopsScripts.nix +++ b/nix/nixopsScripts.nix @@ -30,6 +30,15 @@ let ${nixopsBin} ssh -d pg_net client ''; + nixopsSSHServer = + writeShellScriptBin ("net-cloud-ssh-server") + '' + set -euo pipefail + + cd nix + + ${nixopsBin} ssh -d pg_net server + ''; nixopsReproTimeouts = writeShellScriptBin ("net-cloud-reproduce-timeouts") '' @@ -50,10 +59,21 @@ let ${nixopsBin} delete -d pg_net ''; + nixopsInfo = + writeShellScriptBin ("net-cloud-info") + '' + set -euo pipefail + + cd nix + + ${nixopsBin} info + ''; in [ nixopsDeploy nixopsSSH + nixopsSSHServer nixopsReproTimeouts nixopsDestroy + nixopsInfo ]