diff --git a/morph/README.rst b/morph/README.rst index 3749ebf97441936739df6bbdd4a9395294591bd5..7f8bb655b36010ae2bcb152632b39387de0a412e 100644 --- a/morph/README.rst +++ b/morph/README.rst @@ -7,20 +7,24 @@ and some JSON-based configuration in ``.config.json`` files. This configuration is fed to `morph`_ to make changes to the deployment. -bootstrap-configuration.nix ---------------------------- +lib +--- -This is meant as a minimal system configuration to use as part of crossgrading a Debian install to NixOS. -It has a lot of comments explaining different parts of Nix and NixOS. -You may want to browse it before looking at other ``.nix`` files here. +This contains Nix library code for defining the grids. -grid.config.json ----------------- +grid +---- -This contains configuration for Tahoe-LAFS. +Specific grid definitions live in subdirectories beneath this directory. + +config.json +~~~~~~~~~~~ + +As much as possible of the static configuration for the PrivateStorage.io application is provided in this file. +It is read by **grid.nix**. grid.nix --------- +~~~~~~~~ This is the `morph`_ entrypoint for the grid. This defines all of the servers that are part of the grid. @@ -30,14 +34,15 @@ You can do things like build the network:: morph build grid.nix + <hostname>-hardware.nix ------------------------ +~~~~~~~~~~~~~~~~~~~~~~~ These are the generated hardware-related configuration files for servers in the grid. These files are referenced from the corresponding ``<hostname>.nix`` files. <hostname>-config.nix ---------------------- +~~~~~~~~~~~~~~~~~~~~~ Each such file contains a minimal Nix expression supplying critical system configuration details. "Critical" roughly corresponds to anything which must be specified to have a bootable system. @@ -76,6 +81,6 @@ starting from a minimal NixOS 19.03 or 19.09 installation. #. 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 --upload-secrets --reboot``. +#. Deploy to the new host with ``morph deploy morph/.../grid.nix --on <identifier> boot --upload-secrets --reboot``. .. _`morph`: https://github.com/DBCDK/morph diff --git a/morph/grid.config.json b/morph/grid/production/config.json similarity index 100% rename from morph/grid.config.json rename to morph/grid/production/config.json diff --git a/morph/grid.nix b/morph/grid/production/grid.nix similarity index 79% rename from morph/grid.nix rename to morph/grid/production/grid.nix index 0de7007d3cc98ff90f8a1bc01461014c0149444e..a65b77bd9a873c659ee9bb9f6f16aac4c2d45d6d 100644 --- a/morph/grid.nix +++ b/morph/grid/production/grid.nix @@ -1,9 +1,9 @@ # Load the helper function and call it with arguments tailored for the testing # grid. It will make the morph configuration for us. We share this function # with the testing grid and have one fewer possible point of divergence. -import ./make-grid.nix { +import ../../lib/make-grid.nix { name = "Production"; - config = ./grid.config.json; + config = ./config.json; nodes = cfg: { # Here are the hosts that are in this morph network. This is sort of like # a server manifest. We try to keep as many of the specific details as @@ -17,32 +17,32 @@ import ./make-grid.nix { # doesn't specify one. # # The names must be unique! - "payments.privatestorage.io" = import ./issuer.nix ({ - hardware = ./issuer-aws.nix; + "payments.privatestorage.io" = import ../../lib/issuer.nix ({ + hardware = ../../lib/issuer-aws.nix; stateVersion = "19.03"; } // cfg); - "storage001" = import ./make-storage.nix ({ + "storage001" = import ../../lib/make-storage.nix ({ cfg = import ./storage001-config.nix; hardware = ./storage001-hardware.nix; stateVersion = "19.09"; } // cfg); - "storage002" = import ./make-storage.nix ({ + "storage002" = import ../../lib/make-storage.nix ({ cfg = import ./storage002-config.nix; hardware = ./storage002-hardware.nix; stateVersion = "19.09"; } // cfg); - "storage003" = import ./make-storage.nix ({ + "storage003" = import ../../lib/make-storage.nix ({ cfg = import ./storage003-config.nix; hardware = ./storage003-hardware.nix; stateVersion = "19.09"; } // cfg); - "storage004" = import ./make-storage.nix ({ + "storage004" = import ../../lib/make-storage.nix ({ cfg = import ./storage004-config.nix; hardware = ./storage004-hardware.nix; stateVersion = "19.09"; } // cfg); - "storage005" = import ./make-storage.nix ({ + "storage005" = import ../../lib/make-storage.nix ({ cfg = import ./storage005-config.nix; hardware = ./storage005-hardware.nix; stateVersion = "19.03"; diff --git a/morph/storage000-config.nix b/morph/grid/production/storage000-config.nix similarity index 100% rename from morph/storage000-config.nix rename to morph/grid/production/storage000-config.nix diff --git a/morph/storage000-hardware.nix b/morph/grid/production/storage000-hardware.nix similarity index 100% rename from morph/storage000-hardware.nix rename to morph/grid/production/storage000-hardware.nix diff --git a/morph/storage001-config.nix b/morph/grid/production/storage001-config.nix similarity index 100% rename from morph/storage001-config.nix rename to morph/grid/production/storage001-config.nix diff --git a/morph/storage001-hardware.nix b/morph/grid/production/storage001-hardware.nix similarity index 100% rename from morph/storage001-hardware.nix rename to morph/grid/production/storage001-hardware.nix diff --git a/morph/storage002-config.nix b/morph/grid/production/storage002-config.nix similarity index 100% rename from morph/storage002-config.nix rename to morph/grid/production/storage002-config.nix diff --git a/morph/storage002-hardware.nix b/morph/grid/production/storage002-hardware.nix similarity index 100% rename from morph/storage002-hardware.nix rename to morph/grid/production/storage002-hardware.nix diff --git a/morph/storage003-config.nix b/morph/grid/production/storage003-config.nix similarity index 100% rename from morph/storage003-config.nix rename to morph/grid/production/storage003-config.nix diff --git a/morph/storage003-hardware.nix b/morph/grid/production/storage003-hardware.nix similarity index 100% rename from morph/storage003-hardware.nix rename to morph/grid/production/storage003-hardware.nix diff --git a/morph/storage004-config.nix b/morph/grid/production/storage004-config.nix similarity index 100% rename from morph/storage004-config.nix rename to morph/grid/production/storage004-config.nix diff --git a/morph/storage004-hardware.nix b/morph/grid/production/storage004-hardware.nix similarity index 100% rename from morph/storage004-hardware.nix rename to morph/grid/production/storage004-hardware.nix diff --git a/morph/storage005-config.nix b/morph/grid/production/storage005-config.nix similarity index 100% rename from morph/storage005-config.nix rename to morph/grid/production/storage005-config.nix diff --git a/morph/storage005-hardware.nix b/morph/grid/production/storage005-hardware.nix similarity index 100% rename from morph/storage005-hardware.nix rename to morph/grid/production/storage005-hardware.nix diff --git a/morph/testing-grid.config.json b/morph/grid/testing/config.json similarity index 100% rename from morph/testing-grid.config.json rename to morph/grid/testing/config.json diff --git a/morph/testing-grid.nix b/morph/grid/testing/grid.nix similarity index 64% rename from morph/testing-grid.nix rename to morph/grid/testing/grid.nix index 9ff17e513c87366db43997759aed5bef780a672f..4db91363105ab9f35d21ccb037427cbfb7226003 100644 --- a/morph/testing-grid.nix +++ b/morph/grid/testing/grid.nix @@ -1,16 +1,16 @@ # Load the helper function and call it with arguments tailored for the testing # grid. It will make the morph configuration for us. We share this function # with the production grid and have one fewer possible point of divergence. -import ./make-grid.nix { +import ../../lib/make-grid.nix { name = "Testing"; - config = ./testing-grid.config.json; + config = ./config.json; nodes = cfg: { - "payments.privatestorage-staging.com" = import ./issuer.nix ({ - hardware = ./issuer-aws.nix; + "payments.privatestorage-staging.com" = import ../../lib/issuer.nix ({ + hardware = ../../lib/issuer-aws.nix; stateVersion = "19.03"; } // cfg); - "3.120.26.190" = import ./make-testing.nix (cfg // { + "3.120.26.190" = import ../../lib/make-testing.nix (cfg // { publicIPv4 = "3.120.26.190"; hardware = ./testing001-hardware.nix; stateVersion = "19.03"; diff --git a/morph/testing001-hardware.nix b/morph/grid/testing/testing001-hardware.nix similarity index 100% rename from morph/testing001-hardware.nix rename to morph/grid/testing/testing001-hardware.nix diff --git a/morph/bootstrap-configuration.nix b/morph/lib/bootstrap-configuration.nix similarity index 100% rename from morph/bootstrap-configuration.nix rename to morph/lib/bootstrap-configuration.nix diff --git a/morph/issuer-aws.nix b/morph/lib/issuer-aws.nix similarity index 100% rename from morph/issuer-aws.nix rename to morph/lib/issuer-aws.nix diff --git a/morph/issuer.nix b/morph/lib/issuer.nix similarity index 83% rename from morph/issuer.nix rename to morph/lib/issuer.nix index 98d10d38cd49d1c0dda8a630ef7b622d5ea62284..b2ef90c1d76499c08839343f415f63612c792c8b 100644 --- a/morph/issuer.nix +++ b/morph/lib/issuer.nix @@ -22,14 +22,14 @@ imports = [ hardware - ../nixos/modules/issuer.nix + ../../nixos/modules/issuer.nix ]; services.private-storage-issuer = { enable = true; tls = true; - ristrettoSigningKeyPath = ./.. + ristrettoSigningKeyPath; - stripeSecretKeyPath = ./.. + stripeSecretKeyPath; + ristrettoSigningKeyPath = ./../.. + ristrettoSigningKeyPath; + stripeSecretKeyPath = ./../.. + stripeSecretKeyPath; database = "SQLite3"; databasePath = "/var/db/vouchers.sqlite3"; inherit letsEncryptAdminEmail; diff --git a/morph/make-grid.nix b/morph/lib/make-grid.nix similarity index 100% rename from morph/make-grid.nix rename to morph/lib/make-grid.nix diff --git a/morph/make-storage.nix b/morph/lib/make-storage.nix similarity index 97% rename from morph/make-storage.nix rename to morph/lib/make-storage.nix index 84a13be3c4089194b0d1a1ff6218b1161c1537f0..da206572566b1b997d4160ba46a98aa4fd547430 100644 --- a/morph/make-storage.nix +++ b/morph/lib/make-storage.nix @@ -32,10 +32,10 @@ # Include the results of the hardware scan. hardware # Configure it as a system operated by 100TB. - ../nixos/modules/100tb.nix + ../../nixos/modules/100tb.nix # Bring in our module for configuring the Tahoe-LAFS service and other # Private Storage-specific things. - ../nixos/modules/private-storage.nix + ../../nixos/modules/private-storage.nix ]; # Pass the configuration specific to this host to the 100TB module to be diff --git a/morph/make-testing.nix b/morph/lib/make-testing.nix similarity index 95% rename from morph/make-testing.nix rename to morph/lib/make-testing.nix index 77ba053a57a144d3d1fb3950d06fee76c71f35aa..24de7ea40ad778d0ca2418be063a4a1528965839 100644 --- a/morph/make-testing.nix +++ b/morph/lib/make-testing.nix @@ -18,7 +18,7 @@ imports = [ hardware - ../nixos/modules/private-storage.nix + ../../nixos/modules/private-storage.nix ]; services.private-storage =