Skip to content

Commit

Permalink
fix(packaging): Require online network in systemd unit file for Loki …
Browse files Browse the repository at this point in the history
…and Promtail (#12741)

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 <[email protected]>
  • Loading branch information
chaudum authored May 3, 2024
1 parent 8b34751 commit 57f78b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tools/packaging/loki.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[Unit]
Description=Loki service
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
Expand All @@ -12,4 +13,4 @@ Restart = on-failure
RestartSec = 2

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
5 changes: 3 additions & 2 deletions tools/packaging/promtail.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[Unit]
Description=Promtail service
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
Expand All @@ -12,4 +13,4 @@ Restart = on-failure
RestartSec = 2

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target

0 comments on commit 57f78b5

Please sign in to comment.