aboutsummaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/jepsen.garage/.gitignore1
-rw-r--r--script/jepsen.garage/Vagrantfile29
-rw-r--r--script/jepsen.garage/flake.lock64
-rw-r--r--script/jepsen.garage/flake.nix59
-rw-r--r--script/jepsen.garage/nodes.containers (renamed from script/jepsen.garage/nodes)0
-rw-r--r--script/jepsen.garage/nodes.vagrant5
-rw-r--r--script/jepsen.garage/shell.nix1
-rw-r--r--script/jepsen.garage/src/jepsen/garage.clj3
8 files changed, 38 insertions, 124 deletions
diff --git a/script/jepsen.garage/.gitignore b/script/jepsen.garage/.gitignore
index 44e41749..6eb8c209 100644
--- a/script/jepsen.garage/.gitignore
+++ b/script/jepsen.garage/.gitignore
@@ -13,3 +13,4 @@ pom.xml.asc
.hg/
.direnv
/store
+.vagrant
diff --git a/script/jepsen.garage/Vagrantfile b/script/jepsen.garage/Vagrantfile
new file mode 100644
index 00000000..da6a277f
--- /dev/null
+++ b/script/jepsen.garage/Vagrantfile
@@ -0,0 +1,29 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+#
+
+def vm(config, hostname, ip)
+ config.vm.hostname = hostname
+ config.vm.network "private_network", ip: ip
+end
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "generic/alpine38"
+
+ config.vm.provider "virtualbox" do |vb|
+ vb.gui = false
+ vb.memory = "512"
+ end
+
+ config.vm.provision "shell", inline: <<-SHELL
+ echo "root:root" | chpasswd
+ apk update
+ apk add wget
+ SHELL
+
+ config.vm.define "n1" do |config| vm(config, "n1", "192.168.56.21") end
+ config.vm.define "n2" do |config| vm(config, "n2", "192.168.56.22") end
+ config.vm.define "n3" do |config| vm(config, "n3", "192.168.56.23") end
+ config.vm.define "n4" do |config| vm(config, "n4", "192.168.56.24") end
+ config.vm.define "n5" do |config| vm(config, "n5", "192.168.56.25") end
+end
diff --git a/script/jepsen.garage/flake.lock b/script/jepsen.garage/flake.lock
deleted file mode 100644
index 63dd88f8..00000000
--- a/script/jepsen.garage/flake.lock
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "nodes": {
- "flake-utils": {
- "locked": {
- "lastModified": 1678901627,
- "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
- "microvm": {
- "inputs": {
- "flake-utils": "flake-utils",
- "nixpkgs": [
- "nixpkgs"
- ]
- },
- "locked": {
- "lastModified": 1681747916,
- "narHash": "sha256-tpWJMHWbTrFD2Nmj3Y3qYXoaTP4LFT0P0wt5zW8/aI8=",
- "owner": "astro",
- "repo": "microvm.nix",
- "rev": "68f1b9ece0f116d5ea1d1ecaf17f7b526303df81",
- "type": "github"
- },
- "original": {
- "owner": "astro",
- "repo": "microvm.nix",
- "type": "github"
- }
- },
- "nixpkgs": {
- "locked": {
- "lastModified": 1681737997,
- "narHash": "sha256-pHhjgsIkRMu80LmVe8QoKIZB6VZGRRxFmIvsC5S89k4=",
- "owner": "nixos",
- "repo": "nixpkgs",
- "rev": "f00994e78cd39e6fc966f0c4103f908e63284780",
- "type": "github"
- },
- "original": {
- "owner": "nixos",
- "ref": "nixos-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "root": {
- "inputs": {
- "microvm": "microvm",
- "nixpkgs": "nixpkgs"
- }
- }
- },
- "root": "root",
- "version": 7
-}
diff --git a/script/jepsen.garage/flake.nix b/script/jepsen.garage/flake.nix
deleted file mode 100644
index 2afa9ea1..00000000
--- a/script/jepsen.garage/flake.nix
+++ /dev/null
@@ -1,59 +0,0 @@
-# Example flake.nix
-{
- inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
- inputs.microvm.url = "github:astro/microvm.nix";
- inputs.microvm.inputs.nixpkgs.follows = "nixpkgs";
-
- outputs = { self, nixpkgs, microvm }:
- with nixpkgs.lib;
- let
- addressMap =
- {
- "n1" = { ip = "10.1.0.10"; mac = "02:00:00:00:99:01"; };
- "n2" = { ip = "10.2.0.10"; mac = "02:00:00:00:99:02"; };
- "n3" = { ip = "10.3.0.10"; mac = "02:00:00:00:99:03"; };
- "n4" = { ip = "10.4.0.10"; mac = "02:00:00:00:99:04"; };
- "n5" = { ip = "10.5.0.10"; mac = "02:00:00:00:99:05"; };
- };
- toHostsEntry = name: { ip, ... }: "${ip} ${name}";
- extraHosts =
- builtins.concatStringsSep "\n"
- (attrsets.mapAttrsToList toHostsEntry addressMap);
-
- nodeConfig = hostName: { ip, mac }: nixosSystem {
- system = "x86_64-linux";
- modules = [
- # Include the microvm module
- microvm.nixosModules.microvm
- # Add more modules here
- {
- networking = {
- inherit hostName extraHosts;
- };
-
- microvm.hypervisor = "cloud-hypervisor";
- microvm.interfaces = [ {
- inherit mac;
- type = "tap";
- id = "microvm-${hostName}";
- } ];
-
- services.openssh = {
- enable = true;
- permitRootLogin = "yes";
- };
- users.users.root.initialPassword = "root";
-
- #services.garage = {
- # enable = true;
- # logLevel = "debug";
- # settings.replication_mode = "3";
- #};
- }
- ];
- };
- in
- {
- nixosConfigurations = mapAttrs nodeConfig addressMap;
- };
-}
diff --git a/script/jepsen.garage/nodes b/script/jepsen.garage/nodes.containers
index b8f3eeb1..b8f3eeb1 100644
--- a/script/jepsen.garage/nodes
+++ b/script/jepsen.garage/nodes.containers
diff --git a/script/jepsen.garage/nodes.vagrant b/script/jepsen.garage/nodes.vagrant
new file mode 100644
index 00000000..df7c4622
--- /dev/null
+++ b/script/jepsen.garage/nodes.vagrant
@@ -0,0 +1,5 @@
+192.168.56.21
+192.168.56.22
+192.168.56.23
+192.168.56.24
+192.168.56.25
diff --git a/script/jepsen.garage/shell.nix b/script/jepsen.garage/shell.nix
index 4f0af839..b0dda6d1 100644
--- a/script/jepsen.garage/shell.nix
+++ b/script/jepsen.garage/shell.nix
@@ -2,5 +2,6 @@
pkgs.mkShell {
nativeBuildInputs = [
pkgs.leiningen
+ pkgs.vagrant
];
}
diff --git a/script/jepsen.garage/src/jepsen/garage.clj b/script/jepsen.garage/src/jepsen/garage.clj
index 1351c4a7..6617064e 100644
--- a/script/jepsen.garage/src/jepsen/garage.clj
+++ b/script/jepsen.garage/src/jepsen/garage.clj
@@ -14,5 +14,6 @@
"Handles command line arguments. Can either run a test, or a web server for
browsing results."
[& args]
- (cli/run! (cli/single-test-cmd {:test-fn garage-test})
+ (cli/run! (merge (cli/single-test-cmd {:test-fn garage-test})
+ (cli/serve-cmd))
args))