Permalink
Browse files

Add files to build Docker images

This includes Dockerfile for building the 3 basic Docker images needed run a
labgrid distributed infrastructure: labgrid-client, labgrid-exporter and
labgrid-coordinator.

They do not come with configuration, so at least labgrid-exporter needs to be
configured in order to be usable.

They all 3 strives to follow the current installation instructions.

Signed-off-by: Esben Haabendal <esben@haabendal.dk>
  • Loading branch information...
esben committed Sep 26, 2018
1 parent 8222fa9 commit 66395cb48fcbc88c41299f8ef2f8fe078f156638
Showing with 159 additions and 0 deletions.
  1. +103 −0 docker/README.rst
  2. +4 −0 docker/build.sh
  3. +15 −0 docker/client/Dockerfile
  4. +14 −0 docker/coordinator/Dockerfile
  5. +18 −0 docker/exporter/Dockerfile
  6. +5 −0 docker/exporter/entrypoint.sh
View
@@ -0,0 +1,103 @@
Labgrid Docker images
=====================
This folder contains Dockerfile's for building Docker images
for the 3 different components of a Labgrid distributed infrastructure.
- **labgrid-coordinator**
An image for with crossbar which can be used to run
a Labgrid coordinator instance.
- **labgrid-client**
An image with the Labgrid client tools and pytest integration.
- **labgrid-exporter**
An image with the Labgrid exporter tools.
Build
-----
To build one of the above images,
you need to run the `docker build` command in the root of this repository.
Example showing how to build labgrid-client image:
.. code-block:: bash
$ docker build -t labgrid-client -f docker/client/Dockerfile .
You can also choose to build all 3 images,
with the included script
(which also must be run from the root of this repository):
.. code-block:: bash
$ ./docker/build.sh
Usage
-----
All 3 images are to be considered base images
with the required software installed.
No policy or configuration is done.
labgrid-coordinator usage
~~~~~~~~~~~~~~~~~~~~~~~~~
The labgrid-coordinator comes with a preconfigured Crossbar.io server.
It listens to port 20408,
so you probably want to publish that so you can talk to the coordinator.
State is written to `/opt/crossbar`.
You might want to bind a volume to that
so you can restart the service without loosing state.
.. code-block:: bash
$ docker run -t -p 20408:20408 -v $HOME/crossbar:/opt/crossbar
labgrid-coordinator
labgrid-client usage
~~~~~~~~~~~~~~~~~~~~
The labgrid-client image can be used to
run `labgrid-client` and `pytest` commands.
For example listing available places registered at coordinator at
ws://192.168.1.42:20408/ws
.. code-block:: bash
$ docker run -e LG_CROSSBAR=ws://192.168.1.42:20408/ws labgrid-client \
labgrid-client places
Or running all pytest/labgrid tests at current directory:
.. code-block:: bash
$ docker run -e LG_CROSSBAR=ws://192.168.1.42:20408/ws labgrid-client \
pytest
labgrid-exporter usage
~~~~~~~~~~~~~~~~~~~~~~
The labgrid-exporter image runs a labgrid-exporter
and optionally an ser2net service.
Configuration is not included,
but needs to be bind mounted to
/opt/conf/exporter.yaml and /opt/conf/ser2net.conf (optional).
Start it with something like:
.. code-block:: bash
$ docker run -e LG_CROSSBAR=ws://192.168.1.42:20408/ws \
-v $HOME/exporter-conf:/opt/conf \
labgrid-coordinator
If using ser2net,
the devices needed must be added to Docker container
(`docker run --device` option).
View
@@ -0,0 +1,4 @@
#!/bin/sh -ex
docker build -t labgrid-client -f docker/client/Dockerfile .
docker build -t labgrid-exporter -f docker/exporter/Dockerfile .
docker build -t labgrid-coordinator -f docker/coordinator/Dockerfile .
View
@@ -0,0 +1,15 @@
FROM python:3.6
MAINTAINER eha@deif.com
RUN mkdir -p /opt/labgrid
COPY ./ /opt/labgrid/
RUN cd /opt/labgrid \
&& pip install -r requirements.txt \
&& python setup.py install
RUN apt-get update -q \
&& apt-get install -q -y microcom \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
CMD ["/bin/bash"]
@@ -0,0 +1,14 @@
FROM python:3.6
MAINTAINER eha@deif.com
RUN mkdir -p /opt/labgrid
COPY ./ /opt/labgrid/
RUN cd /opt/labgrid \
&& pip install -r crossbar-requirements.txt \
&& python setup.py install
VOLUME /opt/crossbar
EXPOSE 40208
ENV CROSSBAR_DIR=/opt/crossbar
CMD ["crossbar", "start", "--config", "/opt/labgrid/.crossbar/config.yaml"]
View
@@ -0,0 +1,18 @@
FROM python:3.6
MAINTAINER eha@deif.com
RUN mkdir -p /opt/labgrid
COPY ./ /opt/labgrid/
RUN cd /opt/labgrid \
&& pip install -r requirements.txt \
&& python setup.py install
RUN apt-get update -q \
&& apt-get install -q -y ser2net \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
VOLUME /opt/conf
COPY docker/exporter/entrypoint.sh /entrypoint.sh
CMD ["/entrypoint.sh"]
@@ -0,0 +1,5 @@
#!/bin/sh
if [ -f /opt/conf/ser2net.conf ] ; then
ser2net -c /opt/conf/ser2net.conf
fi
labgrid-exporter "$@" /opt/conf/exporter.yaml

0 comments on commit 66395cb

Please sign in to comment.