diff --git a/conf/nginx-primaryonly.conf b/conf/nginx-primaryonly.conf index 31bf0095..9ed37043 100644 --- a/conf/nginx-primaryonly.conf +++ b/conf/nginx-primaryonly.conf @@ -73,4 +73,9 @@ rewrite ^/.well-known/carddav /cloud/remote.php/carddav/ redirect; rewrite ^/.well-known/caldav /cloud/remote.php/caldav/ redirect; + # This addresses those service discovery issues mentioned in: + # https://docs.nextcloud.com/server/23/admin_manual/issues/general_troubleshooting.html#service-discovery + rewrite ^/.well-known/webfinger /cloud/index.php/.well-known/webfinger redirect; + rewrite ^/.well-known/nodeinfo /cloud/index.php/.well-known/nodeinfo redirect; + # ADDITIONAL DIRECTIVES HERE diff --git a/setup/nextcloud.sh b/setup/nextcloud.sh index b79de327..9ee1626e 100755 --- a/setup/nextcloud.sh +++ b/setup/nextcloud.sh @@ -21,8 +21,8 @@ echo "Installing Nextcloud (contacts/calendar)..." # we automatically install intermediate versions as needed. # * The hash is the SHA1 hash of the ZIP package, which you can find by just running this script and # copying it from the error message when it doesn't match what is below. -nextcloud_ver=23.0.12 -nextcloud_hash=d138641b8e7aabebe69bb3ec7c79a714d122f729 +nextcloud_ver=25.0.7 +nextcloud_hash=a5a565c916355005c7b408dd41a1e53505e1a080 # Nextcloud apps # -------------- @@ -33,12 +33,16 @@ nextcloud_hash=d138641b8e7aabebe69bb3ec7c79a714d122f729 # https://github.com/nextcloud/user_external/blob/master/appinfo/info.xml # * The hash is the SHA1 hash of the ZIP package, which you can find by just running this script and # copying it from the error message when it doesn't match what is below. -contacts_ver=4.2.5 -contacts_hash=8f898f003eb6b1a85c0c43b52f829d3aa759ed88 -calendar_ver=3.5.5 -calendar_hash=8505abcf7b3ab2f32d7ca1593b545e577cbeedb4 -user_external_ver=3.1.0 -user_external_hash=22cabc88b6fc9c26dad3b46be1a652979c9fcf15 +contacts_ver=5.3.0 +contacts_hash=4b0a6666374e3b55cfd2ae9b72e1d458b87d4c8c + +# Always ensure the versions are supported, see https://apps.nextcloud.com/apps/calendar +calendar_ver=4.4.2 +calendar_hash=21a42e15806adc9b2618760ef94f1797ef399e2f + +# And https://apps.nextcloud.com/apps/user_external +user_external_ver=3.2.0 +user_external_hash=a494073dcdecbbbc79a9c77f72524ac9994d2eec # Clear prior packages and install dependencies from apt. @@ -128,6 +132,7 @@ InstallNextcloud() { # Add missing indices. NextCloud didn't include this in the normal upgrade because it might take some time. sudo -u www-data php$PHP_VER /usr/local/lib/owncloud/occ db:add-missing-indices + sudo -u www-data php$PHP_VER /usr/local/lib/owncloud/occ db:add-missing-primary-keys # Run conversion to BigInt identifiers, this process may take some time on large tables. sudo -u www-data php$PHP_VER /usr/local/lib/owncloud/occ db:convert-filecache-bigint --no-interaction @@ -173,6 +178,12 @@ if [ ! -d /usr/local/lib/owncloud/ ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextc if [ ! -z ${CURRENT_NEXTCLOUD_VER} ]; then # Database migrations from ownCloud are no longer possible because ownCloud cannot be run under # PHP 7. + + if [ -e $STORAGE_ROOT/owncloud/config.php ]; then + # Remove the read-onlyness of the config, which is needed for migrations, especially for v24 + sed -i -e '/config_is_read_only/d' $STORAGE_ROOT/owncloud/config.php + fi + if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^[89] ]]; then echo "Upgrades from Mail-in-a-Box prior to v0.28 (dated July 30, 2018) with Nextcloud < 13.0.6 (you have ownCloud 8 or 9) are not supported. Upgrade to Mail-in-a-Box version v0.30 first. Setup will continue, but skip the Nextcloud migration." return 0 @@ -183,6 +194,7 @@ if [ ! -d /usr/local/lib/owncloud/ ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextc echo "Upgrades from Mail-in-a-Box prior to v60 with Nextcloud 19 or earlier are not supported. Upgrade to the latest Mail-in-a-Box version supported on your machine first. Setup will continue, but skip the Nextcloud migration." return 0 fi + if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^20 ]]; then InstallNextcloud 21.0.7 f5c7079c5b56ce1e301c6a27c0d975d608bb01c9 4.0.7 45e7cf4bfe99cd8d03625cf9e5a1bb2e90549136 3.0.4 d0284b68135777ec9ca713c307216165b294d0fe CURRENT_NEXTCLOUD_VER="21.0.7" @@ -191,6 +203,14 @@ if [ ! -d /usr/local/lib/owncloud/ ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextc InstallNextcloud 22.2.6 9d39741f051a8da42ff7df46ceef2653a1dc70d9 4.1.0 697f6b4a664e928d72414ea2731cb2c9d1dc3077 3.2.2 ce4030ab57f523f33d5396c6a81396d440756f5f 3.0.0 0df781b261f55bbde73d8c92da3f99397000972f CURRENT_NEXTCLOUD_VER="22.2.6" fi + if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^22 ]]; then + InstallNextcloud 23.0.12 7aa5d61632c1ccf4ca3ff00fb6b295d318c05599 4.1.0 697f6b4a664e928d72414ea2731cb2c9d1dc3077 3.2.2 ce4030ab57f523f33d5396c6a81396d440756f5f 3.0.0 22cabc88b6fc9c26dad3b46be1a652979c9fcf15 + CURRENT_NEXTCLOUD_VER="23.0.12" + fi + if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^23 ]]; then + InstallNextcloud 24.0.12 7aa5d61632c1ccf4ca3ff00fb6b295d318c05599 4.1.0 697f6b4a664e928d72414ea2731cb2c9d1dc3077 3.2.2 ce4030ab57f523f33d5396c6a81396d440756f5f 3.0.0 0df781b261f55bbde73d8c92da3f99397000972f + CURRENT_NEXTCLOUD_VER="24.0.12" + fi fi InstallNextcloud $nextcloud_ver $nextcloud_hash $contacts_ver $contacts_hash $calendar_ver $calendar_hash $user_external_ver $user_external_hash @@ -284,12 +304,12 @@ php$PHP_VER < $CONFIG_TEMP && mv $CONFIG_TEMP $STORAGE_ROOT/owncloud/confi /etc/cron.d/mailinabox-nextcloud << EOF; #!/bin/bash # Mail-in-a-Box */5 * * * * root sudo -u www-data php$PHP_VER -f /usr/local/lib/owncloud/cron.php +*/5 * * * * root sudo -u www-data php$PHP_VER -f /usr/local/lib/owncloud/occ dav:send-event-reminders EOF chmod +x /etc/cron.d/mailinabox-nextcloud +# We also need to change the sending mode from background-job to occ. +# Or else the reminders will just be sent as soon as possible when the background jobs run. +hide_output sudo -u www-data php$PHP_VER -f /usr/local/lib/owncloud/occ config:app:set dav sendEventRemindersMode --value occ + +# Now set the config to read-only. +# Do this only at the very bottom when no further occ commands are needed. +sed -i'' "s/'config_is_read_only'\s*=>\s*false/'config_is_read_only' => true/" $STORAGE_ROOT/owncloud/config.php + +# Rotate the nextcloud.log file +cat > /etc/logrotate.d/nextcloud <