From 710c5b5926898b0f82207ea70127cf28fbac4120 Mon Sep 17 00:00:00 2001 From: Christian Haudum Date: Fri, 3 May 2024 08:55:49 +0200 Subject: [PATCH] fix(packaging): Require online network in systemd unit file for Loki and Promtail (#12741) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From https://systemd.io/NETWORK_ONLINE/: **How do I make sure that my service starts after the network is really online?** That depends on your setup and the services you plan to run after it (see above). If you need to delay you service after network connectivity has been established, include ```systemd After=network-online.target Wants=network-online.target ``` in the `.service` file. This will delay boot until the network management software says the network is “up”. For details, see the next question. Signed-off-by: Christian Haudum --- tools/packaging/loki.service | 5 +++-- tools/packaging/promtail.service | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/packaging/loki.service b/tools/packaging/loki.service index b0abbb719103d..2885fac2438ef 100644 --- a/tools/packaging/loki.service +++ b/tools/packaging/loki.service @@ -1,6 +1,7 @@ [Unit] Description=Loki service -After=network.target +After=network-online.target +Wants=network-online.target [Service] Type=simple @@ -12,4 +13,4 @@ Restart = on-failure RestartSec = 2 [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/tools/packaging/promtail.service b/tools/packaging/promtail.service index a21768d1102d7..258e40a24a05d 100644 --- a/tools/packaging/promtail.service +++ b/tools/packaging/promtail.service @@ -1,6 +1,7 @@ [Unit] Description=Promtail service -After=network.target +After=network-online.target +Wants=network-online.target [Service] Type=simple @@ -12,4 +13,4 @@ Restart = on-failure RestartSec = 2 [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target