Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #28065 - package dynflow sidekiq service files #4194

Merged
merged 2 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions comps/comps-foreman-rhel7.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<packagereq type="default">foreman-cli</packagereq>
<packagereq type="default">foreman-console</packagereq>
<packagereq type="default">foreman-debug</packagereq>
<packagereq type="default">foreman-dynflow-sidekiq</packagereq>
<packagereq type="default">foreman-ec2</packagereq>
<packagereq type="default">foreman-gce</packagereq>
<packagereq type="default">foreman-journald</packagereq>
Expand Down
42 changes: 41 additions & 1 deletion packages/foreman/foreman/foreman.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +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-sidekiq@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the repetition I'm inclined to add .service here but I'm fine either way. I'd probably do a cleanup of all service handling later anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to stay consistent with the dynflowd service, otherwise I would agree 🤔

%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 @@ -10,7 +11,7 @@
%global scl_ruby_bin /usr/bin/%{?scl:%{scl_prefix}}ruby
%global scl_rake /usr/bin/%{?scl:%{scl_prefix}}rake

%global release 10
%global release 11
%global prerelease develop

Name: foreman
Expand Down Expand Up @@ -707,6 +708,33 @@ Meta Package to install requirements for Redis caching support
%files redis
%{_datadir}/%{name}/bundler.d/redis.rb

%package dynflow-sidekiq
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this package conflict with the regular dynflow service? Can both run at the same time? What happens if they do? Is the new dynflow-sidekiq optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it doesn't conflict, and it is not trying to remove it, if someone runs both, they will share the load and loadbalance.
dynflow-sidekiq is installed in installer only if the option is turned on (theforeman/puppet-foreman#761) so yes, it's optional.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the singleton nature of the dynflow sidekiq orchestrator play well with the current dynflow executor if both are deployed simultaneously?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that doesn't really matter, the separation is not really affecting the old deployment.

Summary: Foreman Redis caching support
Group: Applications/System
ezr-ondrej marked this conversation as resolved.
Show resolved Hide resolved
# start specfile redis Requires
Requires: %{?scl_prefix}rubygem(sidekiq) >= 5.0
Requires: %{?scl_prefix}rubygem(sidekiq) < 6
Requires: %{?scl_prefix}rubygem(gitlab-sidekiq-fetcher)
ezr-ondrej marked this conversation as resolved.
Show resolved Hide resolved
# end specfile redis Requires
Requires: %{name} = %{version}-%{release}

%description dynflow-sidekiq
Meta Package to install dynflow sidekiq executor support

%files dynflow-sidekiq
%{_datadir}/%{name}/bundler.d/dynflow_sidekiq.rb
%{_unitdir}/%{dynflow_sidekiq_service_name}.service
%{_datadir}/%{name}/extras/dynflow-sidekiq.rb

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

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

%postun dynflow-sidekiq
%systemd_postun_with_restart %{dynflow_sidekiq_service_name}.service

%package service
Summary: Foreman systemd service support
Group: Applications/System
Expand Down Expand Up @@ -782,6 +810,7 @@ install -d -m0755 %{buildroot}%{_datadir}/%{name}
install -d -m0755 %{buildroot}%{_datadir}/%{name}/plugins
install -d -m0755 %{buildroot}%{_sysconfdir}/%{name}
install -d -m0755 %{buildroot}%{_sysconfdir}/%{name}/plugins
install -d -m0755 %{buildroot}%{_sysconfdir}/%{name}/dynflow
install -d -m0755 %{buildroot}%{_localstatedir}/lib/%{name}
install -d -m0755 %{buildroot}%{_localstatedir}/lib/%{name}/tmp
install -d -m0755 %{buildroot}%{_localstatedir}/lib/%{name}/tmp/pids
Expand All @@ -791,6 +820,7 @@ install -d -m0750 %{buildroot}%{_localstatedir}/log/%{name}/plugins
#Copy init scripts and sysconfigs
install -Dp -m0644 %{SOURCE10} %{buildroot}%{_sysconfdir}/sysconfig/%{executor_service_name}
install -Dp -m0644 %{SOURCE11} %{buildroot}%{_unitdir}/%{executor_service_name}.service
install -Dp -m0644 extras/systemd/%{dynflow_sidekiq_service_name}.service %{buildroot}%{_unitdir}/%{dynflow_sidekiq_service_name}.service
install -Dp -m0755 script/%{executor_service_name} %{buildroot}%{_sbindir}/%{executor_service_name}
install -Dp -m0755 script/%{name}-debug %{buildroot}%{_sbindir}/%{name}-debug
install -Dp -m0755 script/%{name}-rake %{buildroot}%{_sbindir}/%{name}-rake
Expand All @@ -801,6 +831,7 @@ install -Dp -m0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/cron.d/%{name}
install -Dp -m0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf
install -Dp -m0644 extras/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service

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

cp -p Gemfile.in %{buildroot}%{_datadir}/%{name}/Gemfile.in
Expand All @@ -823,6 +854,12 @@ mv %{buildroot}%{_datadir}/%{name}/config/$i %{buildroot}%{_sysconfdir}/%{name}
ln -sv %{_sysconfdir}/%{name}/$i %{buildroot}%{_datadir}/%{name}/config/$i
done

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

# Put db in %{_localstatedir}/lib/%{name}/db
cp -pr db/migrate db/seeds.rb db/seeds.d %{buildroot}%{_datadir}/%{name}
mkdir %{buildroot}%{_localstatedir}/lib/%{name}/db
Expand Down Expand Up @@ -1047,6 +1084,9 @@ exit 0
%systemd_postun_with_restart %{name}.service

%changelog
* Tue Oct 22 2019 Ondrej Ezr <ezrik12@gmail.com> - 1.24.0-0.11.develop
- Add dynflow-sidekiq package providing services for running dynflow on sidekiq

* Fri Oct 11 2019 Eric D. Helms <ericdhelms@gmail.com> - 1.24.0-0.10.develop
- Updates to support NodeJS packages built into SCL

Expand Down