From d2f4986e7c14864d832a905f14db2cf3251ad5b3 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Tue, 5 Nov 2019 08:27:44 -0500
Subject: [PATCH] First steps towards the new testing storage node

Also some refactoring to make this easier in the future, steps towards
unifying production and testing definitions, and start of docs for the whole thing.
---
 morph/README.rst                           | 15 +++++++++++----
 morph/{testing000.nix => make-testing.nix} |  4 ++--
 morph/testing-grid.nix                     |  3 ++-
 morph/testing000-hardware.nix              |  7 -------
 morph/testing001-hardware.nix              |  5 +++++
 5 files changed, 20 insertions(+), 14 deletions(-)
 rename morph/{testing000.nix => make-testing.nix} (89%)
 delete mode 100644 morph/testing000-hardware.nix
 create mode 100644 morph/testing001-hardware.nix

diff --git a/morph/README.rst b/morph/README.rst
index 96a4d5bf..6fd00a93 100644
--- a/morph/README.rst
+++ b/morph/README.rst
@@ -43,10 +43,17 @@ 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.
+#. 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.
 
-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 89%
rename from morph/testing000.nix
rename to morph/make-testing.nix
index d45086ae..2c3a9d1c 100644
--- a/morph/testing000.nix
+++ b/morph/make-testing.nix
@@ -1,4 +1,4 @@
-{ publicIPv4, publicStoragePort, ristrettoSigningKeyPath, ... }: rec {
+{ publicIPv4, hardware, publicStoragePort, ristrettoSigningKeyPath, ... }: rec {
 
   deployment = {
     secrets = {
@@ -17,7 +17,7 @@
   };
 
   imports = [
-    ./testing000-hardware.nix
+    hardware
     ../nixos/modules/private-storage.nix
   ];
 
diff --git a/morph/testing-grid.nix b/morph/testing-grid.nix
index 778b1c65..77c9574f 100644
--- a/morph/testing-grid.nix
+++ b/morph/testing-grid.nix
@@ -10,8 +10,9 @@ import ./make-grid.nix {
       stateVersion = "19.03";
     } // cfg);
 
-    "3.120.26.190" = import ./testing000.nix (cfg // {
+    "3.120.26.190" = import ./make-testing.nix (cfg // {
       publicIPv4 = "3.120.26.190";
+      hardware = ./testing001-hardware.nix;
     });
   };
 }
diff --git a/morph/testing000-hardware.nix b/morph/testing000-hardware.nix
deleted file mode 100644
index 8eccc4b3..00000000
--- 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 00000000..9c79ca12
--- /dev/null
+++ b/morph/testing001-hardware.nix
@@ -0,0 +1,5 @@
+{
+  imports = [ <nixpkgs/nixos/modules/virtualisation/amazon-image.nix> ];
+  ec2.hvm = true;
+
+}
-- 
GitLab