From d9fbad6a6bbba292f31fe50e57af893062c7a584 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sat, 23 May 2020 07:33:47 +0100 Subject: systemd: T2494: use Type=notify with daemon Notify systemd via the notify API when the python daemon are ready to take connection https://github.com/torfsen/python-systemd-tutorial --- src/systemd/vyos-hostsd.service | 2 +- src/systemd/vyos-http-api.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/systemd') diff --git a/src/systemd/vyos-hostsd.service b/src/systemd/vyos-hostsd.service index b77335778..418601d1a 100644 --- a/src/systemd/vyos-hostsd.service +++ b/src/systemd/vyos-hostsd.service @@ -14,7 +14,7 @@ WorkingDirectory=/run/vyos-hostsd RuntimeDirectory=vyos-hostsd RuntimeDirectoryPreserve=yes ExecStart=/usr/bin/python3 -u /usr/libexec/vyos/services/vyos-hostsd -Type=idle +Type=notify KillMode=process SyslogIdentifier=vyos-hostsd diff --git a/src/systemd/vyos-http-api.service b/src/systemd/vyos-http-api.service index 4fa68b4ff..636973be7 100644 --- a/src/systemd/vyos-http-api.service +++ b/src/systemd/vyos-http-api.service @@ -6,7 +6,7 @@ Requires=vyos-router.service [Service] ExecStartPre=/usr/libexec/vyos/init/vyos-config ExecStart=/usr/bin/python3 -u /usr/libexec/vyos/services/vyos-http-api-server -Type=idle +Type=notify KillMode=process SyslogIdentifier=vyos-http-api -- cgit v1.2.3 From 8d50cb7a4044049b8287ce9b076fbc6b7bb1cfef Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sat, 23 May 2020 07:52:31 +0100 Subject: http-api: T2494: remove inaccurate systemd comment --- src/systemd/vyos-http-api.service | 1 - 1 file changed, 1 deletion(-) (limited to 'src/systemd') diff --git a/src/systemd/vyos-http-api.service b/src/systemd/vyos-http-api.service index 636973be7..e336ed18b 100644 --- a/src/systemd/vyos-http-api.service +++ b/src/systemd/vyos-http-api.service @@ -14,7 +14,6 @@ SyslogFacility=daemon Restart=on-failure -# Does't work but leave it here User=root Group=vyattacfg -- cgit v1.2.3 From 4d6f9a3f803d1f4a5735867ae3ea124deedbdae1 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sat, 23 May 2020 08:29:16 +0100 Subject: hostsd: T2494: systemd remove inaccurate systemd comment --- src/systemd/vyos-hostsd.service | 1 - 1 file changed, 1 deletion(-) (limited to 'src/systemd') diff --git a/src/systemd/vyos-hostsd.service b/src/systemd/vyos-hostsd.service index 418601d1a..560e04052 100644 --- a/src/systemd/vyos-hostsd.service +++ b/src/systemd/vyos-hostsd.service @@ -22,7 +22,6 @@ SyslogFacility=daemon Restart=on-failure -# Does't work in Jessie but leave it here User=root Group=hostsd -- cgit v1.2.3 From 54b92aea418ddca07b9f699466411e58ddfc52c3 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sat, 23 May 2020 09:03:10 +0100 Subject: hostsd: T2494: vyos-hostsd is part of systemd vyos.target The install section determine if the package should be enabled. vyos-hostd should be install if vyos.target is enabled. --- src/systemd/vyos-hostsd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/systemd') diff --git a/src/systemd/vyos-hostsd.service b/src/systemd/vyos-hostsd.service index 560e04052..d10a0a939 100644 --- a/src/systemd/vyos-hostsd.service +++ b/src/systemd/vyos-hostsd.service @@ -30,4 +30,4 @@ Group=hostsd # Note: After= doesn't actually create a dependency, # it just sets order for the case when both services are to start, # and without RequiredBy it *does not* set vyos-hostsd to start. -RequiredBy=cloud-init-local.service vyos-router.service +WantedBy=vyos.target -- cgit v1.2.3 From 1ecb1d76cd0b149d6381a143adc9907adee47607 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sat, 23 May 2020 09:05:43 +0100 Subject: http-api: T2494: remove "barrier" PreExec The PreExec is making sure that the vyos-config-status file exists and blocks until it does. This file is created on boot completion and I can see no reason why the http service has to wait for the end of boot to start. Any barrier to start should be done with systemd itself. --- src/systemd/vyos-http-api.service | 1 - 1 file changed, 1 deletion(-) (limited to 'src/systemd') diff --git a/src/systemd/vyos-http-api.service b/src/systemd/vyos-http-api.service index e336ed18b..a2920376e 100644 --- a/src/systemd/vyos-http-api.service +++ b/src/systemd/vyos-http-api.service @@ -4,7 +4,6 @@ After=auditd.service systemd-user-sessions.service time-sync.target vyos-router. Requires=vyos-router.service [Service] -ExecStartPre=/usr/libexec/vyos/init/vyos-config ExecStart=/usr/bin/python3 -u /usr/libexec/vyos/services/vyos-http-api-server Type=notify KillMode=process -- cgit v1.2.3 From 8cd23ec0449b3755240b9aebe236fdb66937d7d6 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Sat, 23 May 2020 15:02:47 +0100 Subject: http-api: T2494: systemd http-api has no link getty.target WantedBy is about the service installation and is not related to the boot order, linking to vyos.target instead --- src/systemd/vyos-http-api.service | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/systemd') diff --git a/src/systemd/vyos-http-api.service b/src/systemd/vyos-http-api.service index a2920376e..74a97d193 100644 --- a/src/systemd/vyos-http-api.service +++ b/src/systemd/vyos-http-api.service @@ -17,6 +17,4 @@ User=root Group=vyattacfg [Install] -# Installing in a earlier target leaves ExecStartPre waiting -WantedBy=getty.target - +WantedBy=vyos.target -- cgit v1.2.3 From be8cda7f711a7a26c85b51976c299a6837750a63 Mon Sep 17 00:00:00 2001 From: Thomas Mangin Date: Mon, 25 May 2020 17:33:07 +0100 Subject: http-api: T2494: start before vyos-router vyos-router may/is requiring access to the service, make sure it starts before, if not is has no consequence to do so anyway. --- src/systemd/vyos-hostsd.service | 1 + 1 file changed, 1 insertion(+) (limited to 'src/systemd') diff --git a/src/systemd/vyos-hostsd.service b/src/systemd/vyos-hostsd.service index d10a0a939..26e9c745e 100644 --- a/src/systemd/vyos-hostsd.service +++ b/src/systemd/vyos-hostsd.service @@ -1,5 +1,6 @@ [Unit] Description=VyOS DNS configuration keeper +Before=vyos-router.service # Without this option, lots of default dependencies are added, # among them network.target, which creates a dependency cycle -- cgit v1.2.3