about summary refs log tree commit diff
path: root/nixos/tests/garage/default.nix
diff options
context:
space:
mode:
authorRaito Bezarius <masterancpp@gmail.com>2022-10-15 22:40:34 +0200
committerRaito Bezarius <masterancpp@gmail.com>2022-12-30 15:12:44 +0100
commit1db2175e7ab291b64590076dcad16354bdf6a6e3 (patch)
tree99629a126cb3e3580caf5744334f9707393ea527 /nixos/tests/garage/default.nix
parent04f4be9a29f41ad2b0907942a1820da2ada1431e (diff)
downloadnixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar.gz
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar.bz2
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar.lz
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar.xz
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.tar.zst
nixlib-1db2175e7ab291b64590076dcad16354bdf6a6e3.zip
nixos/garage: provide multiple versions to provide an upgrade path when using NixOS service
- Add mention to release notes 23.05
- Introduce Garage v0.8
- Protect against unexpected upgrade with stateVersion
- Test matrix over 0.7 × 0.8
Diffstat (limited to 'nixos/tests/garage/default.nix')
-rw-r--r--nixos/tests/garage/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/nixos/tests/garage/default.nix b/nixos/tests/garage/default.nix
new file mode 100644
index 000000000000..5c9159276ace
--- /dev/null
+++ b/nixos/tests/garage/default.nix
@@ -0,0 +1,54 @@
+{ system ? builtins.currentSystem
+, config ? { }
+, pkgs ? import ../../.. { inherit system config; }
+}:
+with pkgs.lib;
+
+let
+    mkNode = package: { replicationMode, publicV6Address ? "::1" }: { pkgs, ... }: {
+      networking.interfaces.eth1.ipv6.addresses = [{
+        address = publicV6Address;
+        prefixLength = 64;
+      }];
+
+      networking.firewall.allowedTCPPorts = [ 3901 3902 ];
+
+      services.garage = {
+        enable = true;
+        inherit package;
+        settings = {
+          replication_mode = replicationMode;
+
+          rpc_bind_addr = "[::]:3901";
+          rpc_public_addr = "[${publicV6Address}]:3901";
+          rpc_secret = "5c1915fa04d0b6739675c61bf5907eb0fe3d9c69850c83820f51b4d25d13868c";
+
+          s3_api = {
+            s3_region = "garage";
+            api_bind_addr = "[::]:3900";
+            root_domain = ".s3.garage";
+          };
+
+          s3_web = {
+            bind_addr = "[::]:3902";
+            root_domain = ".web.garage";
+            index = "index.html";
+          };
+        };
+      };
+      environment.systemPackages = [ pkgs.minio-client ];
+
+      # Garage requires at least 1GiB of free disk space to run.
+      virtualisation.diskSize = 2 * 1024;
+    };
+in
+  foldl
+  (matrix: ver: matrix // {
+    "basic${toString ver}" = import ./basic.nix { inherit system pkgs; mkNode = mkNode pkgs."garage_${ver}"; };
+    "with-3node-replication${toString ver}" = import ./with-3node-replication.nix { inherit system pkgs; mkNode = mkNode pkgs."garage_${ver}"; };
+  })
+  {}
+  [
+    "0_7_3"
+    "0_8_0"
+  ]