From 7b04aa23f765b254827b54d7ebbcef21aafa8fc5 Mon Sep 17 00:00:00 2001 From: antonvoylenko Date: Thu, 11 Nov 2021 12:52:09 +0200 Subject: [PATCH] Tune RPM building --- el/README.el.md | 121 ------------------------------- el/README.md | 59 +++++++++++++++ el/ngcp-rtpengine-iptables-setup | 2 +- el/rtpengine-recording.service | 10 +-- el/rtpengine-recording.sysconfig | 5 +- el/rtpengine.init | 2 +- el/rtpengine.service | 8 +- el/rtpengine.spec | 28 ++++--- el/rtpengine.sysconfig | 8 +- 9 files changed, 91 insertions(+), 152 deletions(-) delete mode 100644 el/README.el.md create mode 100644 el/README.md diff --git a/el/README.el.md b/el/README.el.md deleted file mode 100644 index 0807e1dbd..000000000 --- a/el/README.el.md +++ /dev/null @@ -1,121 +0,0 @@ -rtpengine for Enterprise Linux -================================== - -Installing from RPMs --------------------- - -There are three RPMs: - -- *ngcp-rtpengine*: the userspace daemon -- *ngcp-rtpengine-kernel*: the iptables plugin -- *ngcp-rtpengine-dkms*: the kernel module source - -All of the RPMs have correctly set dependencies and if you just want the -userspace daemon you can install it with yum (assuming you have access to a -CentOS repository). - -The *ngcp-rtpengine-kernel* package is dependent on the -*ngcp-rtpengine*, and *ngcp-rtpengine-dkms* packages. The -*ngcp-rtpengine-dkms* package has a dependency (DKMS) that cannot be met -by the CentOS base repository. If you want to use in-kernel forwarding you -need to add the [*EPEL*](http://fedoraproject.org/wiki/EPEL) repository and -install the *dkms* package before attempting to install -*ngcp-rtpengine-dkms* or *ngcp-rtpengine-kernel*. - -Note: installing *ngcp-rtpengine-dkms* builds a kernel module which requires -the sources for the running kernel. The *kernel-devel* and *kernel-headers* -packages are meta-packages that install the headers and source for the latest -kernel version. This will be what you want unless you are running a custom -or older kernel. *ngcp-rtpengine-dkms* does not have *kernel-devel* and -*kernel-headers* as dependencies as this could cause problems if you are using -a custom or older kernel, so you need to install these manually. - - -RPM Compilation ---------------- - -To build the RPMs you need all of the packages listed in the Manual Compilation -section (except for *kernel-devel* and *kernel-headers*) plus: - -- *redhat-rpm-config* -- *rpm-build* - -To build the RPMs: -- Checkout (clone) the Git repository -- Create the `~/rpmbuild/SOURCES` directory -- Create a tar archive. For example, from within the cloned directory you can - use - `git archive --output ~/rpmbuild/SOURCES/ngcp-rtpengine-.tar.gz --prefix=ngcp-rtpengine-/ master` - where `` is the version number of the master branch -- Build the RPMs. For example, - `rpmbuild -ta ~/rpmbuild/SOURCES/ngcp-rtpengine-.tar.gz` - -Once the build has completed the binary RPMs will be in `~/rpmbuild/RPMS`. - - -Manual Compilation ------------------- - -There are three parts to rtpengine, each of which can be found in the -respective subdirectories. - -* `daemon` - - The userspace daemon and workhorse, minimum requirement for anything - to work. Running `RTPENGINE_VERSION="\"\"" make` will - compile the binary, which will be called `rtpengine`. The - following software packages are required to compile the daemon: - - - *gcc* - - *make* - - *pkgconfig* - - *glib2-devel* - - *hiredis-devel* - - *libcurl-devel* - - *openssl-devel* - - *pcre-devel* - - *xmlrpc-c-devel* - - *zlib-devel* - -* `iptables-extension` - - Required for in-kernel packet forwarding. Running - `RTPENGINE_VERSION="\"\"" make` will compile the plugin - for `iptables` and `ip6tables`. The file will be called - `libxt_RTPENGINE.so` and should be copied into the directory - `/lib/xtables/` in 32-bit environments and `/lib64/xtables/` in 64-bit - environments. The following software packages are required to compile - the plugin: - - - *gcc* - - *make* - - *iptables-devel* - -* `kernel-module` - - Required for in-kernel packet forwarding. Compilation of the kernel - module requires the kernel development packages for the kernel version - you are using (see output of `uname -r`) to be installed. Running - `RTPENGINE_VERSION="\"\"" make` will compile the kernel - module. - - Successful compilation of the module will produce the file - `xt_RTPENGINE.ko`. The module can be inserted into the running kernel - manually through `insmod xt_RTPENGINE.ko` (which will result in an - error if depending modules aren't loaded, for example the `x_tables` - module), but it's recommended to copy the module into - `/lib/modules//updates/`, followed by running - `depmod -a`. After this, the module can be loaded by issuing - `modprobe xt_RTPENGINE`. - - The following software packages are required to compile the plugin: - - - *gcc* - - *make* - - *kernel-devel* - - *kernel-headers* - - Note: the *kernel-devel* and *kernel-headers* packages are meta-packages - that install the headers and source for the latest kernel version. This - will be what you want unless you are running a custom or older kernel. - diff --git a/el/README.md b/el/README.md new file mode 100644 index 000000000..6d1651b0b --- /dev/null +++ b/el/README.md @@ -0,0 +1,59 @@ +rtpengine for Enterprise Linux +================================== + +Installing from RPMs +-------------------- + +There are four RPMs: + +- *ngcp-rtpengine*: the userspace daemon +- *ngcp-rtpengine-recording*: the recording daemon +- *ngcp-rtpengine-kernel*: the iptables plugin +- *ngcp-rtpengine-dkms*: the kernel module source + +All of the RPMs have correctly set dependencies and if you just want the +userspace daemon you can install it with yum (assuming you have access to a repository). + +The *ngcp-rtpengine-kernel* package is dependent on the +*ngcp-rtpengine*, and *ngcp-rtpengine-dkms* packages. The +*ngcp-rtpengine-dkms* package has a dependency (DKMS) that cannot be met +by the base repository. If you want to use in-kernel forwarding you +need to add the [*EPEL*](http://fedoraproject.org/wiki/EPEL) repository and +install the *dkms* package before attempting to install +*ngcp-rtpengine-dkms* or *ngcp-rtpengine-kernel*. + +Note: installing *ngcp-rtpengine-dkms* builds a kernel module which requires +the sources for the running kernel. The *kernel-devel* and *kernel-headers* +packages are meta-packages that install the headers and source for the latest +kernel version. This will be what you want unless you are running a custom +or older kernel. *ngcp-rtpengine-dkms* does not have *kernel-devel* and +*kernel-headers* as dependencies as this could cause problems if you are using +a custom or older kernel, so you need to install these manually. + + +RPM Compilation +--------------- + +To build the RPMs you need all of the packages listed in the Manual Compilation +section (except for *kernel-devel* and *kernel-headers*) plus: + +- *redhat-rpm-config* +- *rpm-build* + +To build the RPMs: +- Checkout (clone) the Git repository +- Create the `~/rpmbuild/SOURCES` directory +- Create a tar archive. For example, from within the cloned directory you can + use + `git archive --output ~/rpmbuild/SOURCES/ngcp-rtpengine-.tar.gz --prefix=ngcp-rtpengine-/ master` + where `` is the version number of the master branch +- Build the RPMs. For example, + `rpmbuild -ta ~/rpmbuild/SOURCES/ngcp-rtpengine-.tar.gz` + +Once the build has completed the binary RPMs will be in `~/rpmbuild/RPMS`. + + +Manual Compilation +------------------ + +Check the main project README. diff --git a/el/ngcp-rtpengine-iptables-setup b/el/ngcp-rtpengine-iptables-setup index b9324c995..614d03538 100755 --- a/el/ngcp-rtpengine-iptables-setup +++ b/el/ngcp-rtpengine-iptables-setup @@ -11,7 +11,7 @@ if [ -f "$DEFAULTS" ]; then . "$DEFAULTS" || true fi -TABLE=$(/usr/libexec/rtpengine/rtpengine-get-table --config-file="${CONFIG_FILE-/etc/rtpengine/rtpengine.conf}") +TABLE=$(/sbin/rtpengine-get-table --config-file="${CONFIG_FILE-/etc/rtpengine/rtpengine.conf}") MODPROBE_OPTIONS="" # Handle requested setuid/setgid. diff --git a/el/rtpengine-recording.service b/el/rtpengine-recording.service index d0ada0ed8..525ec67bf 100644 --- a/el/rtpengine-recording.service +++ b/el/rtpengine-recording.service @@ -1,17 +1,17 @@ [Unit] -Description=NGCP RtpEngine - RTP Recording Daemon +Description=NGCP RTP/media Recording Daemon Wants=network-online.target After=network-online.target [Service] Type=forking -User=ngcp-rtpengine -Group=daemon -Environment=CFGFILE=/etc/rtpengine/rtpengine-recording.conf +Environment=CFG_FILE=/etc/rtpengine/rtpengine-recording.conf EnvironmentFile=/etc/sysconfig/rtpengine-recording PIDFile=/run/rtpengine-recording.pid -ExecStart=/usr/sbin/rtpengine-recording --config-file=${CFGFILE} --pidfile=$PIDFILE +ExecStart=/usr/sbin/rtpengine-recording --config-file=${CFG_FILE} --pidfile=${PID_FILE} +TimeoutSec=15s Restart=on-failure [Install] WantedBy=multi-user.target +Alias=ngcp-rtpengine-recording.service diff --git a/el/rtpengine-recording.sysconfig b/el/rtpengine-recording.sysconfig index 4a2befa9e..a088d5cdf 100644 --- a/el/rtpengine-recording.sysconfig +++ b/el/rtpengine-recording.sysconfig @@ -2,7 +2,4 @@ # http://github.com/sipwise/rtpengine # CONFIG_FILE=/etc/rtpengine/rtpengine-recording.conf -PIDFILE=/run/rtpengine-recording.pid -#SET_USER=root -#SET_GROUP=root # GROUP only needs to be set if USER is not set or if the user isn't in the group - +PID_FILE=/run/rtpengine-recording.pid \ No newline at end of file diff --git a/el/rtpengine.init b/el/rtpengine.init index cf19c48cd..543e963cd 100644 --- a/el/rtpengine.init +++ b/el/rtpengine.init @@ -34,7 +34,7 @@ prog=rtpengine pidfile=${PIDFILE-/run/rtpengine.pid} lockfile=${LOCKFILE-/var/lock/subsys/rtpengine} cachefile=/var/lib/ngcp-rtpengine/rtpengine.cfg -TABLE=$(/usr/libexec/rtpengine/rtpengine-get-table --config-file="${CONFIG_FILE-/etc/rtpengine/rtpengine.conf}") +TABLE=$(/sbin/rtpengine-get-table --config-file="${CONFIG_FILE-/etc/rtpengine/rtpengine.conf}") PIDFILE=${pidfile} RETVAL=0 OPTS="" diff --git a/el/rtpengine.service b/el/rtpengine.service index 4f2721d28..ac960773f 100644 --- a/el/rtpengine.service +++ b/el/rtpengine.service @@ -4,12 +4,16 @@ After=network-online.target [Service] Type=forking +Environment=CFG_FILE=/etc/rtpengine/rtpengine.conf EnvironmentFile=/etc/sysconfig/rtpengine -Environment=CFGFILE=/etc/rtpengine/rtpengine.conf PIDFile=/run/rtpengine.pid ExecStartPre=/usr/sbin/ngcp-rtpengine-iptables-setup start -ExecStart=/usr/sbin/rtpengine --no-log-timestamps --pidfile=${PIDFile} --config-file=${CFGFILE} +ExecStart=/usr/sbin/rtpengine --config-file=${CFG_FILE} --pidfile=${PID_FILE} ExecStopPost=/usr/sbin/ngcp-rtpengine-iptables-setup stop +RestartSec=3s +TimeoutSec=15s +Restart=on-failure [Install] WantedBy=multi-user.target +Alias=ngcp-rtpengine.service diff --git a/el/rtpengine.spec b/el/rtpengine.spec index f0f9a9159..0245750b0 100644 --- a/el/rtpengine.spec +++ b/el/rtpengine.spec @@ -1,12 +1,11 @@ Name: ngcp-rtpengine Version: 10.2.0.0+0~mr10.2.0.0 Release: 1%{?dist} -Summary: The Sipwise NGCP rtpengine - +Summary: The Sipwise NGCP rtpengine daemon Group: System Environment/Daemons License: GPLv3 URL: https://github.com/sipwise/rtpengine -Source0: https://github.com/sipwise/rtpengine/archive/mr%{version}/%{name}-%{version}.tar.gz +Source0: https://github.com/sipwise/rtpengine/archive/%{name}-%{version}.tar.gz Conflicts: %{name}-kernel < %{version}-%{release} %global with_transcoding 1 @@ -76,21 +75,22 @@ Requires(preun): dkms %if 0%{?with_transcoding} > 0 %package recording -Summary: NGCP rtpengine recording daemon packet +Summary: The Sipwise NGCP rtpengine recording daemon Group: System Environment/Daemons BuildRequires: gcc make redhat-rpm-config %{mysql_devel_pkg} ffmpeg-devel %description recording -%{summary}. +The Sipwise rtpengine media proxy has support for exporting media (RTP) packets +that it forwards. The rtpengine-recording daemon collects these exported packets +and decodes them into an audio format that can be listened to. %endif %define binname rtpengine -%define archname rtpengine-mr %prep -%setup -q -n %{archname}%{version} +%setup -q -n %{name}-%{version} %build @@ -116,7 +116,7 @@ install -D -p -m755 daemon/%{binname} %{buildroot}%{_sbindir}/%{binname} # Install CLI (command line interface) install -D -p -m755 utils/%{binname}-ctl %{buildroot}%{_sbindir}/%{binname}-ctl # Install helper -install -D -p -m755 utils/%{binname}-get-table %{buildroot}%{_libexecdir}/%{binname}/%{binname}-get-table +install -D -p -m755 utils/%{binname}-get-table %{buildroot}%{_sbindir}/%{binname}-get-table # Install recording daemon %if 0%{?with_transcoding} > 0 install -D -p -m755 recording-daemon/%{binname}-recording %{buildroot}%{_sbindir}/%{binname}-recording @@ -238,6 +238,8 @@ true %{_sbindir}/%{binname} # CLI (command line interface) %{_sbindir}/%{binname}-ctl +# CLI table helper +%{_sbindir}/%{binname}-get-table # init.d script and configuration file %if 0%{?has_systemd_dirs} %{_unitdir}/%{binname}.service @@ -249,9 +251,9 @@ true %config(noreplace) %{_sysconfdir}/sysconfig/%{binname} %attr(0750,%{name},%{name}) %dir %{_sharedstatedir}/%{name} # default config -%{_sysconfdir}/%{binname}/%{binname}.conf +%config(noreplace) %{_sysconfdir}/%{binname}/%{binname}.conf # Documentation -%doc LICENSE README.md el/README.el.md debian/changelog debian/copyright +%doc LICENSE README.md debian/changelog debian/copyright %files kernel @@ -278,12 +280,16 @@ true # Sysconfig %config(noreplace) %{_sysconfdir}/sysconfig/%{binname}-recording # Default config -%{_sysconfdir}/%{binname}/%{binname}-recording.conf +%config(noreplace) %{_sysconfdir}/%{binname}/%{binname}-recording.conf # spool directory %attr(0750,%{name},%{name}) %dir %{_var}/spool/%{binname} %endif %changelog +* Wed Nov 11 2021 Anton Voylenko + - update packages metadata + - remove the "archname" variable + - do not override service configuration * Tue Jul 10 2018 netaskd - 6.4.0.0-1 - update to ngcp-rtpengine version 6.4.0.0 - add packet recording diff --git a/el/rtpengine.sysconfig b/el/rtpengine.sysconfig index b7f93ca46..b1871f4ca 100644 --- a/el/rtpengine.sysconfig +++ b/el/rtpengine.sysconfig @@ -3,10 +3,4 @@ # main config file CONFIG_FILE=/etc/rtpengine/rtpengine.conf # pid -#PIDFILE=/run/ngcp-rtpengine-daemon.pid - -# User -# Run rtpengine as this specific user -#SET_USER=ngcp-rtpengine -# allow this group to control rtpengine in kernel mode -#SET_GROUP=ngcp-rtpengine +PID_FILE=/run/rtpengine.pid