summary refs log tree commit diff
path: root/modules/auto-redeploy.nix
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-04-03 19:12:11 +0200
committerRory& <root@rory.gay>2024-06-05 15:52:38 +0200
commit33ccd4b4e735384e9e0f24583b3fd082bd6a0476 (patch)
tree3beed0c91970c2910a757f9c35981a6594c00204 /modules/auto-redeploy.nix
parentMore verbosity (diff)
downloadSpacebar-Open-Infrastructure-33ccd4b4e735384e9e0f24583b3fd082bd6a0476.tar.xz
Switch to timer
Diffstat (limited to 'modules/auto-redeploy.nix')
-rw-r--r--modules/auto-redeploy.nix20
1 files changed, 16 insertions, 4 deletions
diff --git a/modules/auto-redeploy.nix b/modules/auto-redeploy.nix
index 7cecb93..52decc7 100644
--- a/modules/auto-redeploy.nix
+++ b/modules/auto-redeploy.nix
@@ -1,9 +1,21 @@
 { config, pkgs, lib, secrets, ... }:
 {
+  systemd.timers = {
+    "auto-redeploy" = {
+      wantedBy = [ "timers.target" ];
+      after = [ "network.target" ];
+      timerConfig = {
+        #every 30 seconds since boot
+        OnBootSec = "10s";
+        OnUnitActiveSec = "30s";
+        Unit = "auto-redeploy.service";
+      };
+    };
+  };
   systemd.services = {
     "auto-redeploy" = {
-        wantedBy = [ "multi-user.target" ];
-        after = [ "network.target" ];
+        #wantedBy = [ "multi-user.target" ];
+        #after = [ "network.target" ];
         serviceConfig = {
             ExecStart = ''
               ${pkgs.curl}/bin/curl -H "Content-Type: application/json" -d '{"username": "${config.networking.hostName} - redeploy", "content": "System started redeploy."}' ${secrets.webhooks.discord.deploy}
@@ -30,8 +42,8 @@
               ${pkgs.curl}/bin/curl -F "file=@/tmp/update.log" -F "filename=update.log" -F "content=System finished redeploy." -H "Content-Type: multipart/form-data" ${secrets.webhooks.discord.deploy}
               
               '';
-            Restart = "always";
-            RestartSec = 60;
+            #Restart = "always";
+            #RestartSec = 60;
             User = "root";
         };
     };