From e2df2cd82ef9736ff5f68b96f2a6b93988a4f137 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 5 Mar 2021 19:53:18 +0100 Subject: nextcloud-upgrade now handles config-hashes too --- inventory/host_vars/sk-cloudio/collabora.yml | 1 + inventory/host_vars/sk-cloudio/nextcloud.yml | 8 ++++---- inventory/host_vars/sk-tomnext-nc.yml | 2 +- roles/apps/nextcloud/tasks/main.yml | 9 +++++++-- roles/apps/nextcloud/templates/nextcloud-upgrade.j2 | 14 +++++++++++--- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/inventory/host_vars/sk-cloudio/collabora.yml b/inventory/host_vars/sk-cloudio/collabora.yml index c491c55d..713f6f1a 100644 --- a/inventory/host_vars/sk-cloudio/collabora.yml +++ b/inventory/host_vars/sk-cloudio/collabora.yml @@ -14,3 +14,4 @@ collabora_code_instances: - insomnia.skillz.biz - nc.skillz.biz - wae.elevate.at + - wolke.elev8.at diff --git a/inventory/host_vars/sk-cloudio/nextcloud.yml b/inventory/host_vars/sk-cloudio/nextcloud.yml index 717ced2e..f2f8de9b 100644 --- a/inventory/host_vars/sk-cloudio/nextcloud.yml +++ b/inventory/host_vars/sk-cloudio/nextcloud.yml @@ -8,7 +8,7 @@ nextcloud_zfs: nextcloud_instances: wolke.elevate.at: # new: true - version: 19.0.8 + version: 20.0.8 port: 8100 hostnames: - wolke.elevate.at @@ -20,7 +20,7 @@ nextcloud_instances: password: "{{ vault_nextcloud_database_passwords['wolke.elevate.at'] }}" insomnia.skillz.biz: # new: true - version: 19.0.8 + version: 20.0.8 port: 8101 hostnames: - insomnia.skillz.biz @@ -32,7 +32,7 @@ nextcloud_instances: password: "{{ vault_nextcloud_database_passwords['insomnia.skillz.biz'] }}" nc.skillz.biz: # new: true - version: 20.0.6 + version: 21.0.0 port: 8102 hostnames: - nc.skillz.biz @@ -44,7 +44,7 @@ nextcloud_instances: password: "{{ vault_nextcloud_database_passwords['nc.skillz.biz'] }}" wae.elevate.at: # new: true - version: 19.0.8 + version: 20.0.8 port: 8104 hostnames: - wae.elevate.at diff --git a/inventory/host_vars/sk-tomnext-nc.yml b/inventory/host_vars/sk-tomnext-nc.yml index a3b586b2..f3538c07 100644 --- a/inventory/host_vars/sk-tomnext-nc.yml +++ b/inventory/host_vars/sk-tomnext-nc.yml @@ -117,7 +117,7 @@ nextcloud_zfs: nextcloud_instances: team.tomwaitz.eu: # new: true - version: 20.0.6 + version: 20.0.7 port: 8100 hostnames: - team.tomwaitz.eu diff --git a/roles/apps/nextcloud/tasks/main.yml b/roles/apps/nextcloud/tasks/main.yml index 1a583f4e..14aa7085 100644 --- a/roles/apps/nextcloud/tasks/main.yml +++ b/roles/apps/nextcloud/tasks/main.yml @@ -197,7 +197,12 @@ ** Go to https://{{ item.value.hostnames[0] }} and finalize the ** installation. After that run the following commands: ** - ** $ nextcloud-occ {{ item.key }} db:add-missing-indices - ** $ nextcloud-occ {{ item.key }} db:convert-filecache-bigint + ** $ nextcloud-occ {{ item.key }} app:disable richdocumentscode + ** $ nextcloud-occ {{ item.key }} app:remove richdocumentscode + ** + ** Also please add the following option to the file + ** "{{ nextcloud_base_path }}/{{ item.key }}/nextcloud/config/config.php" + ** + ** 'default_phone_region' => 'at', ** **************************************** diff --git a/roles/apps/nextcloud/templates/nextcloud-upgrade.j2 b/roles/apps/nextcloud/templates/nextcloud-upgrade.j2 index 13178f0f..f59f3be6 100755 --- a/roles/apps/nextcloud/templates/nextcloud-upgrade.j2 +++ b/roles/apps/nextcloud/templates/nextcloud-upgrade.j2 @@ -9,6 +9,8 @@ fi set -eu +K8S_CONFIG_HASH_D="/etc/kubernetes/config-hashes/" +K8S_CONFIG_HASH_FILE="$K8S_CONFIG_HASH_D/nextcloud-$INST_NAME.yml" K8S_MANIFEST_D="/etc/kubernetes/manifests/" K8S_MANIFEST_FILE="$K8S_MANIFEST_D/nextcloud-$INST_NAME.yml" if [ ! -e "$K8S_MANIFEST_FILE" ]; then @@ -48,16 +50,22 @@ CURRENT_VERSION=$(cat "$K8S_MANIFEST_FILE" | awk '/image: "'"$IMAGE_NAME_ESCAPED zfs snapshot "{{ nextcloud_zfs.pool }}/{{ nextcloud_zfs.name }}/$INST_NAME@upgrade_$CURRENT_VERSION-to-$VERSION""_$(date '+%Y-%m-%m_%H:%M:%S')" {% endif %} +echo "*** Rebuilding config-hash file" +echo "" +cat "$K8S_CONFIG_HASH_FILE" | grep '^/.*:' | sed 's/:$//' | xargs sha256sum | awk '{ print($2":\n checksum: "$1) }' > "$TMP_D/config-hash.yml" +CONFIG_HASH=$(sha256sum "$TMP_D/config-hash.yml" | awk '{ print($1) }') + echo "*** Patching manifest file" echo "" -sed "s#image: \"$IMAGE_NAME:.*\"#image: \"$IMAGE_NAME:$VERSION\"#" "$K8S_MANIFEST_FILE" > "$TMP_D/upgraded.yml" +sed -e "s#image: \"$IMAGE_NAME:.*\"#image: \"$IMAGE_NAME:$VERSION\"#" -e "s#config-hash: \".*\"#config-hash: \"$CONFIG_HASH\"#" "$K8S_MANIFEST_FILE" > "$TMP_D/manifest.yml" set +e -diff -u "$K8S_MANIFEST_FILE" "$TMP_D/upgraded.yml" +diff -u "$K8S_MANIFEST_FILE" "$TMP_D/manifest.yml" if [ $? -eq 0 ]; then echo "patching file failed?" exit 2 fi -cat "$TMP_D/upgraded.yml" > "$K8S_MANIFEST_FILE" +cat "$TMP_D/config-hash.yml" > "$K8S_CONFIG_HASH_FILE" +cat "$TMP_D/manifest.yml" > "$K8S_MANIFEST_FILE" echo "" exit 0 -- cgit v1.2.3