mirror of
https://github.com/skoobasteeve/skoobasteeve.github.io.2.git
synced 2026-03-20 07:58:57 +00:00
Compare commits
6 Commits
nextcloud-
...
d2cdaa024d
| Author | SHA1 | Date | |
|---|---|---|---|
|
d2cdaa024d
|
|||
|
|
b53db5ea29 | ||
|
974e6abc64
|
|||
|
1677407e63
|
|||
|
|
5069405ad6
|
||
|
|
7149fca6e5 |
@@ -10,13 +10,16 @@ comments: true
|
||||
|
||||
{:class="img-responsive" .align-center}
|
||||
|
||||
{: .notice--info}
|
||||
***UPDATE 2023-10-15**: Kalendar's name has changed to "Merkuro Calendar". Still a great app!*
|
||||
|
||||
2022 was a great year for my Python skills. I had some unique problems to solve in my day job that got me over the hump of learning the language, and finally I was able to write comfortably without Googling syntax every five minutes. Quickly my team's Github repo filled up with borderline-unnecessary one-off scripts to solve all sorts of niche problems in our environment. Due to the nature of being a system administrator at a SaaS-heavy company, most of these scripts deal with third-party APIs: moving data from "service a" to "service b", pulling information about "service c" and correlating it with "service d", etc. These types of scripts are fun to write because they have narrow scopes and easily achievable goals, and I find completing them to be immensely satisfying.
|
||||
|
||||
Filled with confidence in my Python skills, I set out to embark on my first GUI project: a desktop to-do application with CalDAV sync. This is an app I feel has been missing on Linux, something akin to Apple Reminders where I can use my own backend for sync. To get started, I built a local-only terminal client, bought a book to start learning PyQt, and I sat down today to write the first of a series of blog posts where I would document the project. I got to the part of the blog post where I confidently say that there are "currently no working Linux desktop apps with this functionality". Then I thought, *maybe I should Google this once more and confirm there really is nothing out there*. Well, shit.
|
||||
|
||||
## Enter Kalendar
|
||||
|
||||
The last time I researched this space, there were no functional standalone to-do apps that supported CalDAV sync. The closest I could find was Thunderbird, my beloved email client, which is far more complex than what I was looking for. [Kalendar](https://apps.kde.org/kalendar/) didn't even pop up on my radar. Even today when I searched, I almost didn't find it. I ended up seeing it on the [Nextcloud Tasks Github page](https://github.com/nextcloud/tasks#apps-which-sync-with-nextcloud-tasks-using-caldav) in a list of compatible apps with sync. Within minutes, I had it installed and synced with my tasks in Nextcloud, and **wow**, this thing is good.
|
||||
The last time I researched this space, there were no functional standalone to-do apps that supported CalDAV sync. The closest I could find was Thunderbird, my beloved email client, which is far more complex than what I was looking for. [Kalendar](https://apps.kde.org/merkuro.calendar/) didn't even pop up on my radar. Even today when I searched, I almost didn't find it. I ended up seeing it on the [Nextcloud Tasks Github page](https://github.com/nextcloud/tasks#apps-which-sync-with-nextcloud-tasks-using-caldav) in a list of compatible apps with sync. Within minutes, I had it installed and synced with my tasks in Nextcloud, and **wow**, this thing is good.
|
||||
|
||||
Kalendar bills itself mainly as a new calendar app, but my task lists feel right at home here. The app opens instantly, and the task view is designed almost exactly as I envisioned for my own app; toggleable lists on the left and tasks on the right. Type on the bottom and hit enter to quickly create a new task and it syncs right up to Nextcloud. Right click on a task to easily set priority and due date, or add a subtask. I hate how good this is.
|
||||
|
||||
|
||||
@@ -584,6 +584,6 @@ If the containers aren't running, use `sudo journalctl -xe` to check the output
|
||||
|
||||
Now that we have a working server, let's make sure we never have to do it by hand again! In Part 3 of the series, I'll go over how you can automate the entire configuration with an [Ansible playbook](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_intro.html). Not only can you re-use that playbook to spin up multiple servers or re-deploy on a new hosting provider, it also acts as documentation that writes itself.
|
||||
|
||||
As always, feel free to leave a comment below with any questions or suggestions. You can also reach me by [email](mailto:blog@rayagainstthemachine.net) or [Mastodon](https://fosstodon.org/@skoobasteeve).
|
||||
As always, feel free to leave a comment below with any questions or suggestions. You can also reach me by [email](mailto:ray@rayagainstthemachine.net) or [Mastodon](https://fosstodon.org/@skoobasteeve).
|
||||
|
||||
Happy hacking!
|
||||
|
||||
108
_posts/2023-10-08-podman-auto-update.md
Normal file
108
_posts/2023-10-08-podman-auto-update.md
Normal file
@@ -0,0 +1,108 @@
|
||||
---
|
||||
layout: single
|
||||
title: "Easily Update Your Containers with Podman Auto-Update"
|
||||
date: 2023-10-08 16:00:00
|
||||
excerpt: "Use this handy built-in feature of Podman to update all your container images with a single command."
|
||||
categories: [Linux Administration]
|
||||
tags: linux nextcloud podman docker container update
|
||||
comments: true
|
||||
---
|
||||
|
||||
I've written previously about the joys of using Podman to manage your containers, including the benefits of using it over Docker, but one of my favorite quality-of-life features is the [podman auto-update](https://docs.podman.io/en/stable/markdown/podman-auto-update.1.html) command.
|
||||
|
||||
In short, it replaces the series of commands you would normally run to update containers, for example:
|
||||
|
||||
1. `podman pull nextcloud-fpm:27`
|
||||
2. `podman stop nextcloud-fpm`
|
||||
3. `podman rm nextcloud-fpm`
|
||||
4. `podman run [OPTIONS] nextcloud-fpm:27`
|
||||
5. Repeat for each container.
|
||||
|
||||
Not only does podman auto-update save you all these steps, it will also automatically roll back to the previous image version if there are errors starting the new version, giving you some peace of mind when updating important applications.
|
||||
|
||||
## Requirements
|
||||
* Podman installed
|
||||
* Containers [managed with systemd](https://docs.podman.io/en/stable/markdown/podman-generate-systemd.1.html)
|
||||
* Containers you want to update must use the `--label "io.containers.autoupdate=registry"` run option
|
||||
|
||||
## Instructions
|
||||
|
||||
Recreate your existing systemd-managed containers with the `--label "io.containers.autoupdate=registry"` option. To do this, just edit your container's service file to include the option. See the below partial example for my Nextcloud container:
|
||||
|
||||
``` systemd
|
||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id
|
||||
ExecStart=/usr/bin/podman run \
|
||||
--cidfile=%t/%n.ctr-id \
|
||||
--cgroups=no-conmon \
|
||||
--rm \
|
||||
--pod-id-file %t/pod-nextcloud-pod.pod-id \
|
||||
--sdnotify=conmon \
|
||||
--replace \
|
||||
--detach \
|
||||
--env MYSQL_HOST=mariadb \
|
||||
--env MYSQL_DATABASE=nextcloud \
|
||||
--env MYSQL_USER=${MYSQL_USER} \
|
||||
--env MYSQL_PASSWORD=${MYSQL_PASSWORD} \
|
||||
--volume %h/.podman/nextcloud/nextcloud-config:/var/www/html:z \
|
||||
--volume /mnt/nextcloud-data/data:/var/www/html/data:z \
|
||||
--label "io.containers.autoupdate=registry" \
|
||||
--log-driver=journald \
|
||||
--name nextcloud-app docker.io/library/nextcloud:${NEXTCLOUD_VERSION}-fpm
|
||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
|
||||
```
|
||||
\
|
||||
Once you're done, reload the systemd daemon and restart the service.
|
||||
``` shell
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user restart container-nextcloud.service
|
||||
```
|
||||
\
|
||||
Next, run the auto-update command with the `--dry-run` option. With this option, you'll get a preview of which containers will be updated without the update taking place.
|
||||
|
||||
``` shell
|
||||
podman auto-update --dry-run
|
||||
|
||||
UNIT CONTAINER IMAGE POLICY UPDATED
|
||||
pod-nextcloud-pod.service 643fd5d3e2cb (nextcloud-app) docker.io/library/nextcloud:27-fpm registry pending
|
||||
pod-nextcloud-pod.service 71e48b691447 (mariadb) docker.io/library/mariadb:10 registry pending
|
||||
pod-nextcloud-pod.service 9ed555fecdfa (caddy) docker.io/library/caddy registry pending
|
||||
```
|
||||
|
||||
### Output explained
|
||||
* `podman auto-update` will show updates for every container that has the "io.containers.autoupdate=registry" label and do them all at once
|
||||
* The `UNIT` column shows the same "pod" service for each container. This is because my containers are all managed by a single Podman pod.
|
||||
* The `UPDATED` column shows "pending", which means there is an update available from the container registry.
|
||||
|
||||
\
|
||||
Once you're ready to update, run the command again without the `--dry-run` option.
|
||||
|
||||
``` shell
|
||||
podman auto-update
|
||||
```
|
||||
\
|
||||
Podman will begin pulling the images from the registry, which may take a few minutes depending on your connection speed. If it completes successfully, you'll get fresh output with the `UPDATED` column changed to `true`.
|
||||
|
||||
``` shell
|
||||
UNIT CONTAINER IMAGE POLICY UPDATED
|
||||
pod-nextcloud-pod.service 643fd5d3e2cb (nextcloud-app) docker.io/library/nextcloud:27-fpm registry true
|
||||
pod-nextcloud-pod.service 71e48b691447 (mariadb) docker.io/library/mariadb:10 registry true
|
||||
pod-nextcloud-pod.service 9ed555fecdfa (caddy) docker.io/library/caddy registry true
|
||||
```
|
||||
\
|
||||
During this process, the containers were restarted automatically with the latest image. You can verify this with `podman ps`.
|
||||
|
||||
``` shell
|
||||
podman ps
|
||||
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
0c5523997648 localhost/podman-pause:4.6.1-1692961071 2 minutes ago Up 2 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp 0e075fb7b67b-infra
|
||||
4ba992e83eeb docker.io/library/caddy:latest caddy run --confi... 2 minutes ago Up 2 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp caddy
|
||||
2a7d448b1b6b docker.io/library/nextcloud:27-fpm php-fpm 2 minutes ago Up About a minute 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp nextcloud-app
|
||||
9ec017721f16 docker.io/library/mariadb:10 --transaction-iso... 2 minutes ago Up 2 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp mariadb
|
||||
```
|
||||
\
|
||||
That's it! Your Podman containers were updated to the latest image version with a single command. This is a small feature, but one I've come to love in my time using Podman. If you get stuck, check out the project's [documentation for the auto-update command](https://docs.podman.io/en/stable/markdown/podman-auto-update.1.html). If you have broader questions about running Podman, I recommend reading my [series on building a reproducible Nextcloud server with Podman]({% link _posts/2023-08-27-nextcloud-podman.md %}).
|
||||
|
||||
Happy hacking!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user