jepsen connects to vagrant vms
This commit is contained in:
parent
17ebb65273
commit
ca4cc7e44f
8 changed files with 38 additions and 124 deletions
1
script/jepsen.garage/.gitignore
vendored
1
script/jepsen.garage/.gitignore
vendored
|
@ -13,3 +13,4 @@ pom.xml.asc
|
|||
.hg/
|
||||
.direnv
|
||||
/store
|
||||
.vagrant
|
||||
|
|
29
script/jepsen.garage/Vagrantfile
vendored
Normal file
29
script/jepsen.garage/Vagrantfile
vendored
Normal file
|
@ -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
|
|
@ -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
|
||||
}
|
|
@ -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;
|
||||
};
|
||||
}
|
5
script/jepsen.garage/nodes.vagrant
Normal file
5
script/jepsen.garage/nodes.vagrant
Normal file
|
@ -0,0 +1,5 @@
|
|||
192.168.56.21
|
||||
192.168.56.22
|
||||
192.168.56.23
|
||||
192.168.56.24
|
||||
192.168.56.25
|
|
@ -2,5 +2,6 @@
|
|||
pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
pkgs.leiningen
|
||||
pkgs.vagrant
|
||||
];
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue