i can't get this test working

Signed-off-by: Xe <me@christine.website>
This commit is contained in:
Cadey Ratio 2021-12-26 13:00:25 -05:00
parent f83a28dcea
commit d3b4c730a0
2 changed files with 51 additions and 15 deletions

View File

@ -61,6 +61,22 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs_3": {
"locked": {
"lastModified": 1640319671,
"narHash": "sha256-ZkKmakwaOaLiZOpIZWbeJZwap5CzJ30s4UJTfydYIYc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "eac07edbd20ed4908b98790ba299250b5527ecdf",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
@ -69,14 +85,32 @@
"xess": "xess" "xess": "xess"
} }
}, },
"xess": { "utils": {
"flake": false,
"locked": { "locked": {
"lastModified": 1637634344, "lastModified": 1638122382,
"narHash": "sha256-63zWhmRpppLzh+H70gHSViHfZ4JvtnOFDRrrjkXtzJE=", "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"xess": {
"inputs": {
"nixpkgs": "nixpkgs_3",
"utils": "utils"
},
"locked": {
"lastModified": 1640540322,
"narHash": "sha256-II4raADUWKTLDAALyJSToAgL8FB1ADbRHqEr/b3JeIc=",
"owner": "Xe", "owner": "Xe",
"repo": "Xess", "repo": "Xess",
"rev": "f9ffc529fca9751afdce2408089c51e73d56fce8", "rev": "5fabc96de6487a721235c4bdf18214519d9e6201",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -6,7 +6,7 @@
}; };
outputs = { self, nixpkgs, flake-utils, naersk, xess }: outputs = { self, nixpkgs, flake-utils, naersk, xess }:
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let let
pkgs = nixpkgs.legacyPackages."${system}"; pkgs = nixpkgs.legacyPackages."${system}";
naersk-lib = naersk.lib."${system}"; naersk-lib = naersk.lib."${system}";
@ -31,7 +31,9 @@
cp -rf $src/templates $out/templates cp -rf $src/templates $out/templates
cp -rf ${printerfacts-bin}/bin $out/bin cp -rf ${printerfacts-bin}/bin $out/bin
cp -rf ${xess}/xess.css $out/static/gruvbox.css cp -rf ${
xess.defaultPackage."${system}"
}/static/css/xess.css $out/static/gruvbox.css
''; '';
}; };
}; };
@ -83,11 +85,10 @@
within.services.printerfacts.enable = true; within.services.printerfacts.enable = true;
}; };
testScript = testScript = ''
''
start_all() start_all()
client.wait_for_unit("within.printerfacts.service") server.wait_for_unit("within.printerfacts.service")
client.succeed("curl -f http://printerfacts.akua --resolve printerfacts.akua:80:127.0.0.1") server.succeed("sleep 2 && curl -m 2 -v -f http://printerfacts.akua/metrics --unix-socket /srv/within/run/printerfacts.sock")
''; '';
}; };
@ -124,11 +125,12 @@
DynamicUser = "yes"; DynamicUser = "yes";
Restart = "on-failure"; Restart = "on-failure";
WorkingDirectory = "/srv/within/printerfacts"; WorkingDirectory = "/srv/within/printerfacts";
RestartSec = "30s"; RestartSec = "5s";
}; };
script = let site = self.packages."${system}".printerfacts; script = let site = self.packages."${system}".printerfacts;
in '' in ''
set -x
export SOCKPATH=${cfg.sockPath} export SOCKPATH=${cfg.sockPath}
export DOMAIN=${toString cfg.domain} export DOMAIN=${toString cfg.domain}
export RUST_LOG=info export RUST_LOG=info
@ -146,7 +148,7 @@
proxyWebsockets = true; proxyWebsockets = true;
}; };
forceSSL = cfg.useACME; forceSSL = cfg.useACME;
useACMEHost = "cetacean.club"; useACMEHost = mkIf cfg.useACME "cetacean.club";
extraConfig = '' extraConfig = ''
access_log /var/log/nginx/printerfacts.access.log; access_log /var/log/nginx/printerfacts.access.log;
''; '';