Skip to content

[WIP] Use the Systemd [Container] directive #50

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
8 changes: 7 additions & 1 deletion app/models/opentofu_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def container_image
end

def enable_systemd_unit
super
create_cid_runfile
create_tls_certs
create_podman_secret
end
Expand All @@ -83,6 +83,12 @@ def configure_service_worker_deployment(definition)
end
end

def create_cid_runfile
cid_runfile = Pathname.new("/run/opentofu-runner.cid")
cid_runfile.write(nil)
cid_runfile.chown(manageiq_uid, manageiq_gid)
end

def create_tls_certs
opentofu_runner_certs_dir = Pathname.new("#{OPENTOFU_RUNTIME_DIR}/certs")
unless opentofu_runner_certs_dir.exist?
Expand Down
22 changes: 22 additions & 0 deletions systemd/opentofu-runner.container
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[Unit]
Description=Opentofu Runner Container
After=local-fs.target

[Container]
Image=${OPENTOFU_RUNNER_IMAGE}
PodmanArgs=--root /var/www/miq/vmdb/data/containers/storage
ContainerName=opentofu-runner
Secret=opentofu-runner-secret
Volume=/var/lib/manageiq/opentofu-runner/certs:/opt/app-root/src/config/cert:z
Environment=DATABASE_HOSTNAME=${DATABASE_HOSTNAME}
Environment=DATABASE_NAME=${DATABASE_NAME}
Environment=DATABASE_USERNAME=${DATABASE_USERNAME}
Environment=MEMCACHE_SERVERS=${MEMCACHE_SERVERS}
ExposeHostPort=6000
Network=host

[Service]
Restart=on-failure
User=manageiq
Group=manageiq
Slice=manageiq.slice
16 changes: 0 additions & 16 deletions systemd/opentofu-runner.service

This file was deleted.

Loading