Skip to content

Commit

Permalink
doc: update for gRPC
Browse files Browse the repository at this point in the history
Signed-off-by: Bastian Krause <[email protected]>
Signed-off-by: Rouven Czerwinski <[email protected]>
  • Loading branch information
Bastian-Krause committed Aug 13, 2024
1 parent 81f5801 commit e0167ae
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 75 deletions.
6 changes: 1 addition & 5 deletions doc/RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ Test the upload by using pypi dev as a download source

::

virtualenv -p python3 labgrid-crossbar-release-<your-version-number>
labgrid-crossbar-release-<your-version-number>/bin/pip install --upgrade pip
labgrid-crossbar-release-<your-version-number>/bin/pip install -r crossbar-requirements.txt

virtualenv -p python3 labgrid-release-<your-version-number>
source labgrid-release-<your-version-number>/bin/activate
pip install --upgrade pip setuptools wheel
Expand All @@ -80,7 +76,7 @@ And optionally run the tests:
::

pip install ".[dev]"
pytest tests --crossbar-venv labgrid-crossbar-release-<your-version-number>
pytest tests

7. Upload to pypi
=================
Expand Down
2 changes: 1 addition & 1 deletion doc/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Install required dependencies:

.. code-block:: bash
sudo apt install python3-dev libow-dev libsnappy-dev
sudo apt install python3-dev libow-dev
Install labgrid with development dependencies into the virtualenv in editable
mode:
Expand Down
63 changes: 5 additions & 58 deletions doc/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Test your installation by running:
.. code-block:: bash
labgrid-venv $ labgrid-client --help
usage: labgrid-client [-h] [-x URL] [-c CONFIG] [-p PLACE] [-d] COMMAND ...
usage: labgrid-client [-h] [-x ADDRESS] [-c CONFIG] [-p PLACE] [-d] COMMAND ...
...
If the help for labgrid-client does not show up, open an `Issue
Expand Down Expand Up @@ -170,58 +170,11 @@ exporter, and learn how to access the exporter via the client.
Coordinator
~~~~~~~~~~~

To start the coordinator, we will download the labgrid repository, create an
extra virtualenv and install the dependencies:
We can simply start the coordinator:

.. code-block:: bash
$ sudo apt install libsnappy-dev
$ git clone https://github.com/labgrid-project/labgrid
$ cd labgrid
$ virtualenv -p python3 crossbar-venv
$ crossbar-venv/bin/pip install --upgrade pip
$ crossbar-venv/bin/pip install -r crossbar-requirements.txt
$ virtualenv -p python3 labgrid-venv
$ source labgrid-venv/bin/activate
labgrid-venv $ pip install --upgrade pip
labgrid-venv $ pip install .
All necessary dependencies should be installed now.

Copy and customize the crossbar config file ``.crossbar/config-anonymous.yaml``
for your use case:

.. code-block:: bash
labgrid-venv $ cp .crossbar/config-anonymous.yaml .crossbar/my-config.yaml
.. note:: crossbar is a network messaging framework for building distributed
applications, which labgrid plugs into.

The path to the Python interpreter in the labgrid-venv needs to be configured
in crossbar's config, either manually or with the labgrid-venv being active
via:

.. code-block:: bash
labgrid-venv $ sed -i "s#^ executable: .*\$# executable: ${VIRTUAL_ENV}/bin/python3#" .crossbar/my-config.yaml
.. note:: For long running deployments a different ``workdir`` and port may be
used.
The crossbar config should reside in a ``.crossbar`` directory in the
``workdir`` in this case.
For an example systemd service file, see
:ref:`remote-getting-started-systemd-files`.

Now we can finally start the coordinator inside the repository:

.. code-block:: bash
$ crossbar-venv/bin/crossbar start --config my-config.yaml
.. note:: If --config is specified as a relative path, the config is expected
in a .crossbar subdirectory (as is the case in the labgrid
repository).
labgrid-venv $ labgrid-coordinator
Exporter
~~~~~~~~
Expand Down Expand Up @@ -375,25 +328,19 @@ Follow these instructions to install the systemd files on your machine(s):
installation paths of your distribution.
#. Adapt the ``ExecStart`` paths of the service files to the respective Python
virtual environments of the coordinator and exporter.
#. Create the coordinator configuration file referenced in the ``ExecStart``
option of the :file:`labgrid-coordinator.service` file by using
:file:`.crossbar/config-anonymous.yaml` as a starting point. You most likely
want to make sure that the ``workdir`` option matches the path given via the
``--cbdir`` option in the service file; see
:ref:`remote-getting-started-coordinator` for further information.
#. Adjust the ``SupplementaryGroups`` option in the
:file:`labgrid-exporter.service` file to your distribution so that the
exporter gains read and write access on TTY devices (for ``ser2net``); most
often, these groups are called ``dialout``, ``plugdev`` or ``tty``.
Depending on your udev configuration, you may need multiple groups.
#. Set the coordinator URL the exporter should connect to by overriding the
#. Set the coordinator address the exporter should connect to by overriding the
exporter service file; i.e. execute ``systemctl edit
labgrid-exporter.service`` and add the following snippet:

.. code-block::
[Service]
Environment="LG_CROSSBAR=ws://<your-host>:<your-port>/ws"
Environment="LG_COORDINATOR=<your-host>[:<your-port>]"
#. Create the ``labgrid`` user and group:

Expand Down
1 change: 1 addition & 0 deletions doc/man.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Manual Pages
man/client
man/device-config
man/exporter
man/coordinator
2 changes: 2 additions & 0 deletions doc/man/coordinator.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.. _labgrid-coordinator:
.. include:: ../../man/labgrid-coordinator.rst
13 changes: 6 additions & 7 deletions doc/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ labgrid contains components for accessing resources which are not directly
accessible on the local machine.
The main parts of this are:

labgrid-coordinator (crossbar component)
labgrid-coordinator
Clients and exporters connect to the coordinator to publish resources, manage
place configuration and handle mutual exclusion.

Expand All @@ -227,9 +227,8 @@ RemotePlace (managed resource)
When used in a `Target`, the RemotePlace expands to the resources configured
for the named places.

These components communicate over the `WAMP <http://wamp-proto.org/>`_
implementation `Autobahn <http://autobahn.ws/>`_ and the `Crossbar
<http://crossbar.io/>`_ WAMP router.
These components communicate over `gRPC <https://grpc.io/>`_. The coordinator
acts as a gRPC server to which client and exporter connect.

