diff --git a/morph/README.rst b/morph/README.rst index 96a4d5bf62dc9c29fbec0bcf16c08528dbb59a64..2af46df9acf2e64137bd141a6538f2f69f384e63 100644 --- a/morph/README.rst +++ b/morph/README.rst @@ -43,10 +43,42 @@ Each such file contains a minimal Nix expression supplying critical system confi "Critical" roughly corresponds to anything which must be specified to have a bootable system. These files are referenced by the corresponding ``<hostname>.nix`` files. -<hostname>.nix --------------- +Configuring New Storage Nodes +----------------------------- + +Storage nodes are brought into the grid in a multi-step process. +Here are the steps to configure a new node, +starting from a minimal NixOS 19.03 or 19.09 installation. + +#. Copy ``/etc/nixos/hardware-configuration.nix`` to ``storageNNN-hardware.nix``. + In the case of an EC2 instance, copy ``/etc/nixos/configuration.nix`` instead. +#. Add ``"zfs"`` to ``boot.supportedFilesystems`` in ``storageNNN-hardware.nix``. +#. Create a ``storageNNN-config.nix`` containing further configuration for the new host. +#. Add an entry for the new host to ``grid.nix`` referencing the new files. +#. Deploy to the new host with ``morph deploy morph/grid.nix --on <identifier> boot``. + There will likely be some errors from ZFS-related systemd units which cannot yet succeed because the kernel lacks ZFS support. +#. Log on to the new host and reboot it. +#. Log on to the new host and manually create a storage zpool:: + + zpool create -m legacy -o ashift=12 root raidz /dev/disk/by-id/{...} + +#. Mount the new ZFS filesystem to verify it is working:: + + mkdir /storage + mount -t zfs root /storage + +#. Add a new filesystem entry to ``storageNNN-hardware.nix``:: + + # Manually created using: + # zpool create -f -m legacy -o ashift=12 root raidz ... + fileSystems."/storage" = { + device = "root"; + fsType = "zfs"; + }; + +#. Deploy the new configuration to the host:: + + morph deploy morph/grid.nix --on <identifier> switch --reboot -Each such file contains the parts of the system configuration that aren't *so* related to hardware. -They are referenced from ``grid.nix``. .. _`morph`: https://github.com/DBCDK/morph diff --git a/morph/testing000.nix b/morph/make-testing.nix similarity index 84% rename from morph/testing000.nix rename to morph/make-testing.nix index d45086ae90fb5dfd64b5181d1723c757d219e6bb..77ba053a57a144d3d1fb3950d06fee76c71f35aa 100644 --- a/morph/testing000.nix +++ b/morph/make-testing.nix @@ -1,4 +1,4 @@ -{ publicIPv4, publicStoragePort, ristrettoSigningKeyPath, ... }: rec { +{ publicIPv4, hardware, publicStoragePort, ristrettoSigningKeyPath, stateVersion, ... }: rec { deployment = { secrets = { @@ -17,7 +17,7 @@ }; imports = [ - ./testing000-hardware.nix + hardware ../nixos/modules/private-storage.nix ]; @@ -27,4 +27,6 @@ inherit publicStoragePort; ristrettoSigningKeyPath = deployment.secrets.ristretto-signing-key.destination; }; + + system.stateVersion = stateVersion; } diff --git a/morph/testing-grid.nix b/morph/testing-grid.nix index b4b0649d8af349cd08e2b147ffdd207f32e8d1c6..9ff17e513c87366db43997759aed5bef780a672f 100644 --- a/morph/testing-grid.nix +++ b/morph/testing-grid.nix @@ -10,8 +10,10 @@ import ./make-grid.nix { stateVersion = "19.03"; } // cfg); - "35.157.216.200" = import ./testing000.nix (cfg // { - publicIPv4 = "35.157.216.200"; + "3.120.26.190" = import ./make-testing.nix (cfg // { + publicIPv4 = "3.120.26.190"; + hardware = ./testing001-hardware.nix; + stateVersion = "19.03"; }); }; } diff --git a/morph/testing000-hardware.nix b/morph/testing000-hardware.nix deleted file mode 100644 index 8eccc4b3e13d8f83838e1a07ab355956742e0e23..0000000000000000000000000000000000000000 --- a/morph/testing000-hardware.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - imports = [ - <nixpkgs/nixos/modules/virtualisation/amazon-image.nix> - ]; - - config.ec2.hvm = true; -} diff --git a/morph/testing001-hardware.nix b/morph/testing001-hardware.nix new file mode 100644 index 0000000000000000000000000000000000000000..958a247862a7e4bb2581e7d1bb85cc0f85f3ea24 --- /dev/null +++ b/morph/testing001-hardware.nix @@ -0,0 +1,14 @@ +{ + imports = [ <nixpkgs/nixos/modules/virtualisation/amazon-image.nix> ]; + ec2.hvm = true; + + boot.supportedFilesystems = [ "zfs" ]; + networking.hostId = "10000000"; + + # Manually created using: + # zpool create -m legacy -o ashift=12 root raidz /dev/disk/by-id/{nvme-nvme.1d0f-766f6c3038623133353836383465643436363430-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001,nvme-nvme.1d0f-766f6c3034653531383066303134633436653034-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001,nvme-nvme.1d0f-766f6c3062333164633831386366623231373730-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001,nvme-nvme.1d0f-766f6c3061353939623438336661353933636664-416d617a6f6e20456c617374696320426c6f636b2053746f7265-00000001} + fileSystems."/storage" = { + device = "root"; + fsType = "zfs"; + }; +}