summary refs log tree commit diff stats
path: root/modules
diff options
context:
space:
mode:
authorAlan Pearce2019-01-15 11:05:28 +0100
committerAlan Pearce2019-01-15 11:05:28 +0100
commit69bbccdeed216b30272e1e8a8a049987db44c6be (patch)
treef3c851eaae8b4f65faa66574b0c7d4f418ce8f7e /modules
parent828aa5453eb7301367d252ff839b38e01e3047a1 (diff)
downloadnixos-configuration-69bbccdeed216b30272e1e8a8a049987db44c6be.tar.lz
nixos-configuration-69bbccdeed216b30272e1e8a8a049987db44c6be.tar.zst
nixos-configuration-69bbccdeed216b30272e1e8a8a049987db44c6be.zip
SatoshiPay: init replicaset at startup
Diffstat (limited to 'modules')
-rw-r--r--modules/satoshipay.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/satoshipay.nix b/modules/satoshipay.nix
index 46cccc7..5198cc1 100644
--- a/modules/satoshipay.nix
+++ b/modules/satoshipay.nix
@@ -46,6 +46,17 @@
       OnActiveSec = "1 min";
     };
   };
+  systemd.services.mongodb-init = {
+    description = "Init mongodb replicaset";
+    requires = [ "mongodb.service" ];
+    script = "${pkgs.mongodb}/bin/mongo --eval 'rs.initiate()'";
+  };
+  systemd.timers.mongodb-init = {
+    wantedBy = [ "timers.target" ];
+    timerConfig = {
+      OnActiveSec = "2 min";
+    };
+  };
 
   services.redis = {
     enable = true;