-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add support for dynflow_sidekiq #292
Changes from all commits
f1be5be
0753000
64146d7
1f24eb6
194351c
bb9c27c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
class Features::DynflowSidekiq < ForemanMaintain::Feature | ||
metadata do | ||
label :dynflow_sidekiq | ||
|
||
confine do | ||
server? && find_package('foreman-dynflow-sidekiq') | ||
end | ||
end | ||
|
||
def services | ||
service_names.map { |service| system_service service, instance_priority(service) } | ||
end | ||
|
||
def config_files | ||
# Workaround until foreman-installer can deploy scaled workers | ||
service_symlinks = configured_services.map do |service| | ||
"/etc/systemd/system/multi-user.target.wants/#{service}.service" | ||
end | ||
[ | ||
'/etc/foreman/dynflow', | ||
service_symlinks | ||
].flatten | ||
end | ||
|
||
private | ||
|
||
def instance_priority(instance) | ||
# Orchestrator should be started before the workers are | ||
instance.end_with?('@orchestrator') ? 30 : 31 | ||
end | ||
|
||
def service_names | ||
configured_instances.map { |instance| "dynflow-sidekiq@#{instance}" } | ||
end | ||
|
||
def configured_instances | ||
Dir['/etc/foreman/dynflow/*'].map { |config| File.basename(config, '.yml') } | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
class Features::Redis < ForemanMaintain::Feature | ||
metadata do | ||
label :redis | ||
|
||
confine do | ||
# Luckily, the service name is the same as the package providing it | ||
server? && find_package(service_name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given block passed as argument to Either you can declare one more constant or use "#{SCL_NAME}-redis" directly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, forgot about that. Fixed in a slightly different way |
||
end | ||
end | ||
|
||
def services | ||
[system_service(self.class.service_name, 10)] | ||
end | ||
|
||
def config_files | ||
%w[redis redis.conf].map { |config| File.join(self.class.etc_prefix, config) } | ||
end | ||
|
||
class << self | ||
SCL_NAME = 'rh-redis5'.freeze | ||
|
||
def etc_prefix | ||
"/etc/opt/rh/#{SCL_NAME}" | ||
end | ||
|
||
def scl_prefix | ||
"#{SCL_NAME}-" | ||
end | ||
|
||
def service_name | ||
"#{scl_prefix}redis" | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean rest of things from feature
foreman_tasks
remain as it is and only services get changed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK foreman-tasks hasn't had a service ever since dynflowd was introduced. dynflowd is part of Foreman itself while foreman-tasks is an optional plugin. dynflowd.service always had the alias foreman-tasks so
systemctl status foreman-tasks
continued to work.