From d0057b822858e5d31d0b80d61ec555dea9b71ace Mon Sep 17 00:00:00 2001 From: Vika Date: Tue, 24 May 2022 12:58:15 +0300 Subject: flake.nix: make a test for distributed Kittybox I said some boastful words about Kittybox being able to horizontally scale and I wanted to prove them. This is the proof. This test creates an NFS file server, then spawns three VMs. Provisioning a website on one of them, it then queries the website on all of the three machines. This shows that a shared backing store can make Kittybox infinitely scale horizontally depending on how much traffic you're getting. --- flake.nix | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 900d879..4de70c6 100644 --- a/flake.nix +++ b/flake.nix @@ -187,12 +187,25 @@ }; rust-bin = pkgs.rust-bin.stable.latest; packages = { - kittybox = { stdenv, lib, openssl, zlib, pkg-config, protobuf, naersk-lib, lld, mold }: + kittybox = { stdenv, lib, runCommandNoCC, openssl, zlib, pkg-config, protobuf, naersk-lib, lld, mold }: naersk-lib.buildPackage { pname = "kittybox"; version = "0.1.0"; - src = ./.; + /*src = builtins.filterSource (name: type: builtins.elem (builtins.elemAt (lib.splitString "/" name) 4) [ + "Cargo.toml" "Cargo.lock" + "src" "templates" "util" + "fonts" + ]) ./.;*/ + src = runCommandNoCC "kittybox-src" {} '' + mkdir -p $out + cp -r ${./Cargo.toml} $out/Cargo.toml + cp -r ${./Cargo.lock} $out/Cargo.lock + cp -r ${./src} $out/src + cp -r ${./templates} $out/templates + cp -r ${./util} $out/util + cp -r ${./fonts} $out/fonts + ''; checkInputs = [ openssl.dev zlib ]; nativeBuildInputs = [ pkg-config protobuf ]; @@ -200,8 +213,6 @@ doCheck = stdenv.hostPlatform == stdenv.targetPlatform; - singleStep = true; - meta = with lib.meta; { maintainers = with lib.maintainers; [ vikanezrimaya ]; platforms = supportedSystems; @@ -221,6 +232,7 @@ checks = { kittybox = self.packages.${system}.kittybox; + distributed-test = pkgs.nixosTest (import ./distributed-test.nix self); nixos-test = (pkgs.nixosTest ({ lib }: { name = "nixos-kittybox"; -- cgit 1.4.1