diff --git a/packages/foreman/foreman/dynflow.sysconfig b/packages/foreman/foreman/dynflow.sysconfig deleted file mode 100644 index 3289b4c9eb..0000000000 --- a/packages/foreman/foreman/dynflow.sysconfig +++ /dev/null @@ -1,2 +0,0 @@ -RAILS_ENV="production" -DYNFLOW_SIDEKIQ_SCRIPT="/usr/foreman/script/dynflow-sidekiq.rb" diff --git a/packages/foreman/foreman/dynflow@.service b/packages/foreman/foreman/dynflow@.service deleted file mode 100644 index 36aa743047..0000000000 --- a/packages/foreman/foreman/dynflow@.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Foreman jobs daemon on sidekiq -Documentation=https://theforeman.org -After=network.target remote-fs.target nss-lookup.target - -[Service] -Type=forking -User=foreman -TimeoutSec=90 -ExecStart=/usr/bin/bundle exec sidekiq -e ${RAILS_ENV} -r ${DYNFLOW_SIDEKIQ_SCRIPT} -C /etc/dynflow/%i.yml -WorkingDirectory=/usr/share/foreman -EnvironmentFile=-/etc/sysconfig/dynflow - -[Install] -WantedBy=multi-user.target diff --git a/packages/foreman/foreman/foreman.spec b/packages/foreman/foreman/foreman.spec index 778a9ed746..de55401ad4 100644 --- a/packages/foreman/foreman/foreman.spec +++ b/packages/foreman/foreman/foreman.spec @@ -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 @@ -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 @@ -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