systemd support.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Sun, 14 Sep 2014 16:18:42 +0000 (18:18 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Sun, 14 Sep 2014 16:18:42 +0000 (18:18 +0200)
README.Fedora
rOCCI-server.spec
rOCCI-server.target [new file with mode: 0644]

index bfe5078..dea3a1d 100644 (file)
@@ -1,9 +1,10 @@
 Machine certificate is required in /etc/grid-security.
 
-Start both daemons:
-
+Start required daemons:
   service memcached start
   service httpd start
+or:
+  systemctl start rOCCI-server.target
 
 By default only dummy backend is activated.
 
index c386c73..f87b8e5 100644 (file)
@@ -18,6 +18,7 @@ Source1:        %{semodule_name}.te
 Source2:        %{semodule_name}.fc
 Source3:        %{name}.logrotate
 Source4:        README.Fedora
+Source5:        %{name}.target
 # kill bundler
 # (not intended for upstream)
 Patch0:         rocci-server-unbundle.diff
@@ -29,13 +30,17 @@ BuildRequires:  policycoreutils-python
 BuildRequires:  ruby(release) >= 1.9.3
 BuildRequires:  rubygems-devel
 BuildRequires:  rubygem(rdoc)
+BuildRequires:  systemd
 # tests (plus all runtimes)
 #BuildRequires:  rubygem(rspec)
 #BuildRequires:  rubygem(rspec-rails)
 Requires(pre):  shadow-utils
 Requires(post): policycoreutils
+Requires(post): systemd
 Requires(preun): policycoreutils
+Requires(preun): systemd
 Requires(postun): policycoreutils
+Requires(postun): systemd
 Requires:       logrotate
 Requires:       memcached
 Requires:       mod_passenger
@@ -190,6 +195,8 @@ install -p -m 0644 examples/etc/apache2/sites-available/occi-ssl %{buildroot}%{_
 echo "Listen 11443" >>  %{buildroot}%{_sysconfdir}/httpd/conf.d/occi-listen.conf
 install -p -m 0644 examples/etc/apache2/conf.d/security %{buildroot}%{_sysconfdir}/httpd/conf.d/occi-security.conf
 
+mkdir -p %{buildroot}%{_unitdir}
+install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}
 
 # Upstream testsuite fails:
 #254 examples, 29 failures, 13 pending
@@ -207,18 +214,22 @@ if [ "$1" -le "1" ] ; then # First install
   restorecon -R %{app_root} %{_localstatedir}/log/rocci-server 2>/dev/null || :
   semanage port -a -t http_port_t -p tcp 11443 2>/dev/null || :
 fi
+%systemd_post %{name}.target
 
 %preun
 if [ "$1" -lt "1" ] ; then # Final removal
   semodule -r %{semodule_name} 2>/dev/null || :
   semanage port -d -t http_port_t -p tcp 11443 2>/dev/null || :
 fi
+%systemd_preun %{name}.target
 
 %postun
 if [ "$1" -ge "1" ] ; then # Upgrade
   semodule -i %{_datadir}/selinux/packages/%{name}/%{semodule_name}.pp 2>/dev/null || :
   restorecon -R %{app_root} %{_localstatedir}/log/rocci-server 2>/dev/null || :
 fi
+# rOCCI-server.target doesn't support restarting, use httpd instead
+%systemd_postun httpd.service
 
 
 %files
@@ -254,6 +265,7 @@ fi
 %{app_root}/config.ru
 %attr(-,rocci,rocci) %{_localstatedir}/log/rocci-server/
 %{_datadir}/selinux/packages/%{name}/%{semodule_name}.pp
+%{_unitdir}/%{name}.target
 %exclude %{app_root}/bin/
 %exclude %{app_root}/.bundle/
 %exclude %{app_root}/.rspec
diff --git a/rOCCI-server.target b/rOCCI-server.target
new file mode 100644 (file)
index 0000000..485a44a
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=Ruby OCCI Server
+Documentation=https://github.com/EGI-FCTF/rOCCI-server/wiki/rOCCI-Server-Admin-Guide
+After=memcached.service httpd.service
+BindsTo=memcached.service httpd.service
+
+[Install]
+Also=memcached.service httpd.service
+WantedBy=multi-user.target