summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandros Michalopoulos2018-10-16 15:59:57 +0300
committerAlexandros Michalopoulos2018-10-16 15:59:57 +0300
commit821b2eff44c8378ab3092657fc1abf8dac8321f3 (patch)
tree274fa9513730b01a81a3f56a7831a747a64e461b
parent96fa328b1970235db4d477133be38670d105c81e (diff)
downloadaur-821b2eff44c8378ab3092657fc1abf8dac8321f3.tar.gz
v=1.32.2,r=3 - Added spawn-fcgi & multiwatch to the mix so ZoneMinder can utilize more than 1 simultaneous CGI threads when running on Nginx
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD28
-rw-r--r--fcgiwrap-multiwatch.service13
-rw-r--r--zoneminder.install45
4 files changed, 62 insertions, 30 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 074b34fcb256..aa096ebd651b 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = zoneminder
pkgdesc = A full-featured, open source, state-of-the-art video surveillance software system
pkgver = 1.32.2
- pkgrel = 2
+ pkgrel = 3
url = https://zoneminder.com/
install = zoneminder.install
arch = x86_64
@@ -13,6 +13,8 @@ pkgbase = zoneminder
depends = mariadb
depends = nginx-mainline
depends = fcgiwrap
+ depends = spawn-fcgi
+ depends = multiwatch
depends = php-apcu
depends = php-fpm
depends = php-gd
@@ -55,6 +57,7 @@ pkgbase = zoneminder
source = zoneminder-php.ini
source = zoneminder.service
source = zoneminder-tmpfile.conf
+ source = fcgiwrap-multiwatch.service
sha256sums = cf72cbd45d91ef0232c123dac5f908993f8941a62b9ae96975c4e6043bd4b9a9
sha256sums = 55be29e1eccb44d4ad0db8b23c37cec50f5341f8e498583d472ed1f0493876e3
sha256sums = dbd231e97b950c698f0f501d6a53c7291c9985e766b09e3afe00cfe69a969f44
@@ -63,6 +66,7 @@ pkgbase = zoneminder
sha256sums = 7905ceddbb049de0f9bf4f1eb58779dfe310a65c4d2ec44854d592d4f31b6a72
sha256sums = 3e4de227e3154dffa887f2286c339ab3cf456f6d74a400b2786192b7e2b129c0
sha256sums = b69ac1deaaf3cf84b4ae4dbab794e1b062823de817f1e3a816ccf5438db440c0
+ sha256sums = e95f9bef77aef647dd633bd9ad75dc099b6d7184684e133f2f20702de83a6260
pkgname = zoneminder
diff --git a/PKGBUILD b/PKGBUILD
index cc611743d9d7..38052ac3a4b5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -38,7 +38,7 @@
pkgname=zoneminder
pkgver=1.32.2
-pkgrel=2
+pkgrel=3
pkgdesc='A full-featured, open source, state-of-the-art video surveillance software system'
arch=('x86_64')
url='https://zoneminder.com/'
@@ -47,7 +47,7 @@ depends=('polkit' 'ffmpeg' 'libmp4v2'
# Remove the following line if you want to install ZoneMinder without a local database server, e.g. as part of a Multi-Server setup
'mariadb'
# Remove the following line if you don't need Nginx
- 'nginx-mainline' 'fcgiwrap'
+ 'nginx-mainline' 'fcgiwrap' 'spawn-fcgi' 'multiwatch'
'php-apcu' 'php-fpm' 'php-gd'
'perl-archive-zip' 'perl-data-dump' 'perl-date-manip' 'perl-dbd-mysql' 'perl-device-serialport' 'perl-file-slurp' 'perl-image-info'
'perl-json-any' 'perl-libwww' 'perl-mime-lite' 'perl-mime-tools' 'perl-number-bytes-human' 'perl-sys-meminfo' 'perl-sys-mmap'
@@ -74,7 +74,8 @@ source=("https://github.com/ZoneMinder/ZoneMinder/archive/$pkgver.tar.gz"
"zoneminder-httpd.conf"
"zoneminder-php.ini"
"zoneminder.service"
- "zoneminder-tmpfile.conf")
+ "zoneminder-tmpfile.conf"
+ "fcgiwrap-multiwatch.service")
sha256sums=('cf72cbd45d91ef0232c123dac5f908993f8941a62b9ae96975c4e6043bd4b9a9'
'55be29e1eccb44d4ad0db8b23c37cec50f5341f8e498583d472ed1f0493876e3'
'dbd231e97b950c698f0f501d6a53c7291c9985e766b09e3afe00cfe69a969f44'
@@ -87,7 +88,9 @@ sha256sums=('cf72cbd45d91ef0232c123dac5f908993f8941a62b9ae96975c4e6043bd4b9a9'
# zoneminder.service
'3e4de227e3154dffa887f2286c339ab3cf456f6d74a400b2786192b7e2b129c0'
# zoneminder-tmpfile.conf
- 'b69ac1deaaf3cf84b4ae4dbab794e1b062823de817f1e3a816ccf5438db440c0')
+ 'b69ac1deaaf3cf84b4ae4dbab794e1b062823de817f1e3a816ccf5438db440c0'
+ # fcgiwrap-multiwatch.service
+ 'e95f9bef77aef647dd633bd9ad75dc099b6d7184684e133f2f20702de83a6260')
prepare () {
cd $pkgname-$pkgver
@@ -151,23 +154,26 @@ package() {
chmod 644 $pkgdir/etc/$pkgname/conf.d/*
# Install Nginx conf file
- install -Dm644 $srcdir/$pkgname-nginx.conf $pkgdir/etc/nginx/sites-available/$pkgname.conf
+ install -Dm644 $srcdir/$pkgname-nginx.conf $pkgdir/etc/nginx/sites-available/$pkgname.conf
# Install Apache conf file
- install -Dm644 $srcdir/$pkgname-httpd.conf $pkgdir/etc/httpd/conf/extra/$pkgname.conf
+ install -Dm644 $srcdir/$pkgname-httpd.conf $pkgdir/etc/httpd/conf/extra/$pkgname.conf
# Install PHP-FPM ini file
- install -Dm644 $srcdir/$pkgname-php.ini $pkgdir/etc/php/conf.d/$pkgname.ini
+ install -Dm644 $srcdir/$pkgname-php.ini $pkgdir/etc/php/conf.d/$pkgname.ini
# Install systemd service
- install -Dm644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
+ install -Dm644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
# Install systemd tmpfile
- install -Dm644 $srcdir/$pkgname-tmpfile.conf $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf
+ install -Dm644 $srcdir/$pkgname-tmpfile.conf $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf
+
+ # Install fcgiwrap-multiwatch service
+ install -Dm644 $srcdir/fcgiwrap-multiwatch.service $pkgdir/usr/lib/systemd/system/fcgiwrap-multiwatch.service
# Install logrotate conf file
- install -Dm644 misc/logrotate.conf $pkgdir/etc/logrotate.d/$pkgname
+ install -Dm644 misc/logrotate.conf $pkgdir/etc/logrotate.d/$pkgname
# Copy default database schemas
- install -Dm644 db/zm*.sql $pkgdir/usr/share/$pkgname/db
+ install -Dm644 db/zm*.sql $pkgdir/usr/share/$pkgname/db
}
diff --git a/fcgiwrap-multiwatch.service b/fcgiwrap-multiwatch.service
new file mode 100644
index 000000000000..504e4a465802
--- /dev/null
+++ b/fcgiwrap-multiwatch.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Simple CGI server launched in multiple parallel instances via spawn-fcgi and multiwatch
+After=nss-user-lookup.target
+Conflicts=fcgiwrap.socket
+
+[Service]
+ExecStartPre=/usr/bin/rm -f /run/fcgiwrap.sock
+ExecStart=/usr/bin/spawn-fcgi -n -s /run/fcgiwrap.sock -u http -g http -M 660 -- /usr/bin/multiwatch -f 10 -- /usr/bin/fcgiwrap
+ExecStop=/usr/bin/killall -w -s 2 /usr/bin/fcgiwrap
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/zoneminder.install b/zoneminder.install
index 53d1478c82b3..0f294577ea0a 100644
--- a/zoneminder.install
+++ b/zoneminder.install
@@ -78,7 +78,18 @@ post_install() {
then
systemctl is-active --quiet fcgiwrap.socket && systemctl stop fcgiwrap.socket
systemctl is-active --quiet fcgiwrap && systemctl stop fcgiwrap
- systemctl start fcgiwrap.socket
+ systemctl is-active --quiet fcgiwrap-multiwatch && systemctl stop fcgiwrap-multiwatch
+ systemctl start fcgiwrap-multiwatch &&
+ {
+ echo "---------------"
+ echo
+ echo "fcgiwrap has been launched in multiple parallel instances via spawn-fcgi and multiwatch."
+ echo
+ echo "The default number of 10 instances should be enough for ZoneMinder to operate with 2 or 3 cameras"
+ echo "under normal circumstances. If you need more than 10 simultaneous CGI threads, edit the provided"
+ echo "fcgiwrap-multiwatch.service file and increase the number of instances to whatever suits your needs."
+ echo
+ }
fi
@@ -118,11 +129,11 @@ post_install() {
if [[ "$(mysql -uroot -e "select * from mysql.user;" 2>&1)" = *"Access denied"* ]]
then
# If a database root password is set
- echo \* Secure MariaDB installation found, please enter the database root password.
+ echo "* Secure MariaDB installation found, please enter the database root password."
echo
mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
echo
- echo \* Enter the password one more time...
+ echo "* Enter the password one more time..."
echo
mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"
echo
@@ -139,29 +150,27 @@ post_install() {
systemctl is-active --quiet zoneminder && systemctl stop zoneminder
systemd-tmpfiles --create
- systemctl start zoneminder
-
-
- echo ---------------
+ systemctl start zoneminder &&
+ {
+ echo "---------------"
echo
if [[ "$(systemctl is-active nginx)" = active ]] || [[ "$(systemctl is-active httpd)" = active ]]
then
- echo ZoneMinder is listening at http://localhost:8095
+ echo "ZoneMinder is listening at http://localhost:8095"
else
- echo WARNING: No web server has been configured.
+ echo "WARNING: ZoneMinder is running, but no web server has been configured."
fi
-
echo
+ }
}
post_upgrade() {
post_install
- echo ---------------
+ echo "---------------"
echo
-
- echo The ZoneMinder updater will now run.
+ echo "The ZoneMinder updater will now run."
# Make sure ZoneMinder is *not* running before we attempt to use the updater
systemctl is-active --quiet zoneminder && systemctl stop zoneminder
@@ -176,7 +185,7 @@ post_upgrade() {
systemctl start zoneminder
- echo Update complete.
+ echo "Update complete."
echo
}
@@ -206,12 +215,12 @@ post_remove() {
if [ -d /var/lib/mysql/zm ]
then
echo
- echo ZoneMinder\'s database and user have been left intact. You can remove them by running the following:
+ echo "ZoneMinder's database and user have been left intact. You can remove them by running the following:"
echo
- echo mysql -uroot -p -e \"drop database zm\;\"
- echo mysql -uroot -p -e \"drop user \'zmuser\'@localhost\;\"
+ echo "mysql -uroot -p -e \"drop database zm;\""
+ echo "mysql -uroot -p -e \"drop user 'zmuser'@localhost;\""
echo
- echo If you haven\'t yet configured a password for the database root user, omit the \'-p\' option.
+ echo "If you haven't yet configured a password for the database root user, omit the '-p' option."
echo
fi
}