Skip to content

Commit

Permalink
chore: add nixops ssh wrapper scripts
Browse files Browse the repository at this point in the history
- add utilities for measuring resource usage
- use root nginx location for nixops
  • Loading branch information
steve-chavez committed Oct 1, 2024
1 parent d65e97f commit 607694d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
4 changes: 4 additions & 0 deletions nix/nginx/conf/custom.conf
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
4 changes: 0 additions & 4 deletions nix/nginx/conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ http {
server {
listen 8080;

location / {
echo 'Hello world';
}

include custom.conf;
}

Expand Down
4 changes: 4 additions & 0 deletions nix/nixops.nix
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ in {
};

environment.systemPackages = [
pkgs.bcc
pkgs.pgmetrics
pkgs.pg_activity
pkgs.htop
pkgs.vegeta
(
pkgs.writeShellScriptBin "vegeta-bench" ''
Expand Down
20 changes: 20 additions & 0 deletions nix/nixopsScripts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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")
''
Expand All @@ -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
]

0 comments on commit 607694d

Please sign in to comment.