From 6587a9fad54d7da962bfc055885106719363d581 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Mon, 20 Dec 2021 15:36:46 -0500 Subject: [PATCH] rename zkapissuer-vouchers to zkapissuer-v2 and explain why a bit --- DEPLOYMENT-NOTES.rst | 2 +- morph/lib/hardware-vagrant.nix | 2 +- nixos/modules/issuer.nix | 23 ++++++++++++++--------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/DEPLOYMENT-NOTES.rst b/DEPLOYMENT-NOTES.rst index fe7b40be..cf447ece 100644 --- a/DEPLOYMENT-NOTES.rst +++ b/DEPLOYMENT-NOTES.rst @@ -29,7 +29,7 @@ Deployment notes 6. Move the database file to the new location :: - mv -iv /var/lib/zkapissuer/vouchers.sqlite3 /var/lib/zkapissuer-vouchers + mv -iv /var/lib/zkapissuer/vouchers.sqlite3 /var/lib/zkapissuer-v2 7. Clean up the old state directory :: diff --git a/morph/lib/hardware-vagrant.nix b/morph/lib/hardware-vagrant.nix index 3fa375c6..11fda31f 100644 --- a/morph/lib/hardware-vagrant.nix +++ b/morph/lib/hardware-vagrant.nix @@ -38,7 +38,7 @@ # configured value readable. The database won't really have a dedicated # volume but it will sort of appear as if it does. services.private-storage-issuer.voucherFileSystem = { - device = "/var/lib/origin-zkapissuer-vouchers"; + device = "/var/lib/origin-zkapissuer-v2"; options = ["bind"]; }; diff --git a/nixos/modules/issuer.nix b/nixos/modules/issuer.nix index c5259690..66d799c8 100644 --- a/nixos/modules/issuer.nix +++ b/nixos/modules/issuer.nix @@ -123,15 +123,20 @@ in { # Payment server internal http port (arbitrary, non-priviledged): internalHttpPort = "1061"; + # The "-vN" suffix indicates that this Nth incompatible version of on + # disk state as managed by this deployment system. This does not have + # anything to do with what's inside the PaymentServer-managed state. + # Instead it's about things like the type of filesystem used or options + # having to do with the backing volume behind the filesystem. In + # general I expect that to get from "-vN" to "-v(N+1)" some manual + # upgrade steps will be required. + stateDirectory = "zkapissuer-v2"; + in lib.mkIf cfg.enable { # Make sure the voucher database filesystem is mounted. fileSystems = { "voucher-database" = cfg.voucherFileSystem // { - # Note that this path coincides with the StateDirectory we configure - # the systemd service with and the database path we configure - # PaymentServer with. It is probably possible to have less repetition - # and more value sharing here. - mountPoint = "/var/lib/zkapissuer-vouchers"; + mountPoint = "/var/lib/${stateDirectory}"; }; }; @@ -158,8 +163,8 @@ in { # state. According to the docs at # https://www.freedesktop.org/software/systemd/man/systemd.exec.html#RuntimeDirectory= # "The specified directory names must be relative" ... this makes - # systemd create this directory in /var/lib/ for us: - serviceConfig.StateDirectory = "zkapissuer-vouchers"; + # systemd create this directory in /var/lib/ for us. + serviceConfig.StateDirectory = stateDirectory; serviceConfig.StateDirectoryMode = "0750"; unitConfig.AssertPathExists = [ @@ -171,8 +176,8 @@ in { # Similarly, bail if the newer path you were just told to create -- # /var/lib/zkapissuer/vouchers.sqlite3 -- exists. It needs to be - # moved /var/lib/zkapissuer-vouchers where a dedicated filesystem has - # been created for it. + # moved /var/lib/zkapissuer-v2 where a dedicated filesystem has been + # created for it. "!/var/lib/zkapissuer/vouchers.sqlite3" ]; -- GitLab