mirror of https://github.com/ossrs/srs.git
Squash: Support RPM. Fix bugs.
parent
a01354a595
commit
523b055c06
@ -0,0 +1,4 @@
|
||||
82c82
|
||||
< char bit_string[MAX_PRINT_STRING_LEN];
|
||||
---
|
||||
> static char bit_string[MAX_PRINT_STRING_LEN];
|
@ -0,0 +1,16 @@
|
||||
FROM ossrs/srs:dev
|
||||
|
||||
# version=4.0.145
|
||||
ARG version
|
||||
|
||||
# Install depends tools.
|
||||
RUN yum install -y zip
|
||||
|
||||
# Setup the packager env.
|
||||
ENV SRS_AUTO_PACKAGER ossrs
|
||||
|
||||
# Build and install SRS.
|
||||
ADD srs-server-${version}.tar.gz /srs
|
||||
WORKDIR /srs/srs-server-${version}/trunk
|
||||
RUN ./scripts/package.sh --x86-x64 --jobs=2
|
||||
|
@ -0,0 +1,50 @@
|
||||
# main config for srs.
|
||||
# @see full.conf for detail config.
|
||||
|
||||
daemon off;
|
||||
pid /var/lib/srs/srs.pid;
|
||||
work_dir /var/lib/srs;
|
||||
listen 1935;
|
||||
max_connections 1000;
|
||||
srs_log_tank file;
|
||||
srs_log_file /var/log/srs/srs.log;
|
||||
|
||||
http_api {
|
||||
enabled on;
|
||||
listen 1985;
|
||||
}
|
||||
|
||||
http_server {
|
||||
enabled on;
|
||||
listen 8080;
|
||||
dir /usr/share/srs/html;
|
||||
}
|
||||
|
||||
rtc_server {
|
||||
enabled on;
|
||||
listen 8000;
|
||||
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate
|
||||
candidate $CANDIDATE;
|
||||
}
|
||||
|
||||
stats {
|
||||
network 0;
|
||||
disk sda sdb xvda xvdb;
|
||||
}
|
||||
|
||||
vhost __defaultVhost__ {
|
||||
hls {
|
||||
enabled on;
|
||||
}
|
||||
http_remux {
|
||||
enabled on;
|
||||
mount [vhost]/[app]/[stream].flv;
|
||||
}
|
||||
rtc {
|
||||
enabled on;
|
||||
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
|
||||
rtmp_to_rtc off;
|
||||
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp
|
||||
rtc_to_rtmp off;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# srs - a simple, high efficiency and realtime video server
|
||||
#
|
||||
# chkconfig: <default runlevel(s)> <start> <stop>
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: srs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: a simple, high efficiency and realtime video server
|
||||
### END INIT INFO
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
exec="/usr/bin/srs"
|
||||
prog=${exec##*/}
|
||||
configfile=/etc/srs/srs.conf
|
||||
|
||||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||
|
||||
lockfile=/var/lock/subsys/$prog
|
||||
|
||||
start() {
|
||||
echo -n $"Starting $prog: "
|
||||
daemon --user nobody $exec -c $configfile
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && touch $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n $"Stopping $prog: "
|
||||
killproc $exec -TERM
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
reload() {
|
||||
echo -n $"reloading $prog: "
|
||||
killproc $exec -HUP
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
rotate() {
|
||||
echo -n $"logrotate $prog: "
|
||||
killproc $exec -USR1
|
||||
retval=$?
|
||||
echo
|
||||
[ $retval -eq 0 ] && rm -f $lockfile
|
||||
return $retval
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart|reload|rotate)
|
||||
$1
|
||||
;;
|
||||
status)
|
||||
status $prog
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|status|restart|reload|rotate}"
|
||||
exit 2
|
||||
esac
|
@ -0,0 +1,15 @@
|
||||
/var/log/srs/*.log {
|
||||
daily
|
||||
missingok
|
||||
rotate 30
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
create 640 root nobody
|
||||
sharedscripts
|
||||
postrotate
|
||||
if [ -f /var/lib/srs/srs.pid ]; then
|
||||
kill -USR1 `cat /var/lib/srs/srs.pid`
|
||||
fi
|
||||
endscript
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
[Unit]
|
||||
Description=srs - a simple, high efficiency and realtime video server
|
||||
Documentation=https://github.com/ossrs/srs/wiki
|
||||
After=network-online.target remote-fs.target nss-lookup.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=nobody
|
||||
Group=nobody
|
||||
WorkingDirectory=/var/lib/srs
|
||||
EnvironmentFile=-/etc/sysconfig/srs
|
||||
PIDFile=/var/lib/srs/srs.pid
|
||||
ExecStartPre=/usr/bin/srs -c /etc/srs/srs.conf -t
|
||||
ExecStart=/usr/bin/srs -c /etc/srs/srs.conf
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
ExecStop=/bin/kill -s TERM $MAINPID
|
||||
Restart=on-failure
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -0,0 +1,103 @@
|
||||
%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7) || (0%{?suse_version} == 1315)
|
||||
|
||||
Name: srs
|
||||
Version: 3.0.168
|
||||
Release: 1%{?dist}
|
||||
Summary: a simple, high efficiency and realtime video server
|
||||
|
||||
License: MIT
|
||||
URL: https://github.com/ossrs/srs
|
||||
Source0: %{name}-3.0-r8.tar.gz
|
||||
Source1: srs.conf
|
||||
Source2: srs.service
|
||||
Source3: srs.init
|
||||
Source4: srs.logrotate
|
||||
|
||||
BuildRequires: python
|
||||
BuildRequires: rsync
|
||||
|
||||
%if %{use_systemd}
|
||||
BuildRequires: systemd
|
||||
Requires: systemd
|
||||
%else
|
||||
BuildRequires: initscripts
|
||||
Requires: initscripts
|
||||
%endif
|
||||
|
||||
%description
|
||||
SRS is a simple, high efficiency and realtime video server, supports RTMP/WebRTC/HLS/HTTP-FLV/SRT.
|
||||
|
||||
%prep
|
||||
%setup -q -n srs-3.0-r8
|
||||
|
||||
%build
|
||||
cd trunk
|
||||
./configure --prefix=/usr
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%{__mkdir_p} $RPM_BUILD_ROOT%{_bindir}
|
||||
%{__mkdir_p} $RPM_BUILD_ROOT%{_initrddir}
|
||||
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/%{name}
|
||||
%{__mkdir_p} $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}
|
||||
%{__mkdir_p} $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}
|
||||
|
||||
%{__install} -m 755 trunk/objs/srs $RPM_BUILD_ROOT%{_bindir}
|
||||
|
||||
#http_server file
|
||||
rsync -aqL --delete trunk/objs/nginx/ $RPM_BUILD_ROOT%{_datadir}/%{name}/
|
||||
|
||||
#%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
|
||||
%{__install} -D -m 644 trunk/packaging/redhat/srs.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/srs.conf
|
||||
|
||||
#init files
|
||||
%if %{use_systemd}
|
||||
%{__mkdir} -p $RPM_BUILD_ROOT%{_unitdir}
|
||||
%{__install} -p -m 644 trunk/packaging/redhat/srs.service $RPM_BUILD_ROOT%{_unitdir}/srs.service
|
||||
%else
|
||||
%{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir}
|
||||
%{__install} -p -m 755 trunk/packaging/redhat/srs.init $RPM_BUILD_ROOT%{_initrddir}/srs
|
||||
sed -i 's/daemon/{s/off/on/g}' %{_sysconfdir}/%{name}/srs.conf
|
||||
%endif
|
||||
|
||||
#logrotate
|
||||
%{__install} -D -p -m 644 trunk/packaging/redhat/srs.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/srs
|
||||
|
||||
|
||||
%pre
|
||||
# Add the "srs" user
|
||||
# getent group srs >/dev/null || groupadd -r srs
|
||||
# getent passwd srs >/dev/null || useradd -r -g srs -s /sbin/nologin -d /var/lib/srs srs
|
||||
|
||||
%post
|
||||
%if %{use_systemd}
|
||||
%systemd_post %{name}.service
|
||||
%endif
|
||||
|
||||
%preun
|
||||
%if %{use_systemd}
|
||||
%systemd_preun %{name}.service
|
||||
%endif
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_bindir}/*
|
||||
%config(noreplace) %{_sysconfdir}/srs/srs.conf
|
||||
%{_sysconfdir}/logrotate.d/srs
|
||||
%{_datadir}/%{name}
|
||||
%dir %attr(0755, nobody, nobody) %{_localstatedir}/log/%{name}
|
||||
%dir %attr(0755, nobody, nobody) %{_sharedstatedir}/%{name}
|
||||
%doc trunk/conf
|
||||
%license LICENSE
|
||||
|
||||
%if %{use_systemd}
|
||||
%{_unitdir}/srs.service
|
||||
%else
|
||||
%{_initrddir}/%{name}
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Nov 1 2021 Purple Grape <purplegrape4@gmail.com>
|
||||
- rpm init
|
Loading…
Reference in New Issue