-
Notifications
You must be signed in to change notification settings - Fork 71
/
dynflow_sidekiq.rb
39 lines (32 loc) · 982 Bytes
/
dynflow_sidekiq.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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