Skip to content

Commit 7aab053

Browse files
committed
Generalizing
1 parent c650fae commit 7aab053

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Parts of this project were borrowed in part from Binan/rtpengine-docker
66

77
## Files
88

9-
- `Dockerfile` is an Ubuntu 14.04 based image that properly builds a first-class rtpengine runtime from source
9+
- `Dockerfile*` properly builds a first-class rtpengine runtime from source
1010
- `Makefile` merely calls `docker-compose build` and `docker-compose up` for local iteration convenience.
1111
- `README.md` is the file you are reading right now.
1212
- `docker-compose.yml` is a v2 config example, with some pre-defined defaults and a list of environment variables.
@@ -19,9 +19,7 @@ This repository assumes that the resultant docker container will be run as privi
1919

2020
## Build and Run
2121

22-
If you are running an Ubuntu or Debian docker host, you should be able to `docker-compose up` and it should just work.
23-
24-
If you are running an RPM based distro, check out Binan/rtpengine-docker which is tested on Fedora.
22+
If you are running an Ubuntu, Debian, Centos, or Fedora docker host, you should be able to `docker-compose up` and it should just work.
2523

2624
If you are running any other linux flavor as your docker host, this repository is not going to work for you as-is.
2725

@@ -36,13 +34,13 @@ Both the `Dockerfile` and the `run.sh` script will attempt to build a DKMS kerne
3634

3735
Whatever the `uname -r` is at "build" time, the kernel version headers and kernel module for whatever docker host was used to build this image will try and use that version.
3836

39-
The `FROM` line of the `Dockerfile` in this project is `ubuntu:14.04`, which means that any build host that is not also Ubuntu 14.04 will silently skip including that as part of the docker build (see the "`|| true`" in the `Dockerfile` for that step).
37+
The `FROM` line of the `Dockerfile` in this project is `centos7`, which means that any build host that is not also Centos7 will silently skip including that as part of the docker build (see the "`|| true`" in the `Dockerfile` for that step).
4038

4139
All this is really doing is pre-building a kernel module for you to use at docker run time. This is a time-saver, but is not necessary.
4240

4341
## At run time
4442

45-
Regardless of the linux docker host flavor you _build_ this on, you should still be able to _run_ this on any Ubuntu or Debian flavor derivative host version, and it should properly build the DKMS kernel before loading it and running the rtpengine daemon. This does take a little time.
43+
Regardless of the linux docker host flavor you _build_ this on, you should still be able to _run_ this on any same Ubuntu or Debian flavor derivative host version, and it should properly build the DKMS kernel before loading it and running the rtpengine daemon. This does take a little time.
4644

4745
Because the `Dockerfile` and `run.sh` script assume Ubuntu/Debian tooling, this will not work for any other linux docker host flavor.
4846

run.sh

+26-8
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,32 @@ fi
1919
if lsmod | grep xt_RTPENGINE || modprobe xt_RTPENGINE; then
2020
echo "rtpengine kernel module already loaded."
2121
else
22-
# Build the kernel module for the docker run host
23-
apt-get update -y
24-
export DEBIAN_FRONTEND=noninteractive
25-
apt-get install -y linux-headers-$(uname -r) linux-image-$(uname -r)
26-
27-
module-assistant update
28-
module-assistant auto-install ngcp-rtpengine-kernel-source
29-
modprobe xt_RTPENGINE
22+
if which apt-get ; then
23+
# Build the kernel module for the docker run host
24+
apt-get update -y
25+
export DEBIAN_FRONTEND=noninteractive
26+
apt-get install -y linux-headers-$(uname -r) linux-image-$(uname -r)
27+
28+
module-assistant update
29+
module-assistant auto-install ngcp-rtpengine-kernel-source
30+
modprobe xt_RTPENGINE
31+
else
32+
if which dnf || which yum ; then
33+
cd /rtpengine/daemon
34+
make
35+
cp -u rtpengine /usr/local/bin/
36+
cd /rtpengine/iptables-extension
37+
make
38+
cp -u libxt_RTPENGINE.so /lib64/xtables
39+
cd /rtpengine/kernel-module
40+
make
41+
cp -u xt_RTPENGINE.ko "/lib/modules/$(uname -r)/extra"
42+
depmod -a
43+
else
44+
echo "This script is not running on debian/ubuntu/centus/fedora, cannot attempt to build kernel module"
45+
exit 1
46+
fi
47+
fi
3048
fi
3149

3250
# Gradually fill the options of the command rtpengine which starts the RTPEngine daemon

0 commit comments

Comments
 (0)