Skip to content

Commit

Permalink
Update Nextcloud to v29.0.4 (#1297)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmfretz authored Aug 6, 2024
1 parent 49580db commit cee2764
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 8 deletions.
6 changes: 3 additions & 3 deletions nextcloud/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
- "${APP_DATA_DIR}/data/redis:/data"

web:
image: nextcloud:28.0.3-apache@sha256:ed07f89119dcca2a3711897c48a8ac969542d96d69384445d8fcdc7804ca946f
image: nextcloud:29.0.4-apache@sha256:12c7bb0da1d41a08583971d5ba9771c4f37592ddd0aae5f5ce6a306961caa674
# Currently needs to be run as root, if we run as uid 1000 this fails
# https://github.com/nextcloud/docker/blob/05026b029d37fc5cd488d4a4a2a79480e39841ba/21.0/apache/entrypoint.sh#L53-L77
# user: "1000:1000"
Expand All @@ -44,14 +44,14 @@ services:
- TRUSTED_PROXIES="${NETWORK_IP}/16"
- NEXTCLOUD_ADMIN_USER=umbrel
- NEXTCLOUD_ADMIN_PASSWORD=${APP_PASSWORD}
- NEXTCLOUD_TRUSTED_DOMAINS=${APP_DOMAIN}:${APP_NEXTCLOUD_PORT} ${APP_HIDDEN_SERVICE} ${DEVICE_HOSTNAME}:${APP_NEXTCLOUD_PORT} ${APP_NEXTCLOUD_LOCAL_IPS}
- NEXTCLOUD_TRUSTED_DOMAINS=${APP_DOMAIN}:${APP_NEXTCLOUD_PORT} ${APP_HIDDEN_SERVICE} ${DEVICE_HOSTNAME}:${APP_NEXTCLOUD_PORT} ${APP_NEXTCLOUD_LOCAL_IPS} nextcloud_web_1
- PHP_UPLOAD_LIMIT=1024G
depends_on:
- db
- redis

cron:
image: nextcloud:28.0.3-apache@sha256:ed07f89119dcca2a3711897c48a8ac969542d96d69384445d8fcdc7804ca946f
image: nextcloud:29.0.4-apache@sha256:12c7bb0da1d41a08583971d5ba9771c4f37592ddd0aae5f5ce6a306961caa674
# Currently needs to be run as root, if we run as uid 1000 this fails
# https://github.com/nextcloud/docker/blob/05026b029d37fc5cd488d4a4a2a79480e39841ba/21.0/apache/entrypoint.sh#L53-L77
# user: "1000:1000"
Expand Down
44 changes: 44 additions & 0 deletions nextcloud/hooks/post-update
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -euo pipefail

# This script checks the Nextcloud config.php file for the presence of 'nextcloud_web_1' in the trusted_domains array and adds it if it doesn't exist. Pre-29.0.4 installs on umbrelOS will not have the domain added via `NEXTCLOUD_TRUSTED_DOMAIN`.
# This is handled in a post-update hook to make sure we don't interfere with the Nextcloud startup process and pre-start script where config.php is being written to.

APP_DATA_DIR="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
CONFIG_PHP_FILE="${APP_DATA_DIR}/data/nextcloud/config/config.php"

DOMAIN_TO_ADD="nextcloud_web_1"

domain_exists() {
grep -q "'$DOMAIN_TO_ADD'" "$CONFIG_PHP_FILE"
}

get_highest_index() {
awk -F "=>" '/trusted_domains/ {
max = 0
while (getline && !/\),/) {
if ($1 ~ /^[[:space:]]*[0-9]+/) {
split($1, a, " ")
if (a[1] > max) max = a[1]
}
}
print max
}' "$CONFIG_PHP_FILE"
}

if domain_exists; then
echo "Domain '$DOMAIN_TO_ADD' already exists in trusted_domains."
else
echo "Domain '$DOMAIN_TO_ADD' not found. Adding it to trusted_domains..."

# Get the highest current index in the trusted_domains array
highest_index=$(get_highest_index)

# Calculate the new index to add
new_index=$((highest_index + 1))

