action #66682
closed`apache2.service` and `openqa-webui.service` wrongly started by `openqa-worker.service`
Description
apache2.service
and openqa-webui.service
(and openqa-gru
through deps) are wrongly started by openqa-worker.service
due to:
Wants=apache2.service openqa-webui.service network.target
There is no reason to start apache and openQA webui when we just want to run a worker.
Especially when cache servcie is used, we currently need fetchneedles
script from openQA
package. So, all (remote) workers will start unneeded additional services.
Updated by mkittler over 4 years ago
- Status changed from New to In Progress
- Assignee set to mkittler
- Target version set to Current Sprint
Yes, that dependency seems wrong in general as it only makes sense when the worker is configured to connect to the local web UI. Getting rid of it shouldn't matter because the worker will try to reconnect every 10 seconds anyways.
Updated by okurz over 4 years ago
The dependencies have been added a very long time ago:
commit 55a8d9be1
Author: Michal Hrusecky <Michal@Hrusecky.net>
Date: Tue Apr 8 11:09:17 2014 +0200
Start workers after webui even without apache
diff --git a/systemd/openqa-worker@.service b/systemd/openqa-worker@.service
index a199f58eb..ee065307d 100644
--- a/systemd/openqa-worker@.service
+++ b/systemd/openqa-worker@.service
@@ -4,8 +4,8 @@
# replace '1' with the instance number you want
[Unit]
Description=openQA Worker #%i
-Wants=apache2.service
-After=apache2.service
+Wants=apache2.service openqa-webui.service
+After=apache2.service openqa-webui.service
and
commit 5d8bf4eaa
Author: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Thu Jun 6 16:23:00 2013 +0200
depend on apache
diff --git a/systemd/openqa-worker@.service b/systemd/openqa-worker@.service
index fff1b0019..41be8a1dd 100644
--- a/systemd/openqa-worker@.service
+++ b/systemd/openqa-worker@.service
@@ -4,6 +4,8 @@
# replace '1' with the instance number you want
[Unit]
Description=openQA Worker #%i
+Wants=apache2.service
+After=apache2.service
for me again bad examples of git commit messages. We know what is done already from the code change but we do not know why. I guess the use case is for a single-instance setup to synchronise the services which IMHO makes sense. The automatic reconnect of the worker might obsolete at least the dependency on the webui.
The relation to "fetchneedles" I do not understand. Before changing this we should understand the requirements for both the single-instance as well as distributed setup. The "webui installed but local worker connected elsewhere" use case is a corner case we should try to cover as well but if we can not we would need to rely on the user to tinker with the local service definitions.
Updated by nicksinger over 4 years ago
apache2
is most likely really not relevant here because we don't even provide configs to reverse-proxy a worker through apache. However, starting the openqa-webui
in case it is installed and a worker is started is quite a sane default to me. I can understand that this default might not work for every user but this is part of the reason why distributions switched to systemd. It enables the user to easily customize and adjust services to their needs.
I see it similar to @okurz that only starting the worker is not a default use-case. Therefore, @ggardet_arm I'd currently suggest you to adjust the service files to your needs with an appropriate service override (e.g. use systemctl edit openqa-worker
). However I'm fully open for discussions if we should really keep Wants=apache2
for openqa-worker.service
.
Updated by okurz over 4 years ago
Yes, I think the apache2 requirement is something we do not need anymore at all, proposed to get rid of this with https://github.com/os-autoinst/openQA/pull/3076
Updated by ggardet_arm over 4 years ago
Is there an option to tell: "Start after X, only if X is enabled. Otherwise, ignore." ?
Because ATM, I disable openqa-webui/openqa-gru services, but they start again at each boot due to openqa-worker service which is a bit annoying.
I will have a look at systemctl edit openqa-worker
if there is no better defaults.
Updated by mkittler over 4 years ago
Maybe it works to mask the openqa-webui
service. (Of course that's not a good solution if you want to start the service occasionally manually but just not by default.)
Updated by livdywan over 4 years ago
mkittler wrote:
Maybe it works to mask the
openqa-webui
service. (Of course that's not a good solution if you want to start the service occasionally manually but just not by default.)
Is this the recommended solution then? Or are you still planning on proposing a change to the dependencies?
Updated by okurz over 4 years ago
- Category set to Feature requests
- Status changed from In Progress to Feedback
- Assignee changed from mkittler to okurz
I am now convinced that we should remove both the Wants=openqa-webui.service
and After=openqa-webui.service
. The reason is that the systemd service definition does not know for which openQA webUI instance the worker is configured, if it is remote or local, so pulling in and waiting for the local webUI regardless of the configuration is incorrect. The prerequisite to be able to remove the dependency is that the worker automatically reconnects until it can connect to the configured webui. The argument about "the user can configure systemd anyway" still counts in any case: When we do not specify the dependency one can add it additionally in an override. And actually adding is always easier than overriding in a way that the original ones are not there anymore because then you need to replicate the parts you still want in :)
Updated by okurz over 4 years ago
- Status changed from Feedback to Resolved
- Target version changed from Current Sprint to Ready
PR merged and deployed to o3 and osd without problems.