diff --git a/.gitignore b/.gitignore index e2b8eef..772fc7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /README.rpm /iipsrv-1.0.0-0b63de7.tar.gz +/iipsrv-1.0.0-2431b45.tar.gz diff --git a/iipsrv-httpd.conf b/iipsrv-httpd.conf index 2ddc24d..a139141 100644 --- a/iipsrv-httpd.conf +++ b/iipsrv-httpd.conf @@ -1,10 +1,10 @@ ScriptAlias /iipsrv /usr/libexec/iipsrv/iipsrv.fcgi # Set our environment variables for the IIP server -DefaultInitEnv VERBOSITY "5" +DefaultInitEnv VERBOSITY "1" DefaultInitEnv LOGFILE "/var/log/httpd/iipsrv.log" DefaultInitEnv MAX_IMAGE_CACHE_SIZE "10" -DefaultInitEnv JPEG_QUALITY "50" +DefaultInitEnv JPEG_QUALITY "90" DefaultInitEnv MAX_CVT "3000" # Define the idle timeout as unlimited and the number of # processes we want diff --git a/iipsrv.initd.conf b/iipsrv.initd.conf index 4b27c6e..cfe35e3 100644 --- a/iipsrv.initd.conf +++ b/iipsrv.initd.conf @@ -3,6 +3,7 @@ IP=127.0.0.1 PORT=9002 #Some other variables can be declared here. See documentation. -#export VERBOSITY=5 +export VERBOSITY=1 +export LOGFILE=/var/log/iipsrv/iipsrv.log #export MEMCACHED_SERVERS=localhost #export WATERMARK=/tmp/watermark.tif diff --git a/iipsrv.service b/iipsrv.service index b440527..2efb154 100644 --- a/iipsrv.service +++ b/iipsrv.service @@ -21,6 +21,8 @@ After=network.target [Service] Environment=IP=127.0.0.1 Environment=PORT=9002 +Environment=LOGFILE=/var/log/iipsrv/iipsrv.log +Environment=VERBOSITY=1 User=iipsrv ExecStart=/usr/libexec/iipsrv/iipsrv.fcgi --bind ${IP}:${PORT} diff --git a/iipsrv.spec b/iipsrv.spec index e375835..485d017 100644 --- a/iipsrv.spec +++ b/iipsrv.spec @@ -1,4 +1,4 @@ -%global commit 0b63de7ac7519f8d0f21a040c087a7d11c6eb59b +%global commit 2431b455f46649d1b079d1e76a14a573cb4c9153 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %if 0%{?fedora} >= 18 @@ -8,21 +8,28 @@ %endif %{!?_initddir: %{expand: %%global _initddir %{_initrddir}}} +%if %{?fedora}%{?rhel} >= 5 +%global useselinux 1 +%else +%global useselinux 0 +%endif + Name: iipsrv Version: 1.0.0 -Release: 0.9.git%{shortcommit}%{?dist} +Release: 1.0.git%{shortcommit}%{?dist} Summary: Light-weight streaming for viewing and zooming of ultra high-resolution images Group: Applications/Multimedia License: GPLv3+ URL: http://iipimage.sourceforge.net Source0: https://github.com/ruven/%{name}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz -Source1: iipsrv-httpd.conf +Source1: %{name}-httpd.conf Source2: README.rpm -Source10: iipsrv.service -Source11: iipsrv.initd -Source12: iipsrv.initd.conf -Patch0: iipsrv-remove-bundled-fcgi.patch +Source3: %{name}-logrotate +Source10: %{name}.service +Source11: %{name}.initd +Source12: %{name}.initd.conf +Patch0: %{name}-remove-bundled-fcgi.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: zlib-devel @@ -53,6 +60,15 @@ Requires(preun): chkconfig Requires(preun): initscripts Requires(postun): initscripts %endif +Requires: %{_sysconfdir}/logrotate.d + +%if %{useselinux} +Requires(post): /sbin/service +Requires(post): /sbin/restorecon +Requires(post): /usr/sbin/semanage +Requires(postun): /usr/sbin/semanage +BuildRequires: selinux-policy-devel, checkpolicy +%endif %description @@ -148,12 +164,26 @@ mkdir -p $RPM_BUILD_ROOT%{_initddir} install -m755 %{SOURCE11} $RPM_BUILD_ROOT%{_initddir}/%{name} %endif +#log stuff +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name} +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d +install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name} + %clean rm -rf $RPM_BUILD_ROOT %post httpd-fcgi +%if %{useselinux} +( +# File context +semanage fcontext -a -s system_u -t httpd_log_t -r s0 "%{_localstatedir}/log/%{name}(/.*)?" +# files created by app +restorecon -R %{_localstatedir}/log/%{name} +) &>/dev/null +%endif + %if %{with_systemd} /bin/systemctl condrestart httpd.service %else @@ -197,6 +227,18 @@ fi %endif +%postun httpd-fcgi +%if %{useselinux} +if [ "$1" -eq "0" ]; then + # Remove the File Context + ( + semanage fcontext -d "%{_localstatedir}/log/%{name}(/.*)?" + ) &>/dev/null +fi +%endif +/sbin/service httpd condrestart > /dev/null 2>&1 || : + + %files %defattr(-,root,root,-) %doc README AUTHORS ChangeLog TODO COPYING doc/* README.rpm @@ -208,6 +250,8 @@ fi %config(noreplace) %{_sysconfdir}/sysconfig/%{name} %endif %{_mandir}/man8/%{name}.8.gz +%dir %{_localstatedir}/log/%{name} +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %files httpd-fcgi @@ -216,6 +260,12 @@ fi %changelog +* Fri Jun 13 2014 Johan Cwiklinski - 1.0.0-1.0.git2431b45 +- Update to latest git commit +- Add specific log directory and logrotate stuff +- Change default VERBOSITY, JPEG_QUALITY to better values +- Set SELinux contexts for log files when installing httpd-fcgi subpackage + * Sat Jun 07 2014 Fedora Release Engineering - 1.0.0-0.9.git0b63de7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild @@ -237,7 +287,7 @@ fi * Wed May 22 2013 Johan Cwiklinski - 1.0.0-0.6.git0b63de7 - Systemd configuration directives are now handled in unit file -* Sun May 20 2013 Johan Cwiklinski - 1.0.0-0.5.git0b63de7 +* Sun May 19 2013 Johan Cwiklinski - 1.0.0-0.5.git0b63de7 - Add SysV service files * Sun May 19 2013 Johan Cwiklinski - 1.0.0-0.4.git0b63de7 diff --git a/sources b/sources index 9f6b455..8ac6e70 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ -ee31ce137a5ab78b5a4282ca0c18497f README.rpm -212dc98a13d86387b8bf12d619eb9aac iipsrv-1.0.0-0b63de7.tar.gz +806c245db32f5869367691198e5268f6 iipsrv-1.0.0-2431b45.tar.gz