From d46ef5b9a2780e6faa03ff2de798c587b2ef48d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Sun, 14 Sep 2014 18:18:42 +0200 Subject: [PATCH] systemd support. --- README.Fedora | 5 +++-- rOCCI-server.spec | 12 ++++++++++++ rOCCI-server.target | 9 +++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 rOCCI-server.target diff --git a/README.Fedora b/README.Fedora index bfe5078..dea3a1d 100644 --- a/README.Fedora +++ b/README.Fedora @@ -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. diff --git a/rOCCI-server.spec b/rOCCI-server.spec index c386c73..f87b8e5 100644 --- a/rOCCI-server.spec +++ b/rOCCI-server.spec @@ -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 index 0000000..485a44a --- /dev/null +++ b/rOCCI-server.target @@ -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 -- 1.8.2.3