Skip to content

Commit c246fab

Browse files
authored
Merge pull request #1840 from nick-potenski/add-statsd-docker-image
dockerfiles: Add statsd docker image
2 parents 3912486 + 122f3db commit c246fab

4 files changed

Lines changed: 35 additions & 5 deletions

File tree

dockerfiles/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,13 @@ RUN apt update -q=2 && \
5757
VOLUME /opt/conf
5858

5959
CMD ["/entrypoint.sh"]
60+
61+
#
62+
# Coordinator statsd
63+
#
64+
FROM labgrid-base AS labgrid-coordinator-statsd
65+
ARG VERSION
66+
67+
RUN pip3 install "statsd>=4.0.1"
68+
69+
ENTRYPOINT ["/opt/labgrid/contrib/coordinator-statsd.py"]

dockerfiles/README.rst

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ for the 3 different components of a Labgrid distributed infrastructure.
77
- **labgrid-coordinator**
88
An image with the Labgrid coordinator.
99
a Labgrid coordinator instance.
10+
- **labgrid-coordinator-statsd**
11+
An image with a statsd reporter for the Labgrid coordinator.
1012
- **labgrid-client**
1113
An image with the Labgrid client tools and pytest integration.
1214
- **labgrid-exporter**
@@ -27,7 +29,7 @@ Example showing how to build labgrid-client image:
2729
Using `BuildKit <https://docs.docker.com/develop/develop-images/build_enhancements/>`_
2830
is recommended to reduce build times.
2931

30-
You can also choose to build all 3 images with the included script. The script
32+
You can also choose to build all images with the included script. The script
3133
will automatically use `docker buildx
3234
<https://docs.docker.com/engine/reference/commandline/buildx/>`` if available.
3335

@@ -39,7 +41,6 @@ will automatically use `docker buildx
3941
The script supports ``podman`` as well.
4042

4143
.. code-block:: bash
42-
4344
$ export DOCKER=podman
4445
$ ./dockerfiles/build.sh
4546
@@ -79,6 +80,20 @@ so you can restart the service without losing state.
7980
docker.io/labgrid/coordinator
8081
8182
83+
labgrid-coordinator-statsd usage
84+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85+
86+
The labgrid-coordinator-statsd image can be used to run a statsd reporter for the coordinator.
87+
88+
The address of the statsd server and other options can be configured using parameters as passed to the ``contrib/coordinator-statsd.py`` script.
89+
For example, to run the statsd reporter with a coordinator at 192.168.1.42:20408:
90+
91+
.. code-block:: bash
92+
93+
$ docker run -e LG_COORDINATOR=192.168.1.42:20408 docker.io/labgrid/coordinator-statsd \
94+
--statsd-server=192.168.1.50
95+
96+
8297
labgrid-client usage
8398
~~~~~~~~~~~~~~~~~~~~
8499

@@ -141,7 +156,7 @@ client:
141156
.. code-block:: bash
142157
143158
$ cd dockerfiles/staging
144-
$ CURRENT_UID=$(id -u):$(id -g) docker compose up -d coordinator exporter dut
159+
$ CURRENT_UID=$(id -u):$(id -g) docker compose up -d coordinator coordinator-statsd exporter dut
145160
146161
To run the smoke test just run the client:
147162

dockerfiles/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ perform_regular_build() {
5959

6060
log_info "building for native platform only."
6161

62-
for t in client exporter coordinator; do
62+
for t in client exporter coordinator coordinator-statsd; do
6363
"${docker_cmd}" build --build-arg VERSION="${version}" \
6464
--target labgrid-${t} -t "${IMAGE_PREFIX}${t}:${IMAGE_TAG}" -f "${script_dir}/Dockerfile" \
6565
"${extra_args[@]}" .
@@ -73,7 +73,7 @@ perform_docker_buildx_build() {
7373
version="${3}"
7474
extra_args=("${@:4}")
7575

76-
for t in client exporter coordinator; do
76+
for t in client exporter coordinator coordinator-statsd; do
7777
"${docker_cmd}" buildx build --build-arg VERSION="${version}" \
7878
--target labgrid-${t} -t "${IMAGE_PREFIX}${t}:${IMAGE_TAG}" -f "${script_dir}/Dockerfile" \
7979
"${extra_args[@]}" .

dockerfiles/staging/docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ services:
77
network_mode: "host"
88
command: bash -c "cp /home/root/coordinator/places_example.yaml /opt/coordinator/places.yaml &&
99
/usr/local/bin/labgrid-coordinator"
10+
coordinator-statsd:
11+
image: "${IMAGE_PREFIX:-docker.io/labgrid/}coordinator-statsd"
12+
network_mode: "host"
13+
depends_on:
14+
- coordinator
1015
client:
1116
image: "${IMAGE_PREFIX:-docker.io/labgrid/}client"
1217
volumes:

0 commit comments

Comments
 (0)