Skip to content

Commit

Permalink
install sidekiq config files
Browse files Browse the repository at this point in the history
  • Loading branch information
ezr-ondrej committed Oct 20, 2019
1 parent 0f691e1 commit 0e64cd8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
2 changes: 0 additions & 2 deletions packages/foreman/foreman/dynflow.sysconfig

This file was deleted.

15 changes: 0 additions & 15 deletions packages/foreman/foreman/dynflow@.service

This file was deleted.

31 changes: 22 additions & 9 deletions packages/foreman/foreman/foreman.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%global confdir extras/packaging/rpm/sources
%global foreman_rake %{_sbindir}/%{name}-rake
%global executor_service_name dynflowd
%global dynflow_sidekiq_service_name dynflow
%global dynflow_sidekiq_service_name dynflow-sidekiq@
%global foreman_restart (touch %{homedir}/tmp/restart.txt ; /bin/systemctl try-restart %{name}.service) >/dev/null 2>&1

# explicitly define, as we build on top of an scl, not inside with scl_package
Expand All @@ -28,8 +28,7 @@ Source4: %{name}.cron.d
Source5: %{name}.tmpfiles
Source10: %{executor_service_name}.sysconfig
Source11: %{executor_service_name}.service
Source12: %{dynflow_sidekiq_service_name}.sysconfig
Source13: %{dynflow_sidekiq_service_name}@.service
Source12: extras/systemd/%{dynflow_sidekiq_service_name}.service
BuildArch: noarch

Conflicts: foreman-tasks < 0.11.0-2
Expand Down Expand Up @@ -717,25 +716,39 @@ Meta Package to install requirements for Redis caching support
%package dynflow-sidekiq
Summary: Foreman Redis caching support
Group: Applications/System
# start specfile redis Requires
Requires: %{?scl_prefix}rubygem(sidekiq) >= 5.0
Requires: %{?scl_prefix}rubygem(sidekiq) < 6
Requires: %{?scl_prefix}rubygem(gitlab-sidekiq-fetcher)
# end specfile redis Requires
Requires: %{name} = %{version}-%{release}

%description dynflow-sidekiq
Meta Package to install requirements for Redis caching support
Meta Package to install dynflow sidekiq executor support

%files dynflow-sidekiq
%{_datadir}/%{name}/bundler.d/sidekiq.rb
%config(noreplace) %{_sysconfdir}/sysconfig/%{dynflow_sidekiq_service_name}
%{_unitdir}/%{dynflow_sidekiq_service_name}@.service
%{_unitdir}/%{dynflow_sidekiq_service_name}.service
%{_datadir}/%{name}/script/dynflow-sidekiq.rb

%install dynflow-sidekiq
install -Dp -m0644 %{SOURCE12} %{buildroot}%{_sysconfdir}/sysconfig/%{dynflow_sidekiq_service_name}
install -Dp -m0644 %{SOURCE13} %{buildroot}%{_unitdir}/%{dynflow_sidekiq_service_name}@.service
install -Dp -m0644 extras/systemd/%{dynflow_sidekiq_service_name}.service %{buildroot}%{_unitdir}/%{dynflow_sidekiq_service_name}.service

sed -i '/^ExecStart/ s|/usr/bin/sidekiq \(.\+\)$|/usr/bin/scl enable tfm "sidekiq \1"|' %{buildroot}%{_unitdir}/%{dynflow_sidekiq_service_name}.service

for i in orchestrator.yml worker.yml; do
mv %{buildroot}%{_datadir}/%{name}/config/dynflow/$i %{buildroot}%{_sysconfdir}/%{name}/dynflow/
ln -sv %{_sysconfdir}/%{name}/$i %{buildroot}%{_datadir}/%{name}/config/$i
done

%post dynflow-sidekiq
%systemd_post %{dynflow_sidekiq_service_name}.service

%preun dynflow-sidekiq
%systemd_preun %{dynflow_sidekiq_service_name}.service

sed -i '/^ExecStart/ s|/usr/bin/bundle \(.\+\)$|/usr/bin/scl enable tfm "bundle \1"|' %{buildroot}%{_unitdir}/%{dynflow_sidekiq_service_name}@.service
%postun dynflow-sidekiq
%systemd_postun_with_restart %{dynflow_sidekiq_service_name}.service

%package service
Summary: Foreman systemd service support
Expand Down

0 comments on commit 0e64cd8

Please sign in to comment.