-
Notifications
You must be signed in to change notification settings - Fork 17
python3-labgrid: Add new package for coordinator #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Some devices might also want to start the labgrid-coordinator as a systemd service. but this should not be the default. Move the labgrid-coordinator to a new package, that depends on labgrid. Signed-off-by: Fabian Pflug <[email protected]>
Environment="LABGRID_COORDINATOR_LISTEN_IP=0.0.0.0" | ||
Environment="LABGRID_COORDINATOR_PORT=20408" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be redundant to the contents of the EnvironmentFile
. Why do we need to set them here again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the defaults, that can be overwritten with the environment file. If there are no entries in environment, there are used. Otherwise they have to be specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If everything is configured correctly in the environment, then yes. But i always like to have sane defaults in case something is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't follow. /etc/labgrid/environment
is the central configuration place. Having more configuration scattered in other places is surprising. Let's not do this.
PACKAGE_BEFORE_PN += "${PN}-coordinator" | ||
RDEPENDS:${PN}-coordinator = "${PN}" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be a separate package? Simply installing the systemd service and the labgrid-coordinator entry point (as done before) should not hurt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to reduce the amount of systemd-services, that get started by default and not have it in there, but be a deliberate decision to activate the coordinator on a device.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labgrid-coordinator.service
is not started by default, hence installing the coordinator entry point and the systemd service does not change anything. A systemctl enable labgrid-coordinator.service
is still needed.
@@ -40,13 +44,16 @@ DEPENDS += "python3-pytest-runner-native" | |||
inherit python_setuptools_build_meta systemd | |||
|
|||
SYSTEMD_SERVICE:${PN} = "labgrid-exporter.service" | |||
SYSTEMD_SERVICE:${PN}-coordinator = "labgrid-coordinator.service" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just be added to SYSTEMD_SERVICE:${PN}
above.
} | ||
|
||
FILES:${PN}-coordinator += "${systemd_system_unitdir}/labgrid-coordinator.service /usr/bin/labgrid-coordinator" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the need for this.
|
||
### The coordinator service will listen to the following ip, if the service is also | ||
### enabled. | ||
|
||
LABGRID_COORDINATOR_LISTEN_IP=0.0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we simply use ${LABGRID_COORDINATOR_IP}:${LABGRID_COORDINATOR_PORT}
from /etc/labgrid/environment
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because you might want to listen to 0.0.0.0 and connect to 127.0.0.1 and allow others to connect to your coordinator, even if you don't know its public IP address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's take a step back here: Having the coordinator as part of a device that will usually be the exporter (that's at least what meta-labgrid
aims for currently) is a rather special case for situations where no (or little) other labgrid infrastructure exists. That's why I think a simple approach where you would configure the /etc/labgrid/environment
like this fits:
LABGRID_COORDINATOR_IP=lxatac-00001
LABGRID_COORDINATOR_PORT=20408
That configuration works for my LXA TAC home setup with..
EnvironmentFile=/etc/labgrid/environment
ExecStart=/usr/bin/labgrid-coordinator --listen ${LABGRID_COORDINATOR_IP}:${LABGRID_COORDINATOR_PORT}
..in my labgrid-coordinator.service
for over a year. I don't think we need to cover more elaborate use cases.
Environment="LABGRID_COORDINATOR_LISTEN_IP=0.0.0.0" | ||
Environment="LABGRID_COORDINATOR_PORT=20408" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be needed.
EnvironmentFile=/etc/labgrid/environment | ||
ExecStart=/usr/bin/labgrid-coordinator -l ${LABGRID_COORDINATOR_LISTEN_IP}:${LABGRID_COORDINATOR_PORT} | ||
Restart=on-failure | ||
DynamicUser=yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that's a good idea. The state directory permissions will probably cause issues after an update.
ExecStart=/usr/bin/labgrid-coordinator -l ${LABGRID_COORDINATOR_LISTEN_IP}:${LABGRID_COORDINATOR_PORT} | ||
Restart=on-failure | ||
DynamicUser=yes | ||
StateDirectory=labgrid-coordinator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default for this is /var/lib/
. This looks wrong. Isn't that simply something a BSP using meta-labgrid will set to an absolute path, e.g. on its central data partition?
Restart=on-failure | ||
DynamicUser=yes | ||
StateDirectory=labgrid-coordinator | ||
# Set WorkingDirectory to StateDirectory, this works in DynamicUser mode since symlinks are created |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we drop DynamicUser=yes
, the comment won't apply anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from https://github.com/labgrid-project/labgrid/blob/master/contrib/systemd/labgrid-coordinator.service
Happy to change to a better suited version for yocto. But we should first clarify if we want a separate package or not.
Some devices might also want to start the labgrid-coordinator as a systemd service. but this should not be the default. Move the labgrid-coordinator to a new package, that depends on labgrid.