From 410cd00ce9728689d34ff78d94289630ce54b4a4 Mon Sep 17 00:00:00 2001 From: Amitai Burstein Date: Fri, 24 Jan 2025 10:51:44 +0200 Subject: [PATCH] Docs on `systemd` integration Follow up to https://github.com/digitallyinduced/ihp/pull/2027 --- Guide/deployment.markdown | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Guide/deployment.markdown b/Guide/deployment.markdown index ba10732c2..02b790374 100644 --- a/Guide/deployment.markdown +++ b/Guide/deployment.markdown @@ -878,3 +878,25 @@ The maximum number of subscriptions per websocket connection in IHP DataSync. De #### `IHP_DATASYNC_MAX_TRANSACTIONS_PER_CONNECTION` The maximum number of database transactions per websocket connection in IHP DataSync. Defaults to `10`. + +## `systemd` Integration + +The `deploy-to-nixos` tool now includes systemd integration to improve reliability and reduce downtime for IHP applications. These features are enabled by default when using `ihp.nixosModules.app`. + +Key Features: + +1. **Systemd Watchdog**: + + - The app sends a heartbeat to systemd every 30 seconds via localhost. + - If the app becomes unresponsive, systemd restarts it after 60 seconds. + +2. **Socket Activation**: + + - Systemd queues incoming HTTP requests during app startup or restarts. + - This eliminates downtime and ensures uninterrupted service. + +3. **Automatic Configuration**: + + - The `IHP_SYSTEMD` environment variable is set to `"1"` automatically when deploying with `deploy-to-nixos`. If you are deploying differently, you are responsible for setting the variable yourself. + +