diff --git a/manager/Dockerfile b/manager/Dockerfile new file mode 100644 index 000000000..6f8657bae --- /dev/null +++ b/manager/Dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:22.04 + +LABEL maintainer="ming3.li@intel.com" + +ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig + +WORKDIR /root + +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 ethtool && \ + git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git && \ + # Build and install libbpf, libxdp and xdp-tools + cd xdp-tools && ./configure && make && make install && cd lib/libbpf/src && make install && \ + cd /root && git clone https://github.com/OpenVisualCloud/Media-Transport-Library.git && \ + cd Media-Transport-Library/manager && meson setup build && meson compile -C build && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /root/Media-Transport-Library/manager/build + +ENTRYPOINT ["./MtlManager"] diff --git a/manager/README.md b/manager/README.md index cb15b94f9..5201b2b6b 100644 --- a/manager/README.md +++ b/manager/README.md @@ -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 an 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 +```