summaryrefslogtreecommitdiff
path: root/Omni
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-06-13 09:50:36 -0400
committerBen Sima <ben@bsima.me>2025-06-13 11:19:37 -0400
commit21927558d3f9cf573834a2746efa4fd421bee189 (patch)
treebcf1af4edb875099d3d61fee49cbca1e3f3e59dd /Omni
parent36a3a3e267af79da1087cdda7a126c71cf1f473a (diff)
Add systemd service and timer for open-webui updates
Introduce a new systemd service that pulls the latest open-webui Docker image and restarts the associated container. This ensures that the application is always running the most recent version. Additionally, a timer is added to schedule this update process to occur every Sunday at 3 AM, automating the maintenance of the service without manual intervention. This change enhances the reliability and freshness of the application deployment.
Diffstat (limited to 'Omni')
-rw-r--r--Omni/Cloud/OpenWebui.nix31
1 files changed, 30 insertions, 1 deletions
diff --git a/Omni/Cloud/OpenWebui.nix b/Omni/Cloud/OpenWebui.nix
index fe71608..fc662c2 100644
--- a/Omni/Cloud/OpenWebui.nix
+++ b/Omni/Cloud/OpenWebui.nix
@@ -1,4 +1,8 @@
-{config, ...}: let
+{
+ config,
+ pkgs,
+ ...
+}: let
ports = import ./Ports.nix;
in {
config.virtualisation.oci-containers.backend = "docker";
@@ -11,4 +15,29 @@ in {
};
extraOptions = ["--network=host"];
};
+
+ # Add a service that updates and restarts the container
+ config.systemd.services."update-open-webui-aichat" = {
+ description = "pulling new open-webui image and restarting the service";
+ wantedBy = ["multi-user.target"];
+ after = ["network-online.target"];
+ serviceConfig = {
+ Type = "oneshot";
+ ExecStart = [
+ # Pull the latest image
+ "${pkgs.docker}/bin/docker pull ghcr.io/open-webui/open-webui:main"
+ # Restart the container
+ "${pkgs.systemd}/bin/systemctl stop docker-open-webui-aichat"
+ "${pkgs.systemd}/bin/systemctl start docker-open-webui-aichat"
+ ];
+ };
+ };
+
+ # Add a timer that runs every Sunday at 3 AM
+ config.systemd.timers."update-open-webui-aichat" = {
+ wantedBy = ["timers.target"];
+ timerConfig.OnCalendar = "Sun 03:00:00";
+ timerConfig.Persistent = true;
+ unitConfig.Description = "Weekly timer for pulling new open-webui image and restarting service.";
+ };
}