summaryrefslogtreecommitdiff
path: root/net-im
diff options
context:
space:
mode:
authorAndreas Schuerch <nativemad@gentoo.org>2017-04-01 12:44:07 +0200
committerAndreas Schuerch <nativemad@gentoo.org>2017-04-01 12:45:42 +0200
commit781c7df3a4d765bb6f592f1d4b4e521a9de56a60 (patch)
tree76903862f8a4f238c7da4cf66bbcdd0a54c0190a /net-im
parentapp-dicts/aspell-vi: Bump to EAPI 6 (diff)
downloadgentoo-781c7df3a4d765bb6f592f1d4b4e521a9de56a60.tar.gz
gentoo-781c7df3a4d765bb6f592f1d4b4e521a9de56a60.tar.bz2
gentoo-781c7df3a4d765bb6f592f1d4b4e521a9de56a60.zip
net-im/coturn: sane logging defaults thanks to Andrey Utkin. New systemd unit, see bug 605302
Package-Manager: Portage-2.3.3, Repoman-2.3.1
Diffstat (limited to 'net-im')
-rw-r--r--net-im/coturn/coturn-4.5.0.4-r1.ebuild (renamed from net-im/coturn/coturn-4.5.0.4.ebuild)16
-rw-r--r--net-im/coturn/coturn-9999.ebuild16
-rw-r--r--net-im/coturn/files/coturn.service17
-rw-r--r--net-im/coturn/files/logrotate.coturn15
-rwxr-xr-xnet-im/coturn/files/turnserver.init3
5 files changed, 56 insertions, 11 deletions
diff --git a/net-im/coturn/coturn-4.5.0.4.ebuild b/net-im/coturn/coturn-4.5.0.4-r1.ebuild
index 6fa8344cd79d..2ffd86380e4e 100644
--- a/net-im/coturn/coturn-4.5.0.4.ebuild
+++ b/net-im/coturn/coturn-4.5.0.4-r1.ebuild
@@ -1,8 +1,8 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
-inherit eutils user
+inherit eutils user systemd
DESCRIPTION="coturn TURN server project"
HOMEPAGE="https://github.com/${PN}/${PN}"
@@ -30,6 +30,10 @@ RDEPEND="dev-libs/libevent[ssl]
DEPEND="${RDEPEND}"
src_configure() {
+ sed 's:#log-file=/var/tmp/turn.log:log-file=/var/log/turnserver.log:' \
+ -i "${S}/examples/etc/turnserver.conf" || die "sed for logdir failed"
+ sed 's:#simple-log:simple-log:' -i "${S}/examples/etc/turnserver.conf" \
+ || die "sed for simple-log failed"
if ! use mongodb; then
export TURN_NO_MONGO=yes
fi
@@ -52,12 +56,14 @@ src_configure() {
src_install() {
default
newinitd "${FILESDIR}/turnserver.init" turnserver
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/logrotate.${PN}" "${PN}"
+ systemd_dounit "${FILESDIR}/${PN}.service"
}
pkg_postinst() {
enewgroup turnserver
enewuser turnserver -1 -1 -1 turnserver
- elog "Be aware that the default path for logfiles in coturn is /var/tmp!"
- elog "You should copy /etc/turnserver.conf.default to"
- elog "/etc/turnserver.conf and change not only the log option."
+ elog "You need to copy /etc/turnserver.conf.default to"
+ elog "/etc/turnserver.conf and do your settings there."
}
diff --git a/net-im/coturn/coturn-9999.ebuild b/net-im/coturn/coturn-9999.ebuild
index 6fa8344cd79d..2ffd86380e4e 100644
--- a/net-im/coturn/coturn-9999.ebuild
+++ b/net-im/coturn/coturn-9999.ebuild
@@ -1,8 +1,8 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
-inherit eutils user
+inherit eutils user systemd
DESCRIPTION="coturn TURN server project"
HOMEPAGE="https://github.com/${PN}/${PN}"
@@ -30,6 +30,10 @@ RDEPEND="dev-libs/libevent[ssl]
DEPEND="${RDEPEND}"
src_configure() {
+ sed 's:#log-file=/var/tmp/turn.log:log-file=/var/log/turnserver.log:' \
+ -i "${S}/examples/etc/turnserver.conf" || die "sed for logdir failed"
+ sed 's:#simple-log:simple-log:' -i "${S}/examples/etc/turnserver.conf" \
+ || die "sed for simple-log failed"
if ! use mongodb; then
export TURN_NO_MONGO=yes
fi
@@ -52,12 +56,14 @@ src_configure() {
src_install() {
default
newinitd "${FILESDIR}/turnserver.init" turnserver
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/logrotate.${PN}" "${PN}"
+ systemd_dounit "${FILESDIR}/${PN}.service"
}
pkg_postinst() {
enewgroup turnserver
enewuser turnserver -1 -1 -1 turnserver
- elog "Be aware that the default path for logfiles in coturn is /var/tmp!"
- elog "You should copy /etc/turnserver.conf.default to"
- elog "/etc/turnserver.conf and change not only the log option."
+ elog "You need to copy /etc/turnserver.conf.default to"
+ elog "/etc/turnserver.conf and do your settings there."
}
diff --git a/net-im/coturn/files/coturn.service b/net-im/coturn/files/coturn.service
new file mode 100644
index 000000000000..81465f589d8d
--- /dev/null
+++ b/net-im/coturn/files/coturn.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=turnserver daemon
+After=networking.target
+
+[Service]
+Type=simple
+User=turnserver
+Group=turnserver
+PermissionsStartOnly=true
+ExecStartPre=/bin/bash -c "[ -f /var/log/turnserver.log ] || touch /var/log/turnserver.log && chown turnserver:turnserver /var/log/turnserver.log && chmod 660 /var/log/turnserver.log"
+ExecStartPre=/bin/bash -c "[ -d /var/run/turnserver ] || mkdir /var/run/turnserver && chown turnserver:turnserver /var/run/turnserver"
+ExecStart=/usr/bin/turnserver --pidfile /var/run/turnserver/turnserver.pid
+Restart=always
+RestartSec=30s
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-im/coturn/files/logrotate.coturn b/net-im/coturn/files/logrotate.coturn
new file mode 100644
index 000000000000..06b4d74ec3a1
--- /dev/null
+++ b/net-im/coturn/files/logrotate.coturn
@@ -0,0 +1,15 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+/var/log/turnserver.log {
+daily
+rotate 7
+create 660 turnserver turnserver
+notifempty
+size 50M
+sharedscripts
+missingok
+postrotate
+[ -f /var/run/turnserver/turnserver.pid ] && kill -HUP `cat /var/run/turnserver/turnserver.pid`
+endscript
+}
diff --git a/net-im/coturn/files/turnserver.init b/net-im/coturn/files/turnserver.init
index 9be7711a8508..682e4f12202d 100755
--- a/net-im/coturn/files/turnserver.init
+++ b/net-im/coturn/files/turnserver.init
@@ -1,5 +1,5 @@
#!/sbin/openrc-run
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
@@ -13,6 +13,7 @@ depend() {
start() {
ebegin "Starting turnserver"
checkpath -q -d -m 0755 -o turnserver:turnserver /var/run/turnserver
+ checkpath -q -f -m 0660 -o turnserver:turnserver /var/log/turnserver.log
start-stop-daemon --start --user turnserver --exec /usr/bin/turnserver -- -o \
--pidfile /var/run/turnserver/turnserver.pid >/dev/null
eend $?