# Add the new domain entry
sed -i "/trusted_domains/,/),/ s/),/ $new_index => '$DOMAIN_TO_ADD',\n&/" "$CONFIG_PHP_FILE"

echo "Domain '$DOMAIN_TO_ADD' added successfully."
fi
9 changes: 7 additions & 2 deletions nextcloud/hooks/pre-start
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ CONFIG_PHP_FILE="${APP_DATA_DIR}/data/nextcloud/config/config.php"
APP_COMPOSE_FILE="${APP_DATA_DIR}/docker-compose.yml"
APP_COMPOSE_BACKUP_FILE="${APP_DATA_DIR}/docker-compose.yml.bak"

# TODO: When Nextcloud 30 is released, refactor this script to handle updates from all patch versions released to the umbrel app store.

# Supported list of Nextcloud migrations
VERSIONS=()
VERSIONS+=( "22.1.1.2" )
Expand All @@ -18,7 +20,9 @@ VERSIONS+=( "24.0.7.1" )
VERSIONS+=( "25.0.1.1" )
VERSIONS+=( "26.0.9.1" )
VERSIONS+=( "27.0.2.1" )
VERSIONS+=( "28.0.0.11" )
VERSIONS+=( "28.0.3.2" )
VERSIONS+=( "29.0.4.1" )


IMAGES=()
IMAGES+=( "nextcloud:22.1.1-apache@sha256:99d94124b2024c9f7f38dc12144a92bc0d68d110bcfd374169ebb7e8df0adf8e" )
Expand All @@ -28,7 +32,8 @@ IMAGES+=( "nextcloud:24.0.7-apache@sha256:f95a21b598b7470b788251db5b0bbe9516992f
IMAGES+=( "nextcloud:25.0.1-apache@sha256:a200319b132c01ec3486e0dcaf052092b560ec30ac9b78115607696dd201f704" )
IMAGES+=( "nextcloud:26.0.9-apache@sha256:23180fbe8169d428ce0058bfc8d47793628a16e00e40b495d82e4504a124b3fa" )
IMAGES+=( "nextcloud:27.0.2-apache@sha256:3c8040278bdc991cbc025278eaffc4978a9c2fd4ac34e95b10f646dcadb7c3fb" )
IMAGES+=( "nextcloud:28.0.0-apache@sha256:0d3dcb01cfff7775873a4f50768c3561c956bfeab9be59647754d9c1fe88b14c" )
IMAGES+=( "nextcloud:28.0.3-apache@sha256:ed07f89119dcca2a3711897c48a8ac969542d96d69384445d8fcdc7804ca946f" )
IMAGES+=( "nextcloud:29.0.4-apache@sha256:12c7bb0da1d41a08583971d5ba9771c4f37592ddd0aae5f5ce6a306961caa674" )

find_index() {
local -r value="${1}"
Expand Down
10 changes: 7 additions & 3 deletions nextcloud/umbrel-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ manifestVersion: 1.1
id: nextcloud
category: files
name: Nextcloud
version: "28.0.3"
version: "29.0.4"
tagline: Productivity platform that keeps you in control
description: >-
Nextcloud puts your data at your fingertips, under your control.
Expand All @@ -25,9 +25,13 @@ description: >-
Note: After logging in to Nextcloud please change the password to something secure before sharing the address with anyone.
releaseNotes: >-
This patch update takes Nextcloud from version 28.0.2 to 28.0.3 and is a minor update that includes many changes/fixes.
This is a major upgrade of Nextcloud on umbrelOS, updating from version 28.0.3 to 29.0.4. The Nextcloud app on the Umbrel app store will now receive updates in alignment with the official Nextcloud release schedule.
Full release details for all Nextcloud versions can be found at https://nextcloud.com/changelog/
This update may take several minutes to complete. Nextcloud may be unavailable for a few minutes during the update process.
Full release notes can be found at https://github.com/nextcloud/server/releases
developer: Nextcloud GmbH
website: https://nextcloud.com
dependencies: []
Expand Down

0 comments on commit cee2764

Please sign in to comment.