-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#49457] server: Add server-device integration demo using RDFM client…
… in Docker
- Loading branch information
1 parent
c2d5e22
commit 0e0ecf5
Showing
5 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM antmicro/rdfm-client-builder:latest | ||
|
||
# Copy all sources | ||
COPY . /rdfm-client/ | ||
WORKDIR /rdfm-client/ | ||
# Install the RDFM client | ||
RUN make install | ||
|
||
CMD [ "/rdfm-client/scripts/test-docker/docker-entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: '3' | ||
|
||
services: | ||
demo-client: | ||
image: antmicro/rdfm-linux-demo-client:latest | ||
network_mode: host | ||
restart: unless-stopped | ||
environment: | ||
# Device type reported to the server | ||
RDFM_CLIENT_DEVTYPE: x86_64 | ||
# Example: plain HTTP server connection | ||
RDFM_CLIENT_SERVER_URL: http://127.0.0.1:5000/ | ||
# Example: HTTPS server connection | ||
# Remember to update the URL to use HTTPS! | ||
# RDFM_CLIENT_SERVER_URL: https://127.0.0.1:5000/ | ||
# RDFM_CLIENT_SERVER_CERT: /var/lib/rdfm/CA.crt | ||
volumes: | ||
# Simulate a persistent "partition" for the configuration | ||
- data:/var/lib/rdfm/ | ||
|
||
volumes: | ||
data: |
42 changes: 42 additions & 0 deletions
42
devices/linux-client/scripts/test-docker/docker-entrypoint.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# This is the entrypoint for the Dockerized demo client | ||
# This can be used to test basic integration with the RDFM server | ||
|
||
# Environment variable overrides | ||
SERVER_URL="${RDFM_CLIENT_SERVER_URL:-http://127.0.0.1:5000/}" | ||
SERVER_CERT="${RDFM_CLIENT_SERVER_CERT:-/dev/zero}" | ||
PART_A="${RDFM_CLIENT_PART_A:-/dev/zero}" | ||
PART_B="${RDFM_CLIENT_PART_B:-/dev/zero}" | ||
DEVICE_TYPE="${RDFM_CLIENT_DEVTYPE:-x86_64}" | ||
|
||
# Generate a valid configuration | ||
cat >/etc/rdfm/artifact_info << EOF | ||
artifact_name=unknown | ||
EOF | ||
|
||
cat >/var/lib/rdfm/device_type << EOF | ||
device_type=${DEVICE_TYPE} | ||
EOF | ||
|
||
cat >/etc/rdfm/rdfm.conf << EOF | ||
{ | ||
"RootfsPartA": "${PART_A}", | ||
"RootfsPartB": "${PART_B}" | ||
} | ||
EOF | ||
|
||
cat >/var/lib/rdfm/rdfm.conf <<EOF | ||
{ | ||
"ServerURL": "${SERVER_URL}", | ||
"ServerCertificate": "${SERVER_CERT}" | ||
} | ||
EOF | ||
|
||
# Creating an entry in /etc/hosts for the server | ||
IP=$(echo $SERVER_URL | awk -F"://|:" '{print $2}') | ||
echo "$IP rdfm-server" >> /etc/hosts | ||
|
||
# Start daemonized RDFM device client | ||
exec rdfm daemonize ${CLIENT_ARGS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters