containers / containers/podman-compose

add systemd service files

Open
#307 16 comments 15 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.2k
Forks
622
PR merge metrics
No merged PRs in 30d

Description

It would be great if podman-compose could be shipped with systems services files.

I'm attaching my systemd service files. They are pretty basic, probably need to be improved so I'm not adding these myself in a PR, but they are working for me.

_/usr/lib/systemd/system/podman-compose@.service_

```
[Unit]
Description=%i rootful pod (podman-compose)
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
RemainAfterExit=true
WorkingDirectory=/etc/containers/compose/%i
ExecStart=/usr/bin/podman-compose up -d --remove-orphans
ExecStop=/usr/bin/podman-compose down

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

_/usr/lib/systemd/user/podman-compose@.service_
```
[Unit]
Description=%i rootless pod (podman-compose)

[Service]
Type=oneshot
RemainAfterExit=true
WorkingDirectory=%h/.config/containers/compose/%i
ExecStart=/usr/bin/podman-compose up -d --remove-orphans
ExecStop=/usr/bin/podman-compose down

[Install]
WantedBy=default.target
```

Previously I was using environment file in `/etc/conf.d` to set the compose file, but now that podman-compose defaults prioritize `compose.yaml` and `compose.yml`, I don't see a reason why we need this configurable.

If it's not obvious, each pod should have a folder in `/etc/containers/compose/` ~~and~~ **(edit:) or** `~/.config/containers/compose/`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.