From f1c1ea99052a3ac752ed32ccad6b2ebc26539543 Mon Sep 17 00:00:00 2001 From: W-Mark Kubacki Date: Fri, 18 Mar 2016 12:36:54 +0100 Subject: [PATCH] Service file for systemd starts after all networks have gotten IP addresses Unlike network.target the network-online.target guarantees that the network devices are online. If you bind to 0.0.0.0, [::], [::1], and/or 127.0.0.1 only that is enough to proceed. But in case a particular IP is needed, like ${COREOS_PUBLIC_IPV4}, we require any IP assignments to have completed before Caddy's start. That is achieved by depending on systemd-networkd-wait-online.service (which is scheduled before network-online.target, then, automatically). --- .gitattributes | 4 ++++ dist/init/linux-systemd/caddy@.service | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..b3384bdc --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# files for systemd +*.path text eol=lf whitespace=blank-at-eol,space-before-tab,tab-in-indent,trailing-space,tabwidth=2 +*.service text eol=lf whitespace=blank-at-eol,space-before-tab,tab-in-indent,trailing-space,tabwidth=2 +*.timer text eol=lf whitespace=blank-at-eol,space-before-tab,tab-in-indent,trailing-space,tabwidth=2 diff --git a/dist/init/linux-systemd/caddy@.service b/dist/init/linux-systemd/caddy@.service index 7bb4f552..0baaac10 100644 --- a/dist/init/linux-systemd/caddy@.service +++ b/dist/init/linux-systemd/caddy@.service @@ -4,7 +4,9 @@ [Unit] Description=Caddy HTTP/2 web server %I Documentation=https://caddyserver.com/docs -After=network.target +After=network-online.target +Wants=network-online.target +Wants=systemd-networkd-wait-online.service [Service] ; run user and group for caddy