From 80693c431a28f23225675db36c85cce69c2be3f1 Mon Sep 17 00:00:00 2001 From: Thomas Woerner <twoerner@redhat.com> Date: Mon, 16 Sep 2024 14:22:25 +0200 Subject: [PATCH] Use container-ipa.target from freeipa-container container project This reduces the number of started services in the container. The fixipaip.service needed to be adapted to ensure that the service is started properly. The dockerfiles have been adapted for this change also. --- infra/image/dockerfile/c10s | 13 +++++++++++++ infra/image/dockerfile/c8s | 13 +++++++++++++ infra/image/dockerfile/c9s | 13 +++++++++++++ infra/image/dockerfile/fedora-latest | 13 +++++++++++++ infra/image/dockerfile/fedora-rawhide | 13 +++++++++++++ infra/image/system-service/container-ipa.target | 6 ++++++ infra/image/system-service/fixipaip.service | 2 +- 7 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 infra/image/system-service/container-ipa.target diff --git a/infra/image/dockerfile/c10s b/infra/image/dockerfile/c10s index 18d4814..3710cdc 100644 --- a/infra/image/dockerfile/c10s +++ b/infra/image/dockerfile/c10s @@ -12,6 +12,19 @@ dnf --assumeyes install \ iproute; \ rm -rf /var/cache/dnf/; +RUN (cd /lib/systemd/system/; \ + if [ -e dbus-broker.service ] && [ ! -e dbus.service ]; then \ + ln -s dbus-broker.service dbus.service; \ + fi \ +) +COPY system-service/container-ipa.target /lib/systemd/system/ +RUN systemctl set-default container-ipa.target +RUN (cd /etc/systemd/system/; \ + rm -rf multi-user.target.wants \ + && mkdir container-ipa.target.wants \ + && ln -s container-ipa.target.wants multi-user.target.wants \ +) + COPY system-service/fixnet.sh /root/ COPY system-service/fixipaip.sh /root/ COPY system-service/fixnet.service /etc/systemd/system/ diff --git a/infra/image/dockerfile/c8s b/infra/image/dockerfile/c8s index a59879f..3cf629a 100644 --- a/infra/image/dockerfile/c8s +++ b/infra/image/dockerfile/c8s @@ -16,6 +16,19 @@ dnf --assumeyes install \ dnf clean all; \ rm -rf /var/cache/dnf/; +RUN (cd /lib/systemd/system/; \ + if [ -e dbus-broker.service ] && [ ! -e dbus.service ]; then \ + ln -s dbus-broker.service dbus.service; \ + fi \ +) +COPY system-service/container-ipa.target /lib/systemd/system/ +RUN systemctl set-default container-ipa.target +RUN (cd /etc/systemd/system/; \ + rm -rf multi-user.target.wants \ + && mkdir container-ipa.target.wants \ + && ln -s container-ipa.target.wants multi-user.target.wants \ +) + COPY system-service/fixnet.sh /root/ COPY system-service/fixipaip.sh /root/ COPY system-service/fixnet.service /etc/systemd/system/ diff --git a/infra/image/dockerfile/c9s b/infra/image/dockerfile/c9s index 5897d9f..daf181c 100644 --- a/infra/image/dockerfile/c9s +++ b/infra/image/dockerfile/c9s @@ -12,6 +12,19 @@ dnf --assumeyes install \ iproute; \ rm -rf /var/cache/dnf/; +RUN (cd /lib/systemd/system/; \ + if [ -e dbus-broker.service ] && [ ! -e dbus.service ]; then \ + ln -s dbus-broker.service dbus.service; \ + fi \ +) +COPY system-service/container-ipa.target /lib/systemd/system/ +RUN systemctl set-default container-ipa.target +RUN (cd /etc/systemd/system/; \ + rm -rf multi-user.target.wants \ + && mkdir container-ipa.target.wants \ + && ln -s container-ipa.target.wants multi-user.target.wants \ +) + COPY system-service/fixnet.sh /root/ COPY system-service/fixipaip.sh /root/ COPY system-service/fixnet.service /etc/systemd/system/ diff --git a/infra/image/dockerfile/fedora-latest b/infra/image/dockerfile/fedora-latest index aadcffb..f286f9f 100644 --- a/infra/image/dockerfile/fedora-latest +++ b/infra/image/dockerfile/fedora-latest @@ -15,6 +15,19 @@ dnf --assumeyes install \ dnf clean all; \ rm -rf /var/cache/dnf/; +RUN (cd /lib/systemd/system/; \ + if [ -e dbus-broker.service ] && [ ! -e dbus.service ]; then \ + ln -s dbus-broker.service dbus.service; \ + fi \ +) +COPY system-service/container-ipa.target /lib/systemd/system/ +RUN systemctl set-default container-ipa.target +RUN (cd /etc/systemd/system/; \ + rm -rf multi-user.target.wants \ + && mkdir container-ipa.target.wants \ + && ln -s container-ipa.target.wants multi-user.target.wants \ +) + COPY system-service/fixnet.sh /root/ COPY system-service/fixipaip.sh /root/ COPY system-service/fixnet.service /etc/systemd/system/ diff --git a/infra/image/dockerfile/fedora-rawhide b/infra/image/dockerfile/fedora-rawhide index 5a1aa00..b726489 100644 --- a/infra/image/dockerfile/fedora-rawhide +++ b/infra/image/dockerfile/fedora-rawhide @@ -16,6 +16,19 @@ dnf --assumeyes install \ dnf clean all; \ rm -rf /var/cache/dnf/; +RUN (cd /lib/systemd/system/; \ + if [ -e dbus-broker.service ] && [ ! -e dbus.service ]; then \ + ln -s dbus-broker.service dbus.service; \ + fi \ +) +COPY system-service/container-ipa.target /lib/systemd/system/ +RUN systemctl set-default container-ipa.target +RUN (cd /etc/systemd/system/; \ + rm -rf multi-user.target.wants \ + && mkdir container-ipa.target.wants \ + && ln -s container-ipa.target.wants multi-user.target.wants \ +) + COPY system-service/fixnet.sh /root/ COPY system-service/fixipaip.sh /root/ COPY system-service/fixnet.service /etc/systemd/system/ diff --git a/infra/image/system-service/container-ipa.target b/infra/image/system-service/container-ipa.target new file mode 100644 index 0000000..c853881 --- /dev/null +++ b/infra/image/system-service/container-ipa.target @@ -0,0 +1,6 @@ +[Unit] +Description=Minimal target for containerized FreeIPA server +DefaultDependencies=false +AllowIsolate=yes +Requires=systemd-tmpfiles-setup.service systemd-journald.service dbus.service +After=systemd-tmpfiles-setup.service systemd-journald.service dbus.service diff --git a/infra/image/system-service/fixipaip.service b/infra/image/system-service/fixipaip.service index 95db118..ec56c0d 100644 --- a/infra/image/system-service/fixipaip.service +++ b/infra/image/system-service/fixipaip.service @@ -1,6 +1,6 @@ [Unit] Description=Fix IPA server IP in IPA Server -After=multi-user.target +After=ipa.service [Service] Type=oneshot -- GitLab