Skip to content

Commit

Permalink
run foreman in a container
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed May 14, 2024
1 parent a5a5a8e commit 5d8eb38
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ fixtures:
concat: 'https://github.com/puppetlabs/puppetlabs-concat'
cron_core: 'https://github.com/puppetlabs/puppetlabs-cron_core'
extlib: 'https://github.com/voxpupuli/puppet-extlib'
podman:
repo: 'https://github.com/traylenator/podman'
branch: 'quadlet'
postgresql: 'https://github.com/puppetlabs/puppetlabs-postgresql'
puppet: 'https://github.com/theforeman/puppet-puppet'
redis: 'https://github.com/voxpupuli/puppet-redis'
Expand Down
12 changes: 2 additions & 10 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
}

if $foreman::apache {
$listen_socket = '/run/foreman.sock'
$listen_socket = 'localhost:3000'

class { 'foreman::config::apache':
app_root => $foreman::app_root,
Expand All @@ -154,7 +154,7 @@
serveraliases => $foreman::serveraliases,
server_port => $foreman::server_port,
server_ssl_port => $foreman::server_ssl_port,
proxy_backend => "unix://${listen_socket}",
proxy_backend => "http://${listen_socket}",
ssl => $foreman::ssl,
ssl_ca => $foreman::server_ssl_ca,
ssl_chain => $foreman::server_ssl_chain,
Expand Down Expand Up @@ -265,12 +265,4 @@
} else {
$foreman_socket_override = undef
}

systemd::dropin_file { 'foreman-socket':
ensure => bool2str($foreman_socket_override =~ Undef, 'absent', 'present'),
filename => 'installer.conf',
unit => "${foreman::foreman_service}.socket",
content => $foreman_socket_override,
notify_service => true,
}
}
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
Optional[String[1]] $db_sslmode = undef,
Optional[String[1]] $db_root_cert = undef,
Integer[0] $db_pool = 5,
Boolean $db_manage_rake = true,
Boolean $db_manage_rake = false,
Stdlib::Port $server_port = 80,
Stdlib::Port $server_ssl_port = 443,
Stdlib::Absolutepath $server_ssl_ca = $foreman::params::server_ssl_ca,
Expand Down
28 changes: 19 additions & 9 deletions manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,24 @@
}
}

service { "${foreman_service}.socket":
ensure => $foreman_service_ensure,
enable => $foreman_service_enable,
}

service { $foreman_service:
ensure => $foreman_service_ensure,
enable => $foreman_service_enable,
before => Service["${foreman_service}.socket"],
podman::quadlet { 'foreman.container':
ensure => present,
unit_entry => {
'Description' => 'Foreman',
},
service_entry => {
'TimeoutStartSec' => '900',
},
container_entry => {
'Image' => 'quay.io/evgeni/foreman-rpm:latest',
'PublishPort' => ['0.0.0.0:3000:3000'],
'Volume' => ['/etc/foreman/:/etc/foreman/'],
'AddCapability' => ['CAP_DAC_OVERRIDE', 'CAP_IPC_OWNER'],
'Network' => 'host',
},
install_entry => {
'WantedBy' => 'default.target',
},
active => true,
}
}
4 changes: 4 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
{
"name": "puppet/redis",
"version_requirement": ">= 5.0.0 < 12.0.0"
},
{
"name": "southalc/podman",
"version_requirement": ">= 0.6.7 < 1.0.0"
}
],
"requirements": [
Expand Down

0 comments on commit 5d8eb38

Please sign in to comment.