diff options
author | Christian Pointner <equinox@spreadspace.org> | 2021-03-05 19:53:18 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2021-03-05 19:53:18 +0100 |
commit | e2df2cd82ef9736ff5f68b96f2a6b93988a4f137 (patch) | |
tree | 63e2d28442883ce5a33265d515c347cd58326f2e /roles/apps | |
parent | update blackmagic desktop video (diff) |
nextcloud-upgrade now handles config-hashes too
Diffstat (limited to 'roles/apps')
-rw-r--r-- | roles/apps/nextcloud/tasks/main.yml | 9 | ||||
-rwxr-xr-x | roles/apps/nextcloud/templates/nextcloud-upgrade.j2 | 14 |
2 files changed, 18 insertions, 5 deletions
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 |