From 4269a0b5d0091abb8f2b85bfcbea256170f535c1 Mon Sep 17 00:00:00 2001 From: Ryan O'Hara Date: Mon, 15 Jun 2020 11:34:54 -0500 Subject: [PATCH] BUG/MINOR: systemd: Wait for network to be online Change systemd service file to wait for network to be completely online. This solves two problems: If haproxy is configured to bind to IP address(es) that are not yet assigned, haproxy would previously fail. The workaround is to use "option transparent". If haproxy us configured to use a resolver to resolve servers via DNS, haproxy would previously fail due to the fact that the network is not fully online yet. This is the most compelling reason for this patch. Signed-off-by: Ryan O'Hara Acked-by: Lukas Tribus (cherry picked from commit f49a6049b88b7a9f0f0a18b076f34ab83820445a) Signed-off-by: Christopher Faulet --- contrib/systemd/haproxy.service.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/systemd/haproxy.service.in b/contrib/systemd/haproxy.service.in index 9b7c3d1..05fc595 100644 --- a/contrib/systemd/haproxy.service.in +++ b/contrib/systemd/haproxy.service.in @@ -1,6 +1,7 @@ [Unit] Description=HAProxy Load Balancer -After=network.target +After=network-online.target +Wants=network-online.target [Service] EnvironmentFile=-/etc/default/haproxy -- 1.7.10.4