The following sections describe the responsibilities of each component. See
:ref:`remote-usage` for usage information.
Expand All @@ -239,8 +238,8 @@ The following sections describe the responsibilities of each component. See
Coordinator
~~~~~~~~~~~

The `Coordinator` is implemented as a Crossbar component and is started by the
router.
The `Coordinator` is implemented as a gRPC server and is started as a separate
process.
It provides separate RPC methods for the exporters and clients.

The coordinator keeps a list of all resources for clients and
Expand Down Expand Up @@ -387,7 +386,7 @@ variable needs to be set to the remote host which should tunnel the connection
to the coordinator. The client then forwards all network traffic -
client-to-coordinator and client-to-exporter - through SSH, via their
respective proxies. This means that with :code:`LG_PROXY` and
:code:`LG_CROSSBAR` labgrid can be used fully remotely with only a SSH
:code:`LG_COORDINATOR` labgrid can be used fully remotely with only a SSH
connection as a requirement.

.. note::
Expand Down
8 changes: 4 additions & 4 deletions doc/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,10 @@ Other labgrid-related pytest plugin options are:
Specify a labgrid environment config file.
This is equivalent to labgrid-client's ``-c``/``--config``.

``--lg-coordinator=CROSSBAR_URL``
Specify labgrid coordinator websocket URL.
Defaults to ``ws://127.0.0.1:20408/ws``.
This is equivalent to labgrid-client's ``-x``/``--crossbar``.
``--lg-coordinator=COORDINATOR_ADDRESS``
Specify labgrid coordinator gRPC address as ``HOST[:PORT]``.
Defaults to ``127.0.0.1:20408``.
This is equivalent to labgrid-client's ``-x``/``--coordinator``.

``--lg-log=[path to logfiles]``
Path to store console log file.
Expand Down

0 comments on commit e0167ae

Please sign in to comment.