diff --git a/DEPLOYMENT-NOTES.rst b/DEPLOYMENT-NOTES.rst index fe7b40be60a9e248d662f8e89d0af75d12094f5d..cf447ece2798c26fefc0cb41a9636dfa93a2c08d 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 3fa375c640624a9422056d8dbd0242d69a196110..11fda31fc7e9f4f42606b97bc67fc83af28d1c15 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 c5259690b0c047fa7ccc325883edec11e2009680..66d799c8f3c43e36add9509a161048b79e44dd93 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" ];