@@ -176,6 +176,8 @@ same machine. The client is used to access functionality provided by an
176176exporter. Over the course of this tutorial we will set up a coordinator and
177177exporter, and learn how to access the exporter via the client.
178178
179+ .. _remote-getting-started-coordinator :
180+
179181Coordinator
180182~~~~~~~~~~~
181183
@@ -327,6 +329,75 @@ See :ref:`remote-usage` for some more advanced features.
327329For a complete reference have a look at the :doc: `labgrid-client(1) <man/client >`
328330man page.
329331
332+ Systemd files
333+ ~~~~~~~~~~~~~
334+
335+ Labgrid comes with several systemd files in :file: `contrib/systemd `:
336+
337+ - service files for coordinator and exporter
338+ - tmpfiles.d file to regularly remove files uploaded to the exporter in
339+ :file: `/var/cache/labgrid `
340+ - sysusers.d file to create the ``labgrid `` user and group, enabling members of
341+ the ``labgrid `` group to upload files to the exporter in :file: `/var/cache/labgrid `
342+
343+ Follow these instructions to install the systemd files on your machine(s):
344+
345+ #. Copy the service, tmpfiles.d and sysusers.d files to the respective
346+ installation paths of your distribution.
347+ #. Adapt the ``ExecStart `` paths of the service files to the respective Python
348+ virtual environments of the coordinator and exporter.
349+ #. Create the coordinator configuration file referenced in the ``ExecStart ``
350+ option of the :file: `systemd-coordinator.service ` file by using
351+ :file: `.crossbar/config.yaml ` as a starting point. You most likely want to
352+ make sure that the ``workdir `` option matches the path given via the
353+ ``--cbdir `` option in the service file; see
354+ :ref: `remote-getting-started-coordinator ` for further information.
355+ #. Adjust the ``SupplementaryGroups `` option in the
356+ :file: `labgrid-exporter.service ` file to your distribution so that the
357+ exporter gains read and write access on TTY devices (for ``ser2net ``); most
358+ often, this group is called ``dialout `` or ``tty ``.
359+ #. Set the coordinator URL the exporter should connect to by overriding the
360+ exporter service file; i.e. execute ``systemctl edit
361+ labgrid-exporter.service `` and add the following snippet:
362+
363+ .. code-block ::
364+
365+ [Service]
366+ Environment="LG_CROSSBAR=ws://<your-host>:<your-port>/ws"
367+
368+ #. Create the ``labgrid `` user and group:
369+
370+ .. code-block :: console
371+
372+ # systemd-sysusers
373+
374+ #. Reload the systemd manager configuration:
375+
376+ .. code-block :: console
377+
378+ # systemctl daemon-reload
379+
380+ #. Start the coordinator, if applicable:
381+
382+ .. code-block :: console
383+
384+ # systemctl start labgrid-coordinator
385+
386+ #. After creating the exporter configuration file referenced in the
387+ ``ExecStart `` option of the :file: `systemd-exporter.service ` file, start the
388+ exporter:
389+
390+ .. code-block :: console
391+
392+ # systemctl start labgrid-exporter
393+
394+ #. Optionally, for users being able to upload files to the exporter, add them
395+ to the `labgrid ` group on the exporter machine:
396+
397+ .. code-block :: console
398+
399+ # usermod -a -G labgrid <user>
400+
330401 .. _udev-matching :
331402
332403udev Matching
0 commit comments