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

run foreman in a container #1164

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

run foreman in a container #1164

wants to merge 4 commits into from

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented May 14, 2024

No description provided.

@evgeni evgeni force-pushed the frankontainer branch 15 times, most recently from 3eea753 to bc4dea6 Compare May 21, 2024 09:28
'AddCapability' => ['CAP_DAC_OVERRIDE', 'CAP_IPC_OWNER'],
'Network' => 'host',
'HostName' => $foreman::servername,
'Notify' => true,
Copy link
Member Author

Choose a reason for hiding this comment

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

sd_notify from the container, super nice.

'Image' => 'quay.io/evgeni/foreman-rpm:latest',
'Volume' => ['/etc/foreman/:/etc/foreman/'],
'AddCapability' => ['CAP_DAC_OVERRIDE', 'CAP_IPC_OWNER'],
'Network' => 'host',
Copy link
Member Author

Choose a reason for hiding this comment

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

using Network=host so that we don't need any private networks, fiddling with v6 subnets or exposing ports.

container_entry => {
'Image' => 'quay.io/evgeni/foreman-rpm:latest',
'Volume' => ['/etc/foreman/:/etc/foreman/'],
'AddCapability' => ['CAP_DAC_OVERRIDE', 'CAP_IPC_OWNER'],
Copy link
Member Author

Choose a reason for hiding this comment

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

the foreman user inside the container might have a different UID than outside, fucking up file access :/

(I am not sure this is overall a good idea, but here we are for now)

Copy link
Member

Choose a reason for hiding this comment

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

Feels like a nasty hack that we need to resolve prior to going production with this.

@@ -153,7 +155,13 @@
}

if $foreman::apache {
$listen_socket = '/run/foreman.sock'
if $foreman::deployment_mode == 'container' {
$listen_socket = 'localhost:3000/'
Copy link
Member Author

Choose a reason for hiding this comment

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

This one was tricky. Apache (or foreman::config::apache) doesn't add a trailing slash to the backend, which then tries to access things like http://localhost:3000users/login, obviously failing

Copy link
Member

Choose a reason for hiding this comment

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

You can use systemd socket activation with podman containers. I've used that myself with gunicorn to avoid needing to deal with a firewall (and instead deal with SELinux). Any reason you don't use that now?

See https://github.com/containers/podman/blob/main/docs/tutorials/socket_activation.md#socket-activation-of-containers for more info.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh cool. I didn't try that (yet), but I also think that the above is a legit bug in our current deployment if for some reason users do not want sockets.

also lol @ "and instead deal with SELinux" ;)

Copy link
Member

Choose a reason for hiding this comment

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

Quite possible that there's a bug there

Comment on lines +68 to +69
db_host => 'localhost',
db_manage_rake => false,
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 wonder if these two could be made more "dynamic"?

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean? That db_manage_rake would be undef by default and the deployment mode determines the value?

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, same for host (there is not really a socket in the container)

manifests/config.pp Outdated Show resolved Hide resolved
@evgeni evgeni force-pushed the frankontainer branch 5 times, most recently from 191f411 to ea31bc3 Compare May 21, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants