all repos — nixfiles @ 69bbccdeed216b30272e1e8a8a049987db44c6be

System and user configuration, managed by nix and home-manager

SatoshiPay: init replicaset at startup
Alan Pearce alan@alanpearce.eu
Tue, 15 Jan 2019 11:05:28 +0100
commit

69bbccdeed216b30272e1e8a8a049987db44c6be

parent

828aa5453eb7301367d252ff839b38e01e3047a1

1 files changed, 11 insertions(+), 0 deletions(-)

jump to
M modules/satoshipay.nixmodules/satoshipay.nix
@@ -46,6 +46,17 @@ timerConfig = {       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;