Skip to content

Commit

Permalink
MOD: manage the quay-pod via systemd (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbertera authored Mar 2, 2022
1 parent 9692bcc commit 1ee213c
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
redis_image: "registry.redhat.io/rhel8/redis-6:1-25"
postgres_image: "registry.redhat.io/rhel8/postgresql-10:1-161"
quay_image: "registry.redhat.io/quay/quay-rhel8:v3.6.1"
pause_image: "registry.access.redhat.com/ubi8/pause:latest"
quay_hostname: "quay:8443"
quay_root: "/etc/quay-install"
auto_approve: "false"
auto_approve: "false"

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: Copy Quay Pod systemd service file
template:
src: ../templates/pod.service.j2
dest: /etc/systemd/system/quay-pod.service

- name: Check if pod pause image is loaded
command: podman inspect --type=image {{ pause_image }}
register: r
ignore_errors: yes

- name: Pull Infra image
containers.podman.podman_image:
name: "{{ pause_image }}"
when: r.rc != 0
retries: 5
delay: 5

- name: Start Quay Pod service
systemd:
name: quay-pod.service
enabled: yes
daemon_reload: yes
state: started
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
- name: Set SELinux Rules
include_tasks: set-selinux-rules.yaml

- name: Create Podman Pod
include_tasks: create-podman-pod.yaml
- name: Install Quay Pod Service
include_tasks: install-pod-service.yaml

- name: Autodetect Image Archive
include_tasks: autodetect-image-archive.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[Unit]
Description=Infra Container for Quay
Wants=network.target
After=network-online.target
Before=quay-postgres.service quay-redis.service

[Service]
Type=simple
RemainAfterExit=yes
TimeoutStartSec=5m
ExecStartPre=-/bin/rm -f %t/%n-pid %t/%n-pod-id
ExecStart=/usr/bin/podman pod create \
--name quay-pod \
--infra-image {{ pause_image }} \
--publish {{ quay_hostname.split(":")[1] if (":" in quay_hostname) else "8443" }}:8443 \
--pod-id-file %t/%n-pod-id \
--replace
ExecStop=-/usr/bin/podman pod stop --ignore --pod-id-file %t/%n-pod-id -t 10
ExecStopPost=-/usr/bin/podman pod rm --ignore -f --pod-id-file %t/%n-pod-id
PIDFile=%t/%n-pid
KillMode=none
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target default.target

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[Unit]
Description=PostgreSQL Podman Container for Quay
Wants=network.target
After=network-online.target
After=network-online.target quay-pod.service
Requires=quay-pod.service

[Service]
Type=simple
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[Unit]
Description=Quay Container
Wants=network.target
After=network-online.target
Requires=quay-postgres.service quay-redis.service
After=network-online.target quay-pod.service quay-postgres.service quay-redis.service
Requires=quay-pod.service quay-postgres.service quay-redis.service

[Service]
Type=simple
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[Unit]
Description=Redis Podman Container for Quay
Wants=network.target
After=network-online.target
After=network-online.target quay-pod.service
Requires=quay-pod.service

[Service]
Type=simple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
state: stopped
force: yes

- name: Stop Quay Pod service
systemd:
name: quay-pod.service
enabled: no
daemon_reload: yes
state: stopped
force: yes

- name: Delete pod
containers.podman.podman_pod:
name: quay-pod
Expand Down
2 changes: 1 addition & 1 deletion cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func install() {
log.Printf("Install has begun")

log.Debug("Ansible Execution Environment Image: " + eeImage)
log.Debug("Redis Image: " + pauseImage)
log.Debug("Pause Image: " + pauseImage)
log.Debug("Quay Image: " + quayImage)
log.Debug("Redis Image: " + redisImage)
log.Debug("Postgres Image: " + postgresImage)
Expand Down

0 comments on commit 1ee213c

Please sign in to comment.