{"id":3173,"date":"2022-04-18T07:00:00","date_gmt":"2022-04-18T05:00:00","guid":{"rendered":"https:\/\/www.my-it-brain.de\/wordpress\/?p=3173"},"modified":"2023-08-15T21:03:09","modified_gmt":"2023-08-15T19:03:09","slug":"nextcloud-im-container-teil-6-updates","status":"publish","type":"post","link":"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-6-updates\/","title":{"rendered":"Nextcloud im Container &#8211; Teil 6: Updates"},"content":{"rendered":"\n<p>Herzlich willkommen zu Teil 6 meiner Reihe <a href=\"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-1-der-plan\/\" data-type=\"post\" data-id=\"2993\">Nextcloud im Container<\/a>. Dieser Teil behandelt das Thema Updates. Zum Verst\u00e4ndnis empfehle ich, zuerst <a href=\"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-1-der-plan\/\" data-type=\"post\" data-id=\"2993\">Teil 1<\/a> und <a href=\"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-2-die-ansible-rolle\/\" data-type=\"post\" data-id=\"2996\">Teil 2<\/a> zu lesen.<\/p>\n\n\n\n<p>Nun w\u00fcnsche ich euch viel Spa\u00df beim Lesen und gute Unterhaltung.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Gedanken zum Update<\/h2>\n\n\n\n<p>Meine Nextcloud-Instanz l\u00e4uft in einem Podman-Pod. Das sieht im Terminal wie folgt aus:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ podman pod ps\nPOD ID        NAME    STATUS   CREATED       INFRA ID      # OF CONTAINERS\ne84bec6108d1  nc_pod  Running  2 months ago  5e52555c5060  3<\/code><\/pre>\n\n\n\n<p>Dieser Pod besteht aus den folgenden drei Container-Instanzen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ podman ps\nCONTAINER ID  IMAGE                                  COMMAND               CREATED       STATUS         PORTS                    NAMES\n5e52555c5060  k8s.gcr.io\/pause:3.2                                         2 months ago  Up 7 days ago  127.0.0.1:40671-&gt;80\/tcp  e84bec6108d1-infra\nc6571aa338ce  docker.io\/library\/mariadb:10.5.7       mysqld                2 months ago  Up 7 days ago  127.0.0.1:40671-&gt;80\/tcp  nc_mariadb\n21739d36eef1  docker.io\/library\/nextcloud:23-apache  apache2-foregroun...  2 months ago  Up 7 days ago  127.0.0.1:40671-&gt;80\/tcp  nextcloud<\/code><\/pre>\n\n\n\n<p>Diese Container-Instanzen sind zustandslos und <em>ephemeral<\/em> (engl. f\u00fcr kurzlebig, verg\u00e4nglich oder fl\u00fcchtig). Persistent zu speichernde Daten werden au\u00dferhalb der Container-Instanzen gespeichert. Diese Eigenschaften erlauben es, Container einfach entfernen und durch neue Instanzen ersetzen zu k\u00f6nnen.<\/p>\n\n\n\n<p>Um die Nextcloud zu aktualisieren, wird in dieser Umgebung also nicht die Anwendung innerhalb des Containers aktualisiert. Stattdessen werden die Container-Instanzen entfernt und Container-Images mit aktuelleren Versionen der Anwendung und Datenbank instanziiert.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Der Update-Prozess<\/h2>\n\n\n\n<p>Die aktuell laufenden Versionen von Nextcloud und MariaDB sind obigen Codeblock zu entnehmen. Diese Images wurden durch die beiden folgenden Zeilen in der Datei <code>{role_path}\/defaults\/main.yml<\/code>  definiert:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MARIADB_IMAGE: docker.io\/library\/mariadb:10.5.7\nNC_IMAGE: docker.io\/library\/nextcloud:23-apache<\/code><\/pre>\n\n\n\n<p>Hier kann man nun die gew\u00fcnschten Versionen der zu verwendenden Container-Images eintragen. Alternativ kann man die Default-Werte auch durch entsprechende Eintr\u00e4ge in <code>{role_path}\/vars\/main.yml<\/code> \u00fcberschreiben. Die Eintr\u00e4ge sehen dann bspw. wie folgt aus:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MARIADB_IMAGE: docker.io\/library\/mariadb:10.5.9\nNC_IMAGE: docker.io\/library\/nextcloud:23.0.3-apache<\/code><\/pre>\n\n\n\n<p>Nun kann das Playbook mit der <a href=\"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-2-die-ansible-rolle\/\" data-type=\"post\" data-id=\"2996\">Ansible-Rolle aus Teil 2<\/a> dieser Reihe erneut ausgef\u00fchrt werden:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ansible-playbook -i hosts deploy_nextcloud.yml --ask-vault-pass                                                 \nVault password:                                                                                                   \n                                                                                                                  \nPLAY &#91;localhost] **************************************************************************************************\n                                                                                                                  \nTASK &#91;Gathering Facts] *******************************************************************************************\nok: &#91;localhost]                                                                                                    \n                                                                                                                  \nTASK &#91;ansible_role_deploy_nextcloud_with_mariadb_pod : Main folder, needed for updating] *************************\nok: &#91;localhost]                                                                                                    \n                                                                                                                  \nTASK &#91;ansible_role_deploy_nextcloud_with_mariadb_pod : Volume for installed\/modified apps] ***********************\nok: &#91;localhost]                                                                                                    \n                                                                                                                  \nTASK &#91;ansible_role_deploy_nextcloud_with_mariadb_pod : Volume for local configuration] ***************************\nok: &#91;localhost]                                                                                                    \n                                                                                                                  \nTASK &#91;ansible_role_deploy_nextcloud_with_mariadb_pod : Volume for the actual data of Nextcloud] ******************\nok: &#91;localhost]                                                                                                    \n                                                                                                                  \nTASK &#91;ansible_role_deploy_nextcloud_with_mariadb_pod : Volume for the MySQL data files] **************************\nok: &#91;localhost]                                                                                                    \n                                                                                                                  \nTASK &#91;ansible_role_deploy_nextcloud_with_mariadb_pod : Create the podman-pod(1)] *********************************\nchanged: &#91;localhost]                                                                                                    \n                                                                                                                  \nTASK &#91;ansible_role_deploy_nextcloud_with_mariadb_pod : Create MariaDB container] *********************************\nchanged: &#91;localhost]                                                                                               \n                                                                                                                  \nTASK &#91;ansible_role_deploy_nextcloud_with_mariadb_pod : Wait for DB to initilize] *********************************\nok: &#91;localhost]                                                                                                    \n                                                                                                                  \nTASK &#91;ansible_role_deploy_nextcloud_with_mariadb_pod : Create Nextcloud container] *******************************\nchanged: &#91;localhost]                                                                                               \n                                                                                                                  \nPLAY RECAP *******************************************************************************************************\nlocalhost                   : ok=10   changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0<\/code><\/pre>\n\n\n\n<p>Nun kann man sich auf dem Zielsystem davon \u00fcberzeugen, dass die neuen Container-Images zur Instanziierung verwendet wurden:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ podman ps\nCONTAINER ID  IMAGE                                      COMMAND               CREATED         STATUS             PORTS                    NAMES\n5e52555c5060  k8s.gcr.io\/pause:3.2                                             2 months ago    Up 7 days ago      127.0.0.1:40671-&gt;80\/tcp  e84bec6108d1-infra\n248f87e1135b  docker.io\/library\/mariadb:10.5.9           mysqld                35 seconds ago  Up 36 seconds ago  127.0.0.1:40671-&gt;80\/tcp  nc_mariadb\n59ac1aad168c  docker.io\/library\/nextcloud:23.0.3-apache  apache2-foregroun...  10 seconds ago  Up 11 seconds ago  127.0.0.1:40671-&gt;80\/tcp  nextcloud<\/code><\/pre>\n\n\n\n<p>Fertig. Schon kann Nextcloud in Version 23.0.3 mit einer MariaDB 10.5.9 genutzt werden.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Update 2023-08-15: Major-Release-Upgrades erfolgreich<\/h2>\n\n\n\n<p>Seitdem dieser Artikel online ist, habe ich mit der Ansible-Rolle bereits mehrere Major-Release-Upgrades erfolgreich durchgef\u00fchrt. Meine Nextcloud ist aktuell auf Version 26.0.5.<\/p>\n\n\n\n<p>F\u00fcr das Nextcloud-Container-Image verwende ich das Tag <code>production-apache<\/code>.<\/p>\n\n\n\n<p>Da Major-Release-Upgrades h\u00e4ufig mit einer Aktualisierung des Datenbank-Schemas und der Tabellen einhergehen, ist nach dem Re-Deployment ein Blick in die Administrations-\u00dcbersicht empfohlen. Dort finden sich ggf. Hinweise auf manuell auszuf\u00fchrende Wartungsarbeiten, wie z.B. die Erstellung von Indices, wie folgender Bildausschnitt zeigt.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"228\" src=\"https:\/\/www.my-it-brain.de\/wordpress\/wp-content\/uploads\/2023\/08\/image-800x228.png\" alt=\"Das Bild zeigt einen Text aus der Administrations-\u00dcbersicht von Nextcloud. Es wird darauf hingeweisen, dass mit dem Befehl &quot;occ db:add-missing-indices&quot; fehlende Indices erstellt werden k\u00f6nnen.\" class=\"wp-image-3614\" srcset=\"https:\/\/www.my-it-brain.de\/wordpress\/wp-content\/uploads\/2023\/08\/image-800x228.png 800w, https:\/\/www.my-it-brain.de\/wordpress\/wp-content\/uploads\/2023\/08\/image-300x86.png 300w, https:\/\/www.my-it-brain.de\/wordpress\/wp-content\/uploads\/2023\/08\/image-768x219.png 768w, https:\/\/www.my-it-brain.de\/wordpress\/wp-content\/uploads\/2023\/08\/image-624x178.png 624w, https:\/\/www.my-it-brain.de\/wordpress\/wp-content\/uploads\/2023\/08\/image.png 897w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption class=\"wp-element-caption\">Hinweis zur manuellen Erzugung fehlender Indices.<\/figcaption><\/figure>\n\n\n\n<p>Mit folgendem Befehl k\u00f6nnen die fehlenden Indices im laufenden Nextcloud-Container erzeugt werden:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ podman exec -u 33 -d &lt;NEXTCLOUD-CONTAINER-ID> \/var\/www\/html\/occ db:add-missing-indices<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Fazit<\/h2>\n\n\n\n<p>Mit diesem Artikel habe ich das letzte noch offene Ziel Nr. 5 &#8222;Konfiguration und Test <s>automatischer<\/s> durch Ansible gesteuerter Updates&#8220; erreicht. Der Update-Prozess folgte dem Container-Paradigma, die Container komplett zu ersetzen und nicht die Anwendung innerhalb der Container zu aktualisieren.<\/p>\n\n\n\n<p>Es handelte sich im dokumentierten Fall um Updates auf ein neues <a href=\"https:\/\/semver.org\/lang\/de\/\">Patch-Release<\/a>, bei denen das Risiko f\u00fcr Fehler ohnehin sehr gering ist. Auch Minor- und Major-Release-Upgrades lassen sich auf dem gleichen Weg durchf\u00fchren, wie das Update vom 15.08.2023 belegt.<\/p>\n\n\n\n<p>Mit diesem Artikel endet meine Reihe &#8222;Nextcloud im Container&#8220;. Ich hoffe, ich habe euch damit ein wenig unterhalten und konnte euer Wissen durch die ein oder andere Information erweitern.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Quellen und weiterf\u00fchrende Links<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-1-der-plan\/\" data-type=\"post\" data-id=\"2993\">Nextcloud im Container \u2013 Teil 1: Der Plan<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-2-die-ansible-rolle\/\" data-type=\"post\" data-id=\"2996\">Nextcloud im Container \u2013 Teil 2: Die Ansible-Rolle<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-3-mit-reverse-proxy\/\" data-type=\"post\" data-id=\"3120\">Nextcloud im Container \u2014 Teil 3: Mit Reverse-Proxy<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-4-hier-und-da-klemmt-es\/\" data-type=\"post\" data-id=\"3140\">Nextcloud im Container \u2014 Teil 4: Hier und da klemmt es<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-5-backup-und-restore\/\" data-type=\"post\" data-id=\"3145\">Nextcloud im Container \u2013 Teil 5: Backup und Restore<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/Tronde\/ansible_role_deploy_nextcloud_with_mariadb_pod\">ansible_role_deploy_nextcloud_with_mariadb_pod<\/a> auf GitHub<\/li>\n\n\n\n<li><a href=\"https:\/\/semver.org\/lang\/de\/#semantic-versioning-200\">Semantic Versioning 2.0.0<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Herzlich willkommen zu Teil 6 meiner Reihe Nextcloud im Container. Dieser Teil behandelt das Thema Updates. Zum Verst\u00e4ndnis empfehle ich, zuerst Teil 1 und Teil 2 zu lesen. Nun w\u00fcnsche ich euch viel Spa\u00df beim Lesen und gute Unterhaltung. Gedanken zum Update Meine Nextcloud-Instanz l\u00e4uft in einem Podman-Pod. Das sieht im Terminal wie folgt aus:<span class=\"continue-reading\"> <a href=\"https:\/\/www.my-it-brain.de\/wordpress\/nextcloud-im-container-teil-6-updates\/\">[Weiterlesen&#8230;]<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_metis_text_type":"","_metis_text_length":0,"_post_count":0,"footnotes":""},"categories":[57],"tags":[701,653,685,305,522],"class_list":["post-3173","post","type-post","status-publish","format-standard","hentry","category-wochenend-projekte","tag-ansible_role","tag-containers-podman","tag-nextcloud-container","tag-planet","tag-well-known-acme-challenge-systemd-path-planet-osbn"],"_links":{"self":[{"href":"https:\/\/www.my-it-brain.de\/wordpress\/wp-json\/wp\/v2\/posts\/3173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.my-it-brain.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.my-it-brain.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.my-it-brain.de\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.my-it-brain.de\/wordpress\/wp-json\/wp\/v2\/comments?post=3173"}],"version-history":[{"count":6,"href":"https:\/\/www.my-it-brain.de\/wordpress\/wp-json\/wp\/v2\/posts\/3173\/revisions"}],"predecessor-version":[{"id":3617,"href":"https:\/\/www.my-it-brain.de\/wordpress\/wp-json\/wp\/v2\/posts\/3173\/revisions\/3617"}],"wp:attachment":[{"href":"https:\/\/www.my-it-brain.de\/wordpress\/wp-json\/wp\/v2\/media?parent=3173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.my-it-brain.de\/wordpress\/wp-json\/wp\/v2\/categories?post=3173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.my-it-brain.de\/wordpress\/wp-json\/wp\/v2\/tags?post=3173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}