Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manager: add Dockerfile and run guide #606

Merged
merged 2 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions manager/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# First stage: build environment
FROM ubuntu:22.04 AS build-env

LABEL maintainer="[email protected]"

ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig

# Install build dependencies
RUN apt-get update -y && \
apt-get install -y git gcc pkg-config make m4 clang llvm zlib1g-dev libelf-dev libpcap-dev libcap-ng-dev meson

# Clone and build the xdp-tools project
RUN git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git && \
cd xdp-tools && ./configure && make && make install && \
cd lib/libbpf/src && make install

# Clone and build the Media-Transport-Library project
RUN git clone https://github.com/OpenVisualCloud/Media-Transport-Library.git && \
cd Media-Transport-Library/manager && meson setup build && meson compile -C build

# Second stage: runtime environment
FROM ubuntu:22.04

# Install runtime dependencies
RUN apt-get update -y && \
apt-get install -y ethtool libelf-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Copy the necessary binaries and libraries from the build-env
COPY --from=build-env /usr/local /usr/local
COPY --from=build-env /Media-Transport-Library/manager/build /app

WORKDIR /app

ENTRYPOINT ["./MtlManager"]
36 changes: 35 additions & 1 deletion manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,44 @@ This command will start the MTL Manager with root privileges, which are necessar

## Run with our XDP program

We have an edited version of the original AF_XDP eBPF program which allows user to add or remove udp dest port in the eBPF program to act as a packet filter, please see [ebpf tool](../tools/ebpf) for how to build it.
We have a modified version of the original AF_XDP eBPF program which allows user to add or remove udp dest port in the eBPF program to act as a packet filter, please see [ebpf tool](../tools/ebpf) for how to build it.

To run the MTL Manager with our XDP program, execute:

```bash
sudo MTL_XDP_PROG_PATH=/path/to/Media-Transport-Library/tools/ebpf/xsk.xdp.o ./build/MtlManager
```

## Run in a Docker container

Build the Docker image:

```bash
docker build -t mtl-manager:latest .
# docker build -t mtl-manager:latest --build-arg HTTP_PROXY=$http_proxy --build-arg HTTPS_PROXY=$https_proxy .
```

Run the Docker container as a daemon:

```bash
docker run -d \
--name mtl-manager \
--privileged --net=host \
-v /var/run/imtl:/var/run/imtl \
-v /sys/fs/bpf:/sys/fs/bpf \
-v "$(pwd)"/../tools/ebpf/xsk.xdp.o:/tmp/imtl/xdp_prog.o \
mtl-manager:latest
```

Print the MTL Manager logs:

```bash
docker logs -f mtl-manager
```

Shutdown the Docker container with SIGINT:

```bash
docker kill -s SIGINT mtl-manager
# docker rm mtl-manager
```