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)
downloadnixfiles-69bbccdeed216b30272e1e8a8a049987db44c6be.tar.lz
nixfiles-69bbccdeed216b30272e1e8a8a049987db44c6be.tar.zst
nixfiles-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 46cccc75..5198cc14 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;