Skip to content
Open
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
23 changes: 16 additions & 7 deletions manifests/dynflow/worker.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
#
# @api private
define foreman::dynflow::worker (
Enum['present', 'absent'] $ensure = 'present',
String $service_name = $name,
Integer[1] $concurrency = 1,
Array[Variant[String[1], Tuple[String, Integer[0]]]] $queues = [],
String[1] $config_owner = 'root',
Optional[String[1]] $config_group = undef,
Stdlib::Filemode $config_mode = '0644',
Enum['present', 'absent'] $ensure = 'present',
String $service_name = $name,
Integer[1] $concurrency = 1,
Array[Variant[String[1], Tuple[String, Integer[0]]]] $queues = [],
String[1] $config_owner = 'root',
Optional[String[1]] $config_group = undef,
Stdlib::Filemode $config_mode = '0644',
) {
$filename = "/etc/foreman/dynflow/${service_name}.yml"
$service = "dynflow-sidekiq@${service_name}"
Expand All @@ -39,6 +39,15 @@
'queues' => $queues,
}

systemd::dropin_file { "${service}-service":
filename => 'dependencies.conf',
unit => "${service}.service",
content => epp("${module_name}/dynflow-sidekiq-overrides.conf.epp", {
redis_host => $foreman::dynflow_redis_url,
}),
notify_service => true,
}

file { $filename:
ensure => file,
owner => $config_owner,
Expand Down
22 changes: 22 additions & 0 deletions spec/classes/foreman_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,28 @@
end
end

describe 'with custom redis for dynflow' do
context 'with redis_url for dynflow' do
let(:params) do
super().merge(
dynflow_redis_url: 'redis://127.0.0.1:6379/7',
rails_cache_store: {type: 'file'}
)
end

it { should_not contain_class('redis') }
it { should_not contain_class('redis::instance') }
it do
is_expected.to contain_file('/etc/systemd/system/[email protected]/dependencies.conf')
.with_content(/^.*redis:\/\/127\.0\.0\.1:6379\/7.*$/)
end
it do
is_expected.to contain_file('/etc/systemd/system/[email protected]/dependencies.conf')
.with_content(/^.*redis:\/\/127\.0\.0\.1:6379\/7.*$/)
end
end
end

describe 'with non-Puppet SSL certificates' do
let(:params) do
super().merge(
Expand Down
15 changes: 15 additions & 0 deletions templates/dynflow-sidekiq-overrides.conf.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%- |
Optional[Redis::RedisUrl] $redis_host,
| -%>

# This file is managed by Puppet

[Service]
User=<%= $foreman::user %>
Environment=RAILS_ENV=<%= $foreman::rails_env %>
<% if $redis_host { -%>
Environment=DYNFLOW_REDIS_URL=<%= $redis_host %>
<% } -%>
<% else { -%>
Environment=DYNFLOW_REDIS_URL=redis://localhost:6379/6
<% } -%>