0
0
Fork 0
mirror of https://github.com/nextcloud/docker.git synced 2025-04-21 11:06:09 +02:00

fix upgrade process

This commit is contained in:
Christian Kniep 2021-07-22 16:13:57 +02:00
parent f69bcf3d1c
commit 3481db03a0
2 changed files with 11 additions and 2 deletions

View file

@ -6,7 +6,10 @@ services:
command: --transaction-isolation=READ-COMMITTED command: --transaction-isolation=READ-COMMITTED
volumes: volumes:
- db_data:/var/lib/mysql - db_data:/var/lib/mysql
- /run/mysqld/
- /tmp
restart: unless-stopped restart: unless-stopped
read_only: true
environment: environment:
MARIADB_RANDOM_ROOT_PASSWORD: "yes" MARIADB_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_DATABASE: nextcloud MYSQL_DATABASE: nextcloud
@ -17,6 +20,7 @@ services:
depends_on: depends_on:
- db - db
image: ${NC_IMAGE_NAME:-nextcloud:latest} image: ${NC_IMAGE_NAME:-nextcloud:latest}
read_only: true
volumes: volumes:
- nextcloud_data:/var/www/html/data - nextcloud_data:/var/www/html/data
- nextcloud_apps:/var/www/html/apps - nextcloud_apps:/var/www/html/apps
@ -26,9 +30,10 @@ services:
- "8000:80" - "8000:80"
restart: always restart: always
environment: environment:
NEXTCLOUD_ADMIN_USER: adminstrator NEXTCLOUD_ADMIN_USER: administrator
NEXTCLOUD_ADMIN_PASSWORD: adminpass NEXTCLOUD_ADMIN_PASSWORD: adminpass
NEXTCLOUD_TRUSTED_DOMAINS: localhost NEXTCLOUD_TRUSTED_DOMAINS: localhost
### Commented out as this will make the entrypoint assume that a clean install is appropriate
MYSQL_DATABASE: nextcloud MYSQL_DATABASE: nextcloud
MYSQL_PASSWORD: nextcloud MYSQL_PASSWORD: nextcloud
MYSQL_USER: nextcloud MYSQL_USER: nextcloud

View file

@ -79,6 +79,9 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
installed_version="0.0.0.0" installed_version="0.0.0.0"
# shellcheck disable=SC2016 # shellcheck disable=SC2016
if [ -f /var/www/html/config/version.php ];then
installed_version="$(php -r 'require "/var/www/html/config/version.php"; echo implode(".", $OC_Version);')"
fi
image_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')" image_version="$(php -r 'require "/var/www/html/version.php"; echo implode(".", $OC_Version);')"
if version_greater "$installed_version" "$image_version"; then if version_greater "$installed_version" "$image_version"; then
@ -175,14 +178,15 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
fi fi
#upgrade #upgrade
else else
chown -R www-data:root /var/www/html/apps /var/www/html/custom_apps /var/www/html/data
run_as 'php /var/www/html/occ upgrade' run_as 'php /var/www/html/occ upgrade'
run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after run_as 'php /var/www/html/occ app:list' | sed -n "/Enabled:/,/Disabled:/p" > /tmp/list_after
echo "The following apps have been disabled:" echo "The following apps have been disabled:"
diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1 diff /tmp/list_before /tmp/list_after | grep '<' | cut -d- -f2 | cut -d: -f1
rm -f /tmp/list_before /tmp/list_after rm -f /tmp/list_before /tmp/list_after
fi fi
cp /var/www/html/version.php /var/www/html/config/version.php
fi fi
fi fi