[v1.6.4-rhel] Fix webserver startup w/ systemd

Allow a webserver to come backup after it is restarted by systemd.
This was backported to all other Podman releases already, but not to
v1.6.4 at the time.  However, this BZ:
https://bugzilla.redhat.com/show_bug.cgi?id=2091721 is asking for the
fix.

Backport of https://github.com/containers/podman/commit/05a0bf7c07e5

Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
This commit is contained in:
tomsweeneyredhat
2022-06-09 19:54:28 -04:00
parent aba15ddb66
commit a90da95e1b
2 changed files with 10 additions and 0 deletions

View File

@ -71,6 +71,8 @@ const containerTemplate = `# {{.ServiceName}}.service
[Unit]
Description=Podman {{.ServiceName}}.service
Documentation=man:podman-generate-systemd(1)
Wants=network.target
After=network-online.target
{{- if .BoundToServices}}
RefuseManualStart=yes
RefuseManualStop=yes

View File

@ -39,6 +39,8 @@ func TestCreateContainerSystemdUnit(t *testing.T) {
[Unit]
Description=Podman container-639c53578af4d84b8800b4635fa4e680ee80fd67e0e6a2d4eea48d1e3230f401.service
Documentation=man:podman-generate-systemd(1)
Wants=network.target
After=network-online.target
[Service]
Restart=always
@ -57,6 +59,8 @@ WantedBy=multi-user.target`
[Unit]
Description=Podman container-foobar.service
Documentation=man:podman-generate-systemd(1)
Wants=network.target
After=network-online.target
[Service]
Restart=always
@ -75,6 +79,8 @@ WantedBy=multi-user.target`
[Unit]
Description=Podman container-foobar.service
Documentation=man:podman-generate-systemd(1)
Wants=network.target
After=network-online.target
RefuseManualStart=yes
RefuseManualStop=yes
BindsTo=a.service b.service c.service pod.service
@ -97,6 +103,8 @@ WantedBy=multi-user.target`
[Unit]
Description=Podman pod-123abc.service
Documentation=man:podman-generate-systemd(1)
Wants=network.target
After=network-online.target
Requires=container-1.service container-2.service
Before=container-1.service container-2.service