From 1f437f20a6b781908491e16525550343886e8866 Mon Sep 17 00:00:00 2001 From: Gianni Young <43043456+GianniBYoung@users.noreply.github.com> Date: Wed, 22 Oct 2025 17:29:00 -0500 Subject: [PATCH] docs: added example for rootless podman quadlet deployment (#1389) --- example-podman/README.md | 35 ++++++++++++++++++++++++++++ example-podman/booklore-data.volume | 2 ++ example-podman/booklore-db.container | 21 +++++++++++++++++ example-podman/booklore-db.volume | 2 ++ example-podman/booklore.container | 23 ++++++++++++++++++ example-podman/booklore.pod | 7 ++++++ 6 files changed, 90 insertions(+) create mode 100644 example-podman/README.md create mode 100644 example-podman/booklore-data.volume create mode 100644 example-podman/booklore-db.container create mode 100644 example-podman/booklore-db.volume create mode 100644 example-podman/booklore.container create mode 100644 example-podman/booklore.pod diff --git a/example-podman/README.md b/example-podman/README.md new file mode 100644 index 000000000..622b53396 --- /dev/null +++ b/example-podman/README.md @@ -0,0 +1,35 @@ +# Podman Example +This directory contains an example of how to use a rootless Podman pod defined through Quadlets to run booklore. + +# Setup +1. Copy the files in this directory to a suitable location on your system. + - For many systems Quadlet monitors `~/.config/containers/systemd` + - `mkdir -p ~/.config/containers/systemd && cp ./*lore* ~/.config/containers/systemd/` +2. Edit the `booklore.container` to set the correct mounts for `bookdrop` and your library +3. Create the Podman Secrets for the database + ```bash + echo -n "YOUR PASSWORD" | podman secret create booklore_db_pass - + ``` +4. (Optional) `podman pull ghcr.io/booklore-app/booklore:latest` to pre-pull the image + * If you have a slow connection, this is recommended because systemd will time out if the image pull takes too long. +5. Run `systemctl --user daemon-reload` to pick up the new Quadlet unit. +6. Start the pod with `systemctl --user start booklore-pod.service` + +# Autoupdates +If automatic updates are desired, enable the systemd timer: +```bash +systemctl --user enable podman-auto-update.timer +``` + +This is a native way to schedule `podman auto-update` to run periodically and update/restart containers with `AutoUpdate` enabled in their Quadlet files. + +# Verification Commands +- `systemctl --user status booklore-pod -l` - Check the status of the pod +- `systemctl --user status booklore-db -l` - Check the status of the database +- `systemctl --user status booklore -l` - Check the status of the booklore container + + +# Further Reading +- [Podman Quadlets Documentation](https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html) +- [Bazzite Podamn Quadlet Examples](https://docs.bazzite.gg/Installing_and_Managing_Software/Quadlet/) +- `man podman-systemd.unit` diff --git a/example-podman/booklore-data.volume b/example-podman/booklore-data.volume new file mode 100644 index 000000000..d5c57b3c0 --- /dev/null +++ b/example-podman/booklore-data.volume @@ -0,0 +1,2 @@ +[Volume] +VolumeName=booklore-data diff --git a/example-podman/booklore-db.container b/example-podman/booklore-db.container new file mode 100644 index 000000000..3cc98e9e0 --- /dev/null +++ b/example-podman/booklore-db.container @@ -0,0 +1,21 @@ +[Unit] +Description=BookLore Database Container Using MariaDB + +[Container] +ContainerName=booklore-db +Image=lscr.io/linuxserver/mariadb:11.4.5 +Pod=booklore.pod +Pull=always + +Volume=booklore-db:/config + +Environment=TZ=Etc/UTC +Environment=PUID=0 +Environment=PGID=0 +Environment=MYSQL_USER=booklore +Secret=booklore_db_pass,type=env,target=MYSQL_ROOT_PASSWORD +Secret=booklore_db_pass,type=env,target=MYSQL_PASSWORD +Environment=MYSQL_DATABASE=booklore + +DropCapability=all +AddCapability=CAP_CHOWN CAP_SETUID CAP_SETGID CAP_FOWNER diff --git a/example-podman/booklore-db.volume b/example-podman/booklore-db.volume new file mode 100644 index 000000000..b06dc8881 --- /dev/null +++ b/example-podman/booklore-db.volume @@ -0,0 +1,2 @@ +[Volume] +VolumeName=booklore-db diff --git a/example-podman/booklore.container b/example-podman/booklore.container new file mode 100644 index 000000000..9af6b0df0 --- /dev/null +++ b/example-podman/booklore.container @@ -0,0 +1,23 @@ +[Unit] +Description=booklore container +Requires=booklore-db.container +After=booklore-db.container + +[Container] +ContainerName=booklore +Image=ghcr.io/booklore-app/booklore:latest +Pod=booklore.pod +AutoUpdate=registry +Pull=always + +Volume=booklore-data:/app/data +# note the :z is important for selinux systems +# Volume=YOUR MOUNTS:/books:z +# Volume=YOUR MOUNTS:/bookdrop:z + + +Environment=TZ=Etc/UTC +Secret=booklore_db_pass,type=env,target=DATABASE_PASSWORD +Environment=DATABASE_URL=jdbc:mariadb://localhost:3306/booklore +Environment=DATABASE_USERNAME=booklore +Environment=BOOKLORE_PORT=6060 diff --git a/example-podman/booklore.pod b/example-podman/booklore.pod new file mode 100644 index 000000000..d2c84314e --- /dev/null +++ b/example-podman/booklore.pod @@ -0,0 +1,7 @@ +[Unit] +Description=BookLore Pod +After=network-online.target + +[Pod] +PodName=booklore +PublishPort=6060:6060