From 4bce1bb99f05cbe0b742b2dad1cd0e6447c19318 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Wed, 26 Sep 2018 20:38:30 -0600 Subject: upgrade to PHP7.2 --- README.md | 2 +- buildlib.sh | 2 +- changelog.md | 12 ++++--- docker-common/lamp/010lamp | 6 ++-- etc/ncp-config.d/nc-datadir.sh | 10 +++--- etc/ncp-config.d/nc-limits.sh | 7 ++-- etc/ncp-config.d/nc-nextcloud.sh | 24 +++++++------ etc/ncp-config.d/nc-restore.sh | 13 +++---- etc/ncp-config.d/samba.sh | 2 +- lamp.sh | 29 ++++++++++++---- update.sh | 74 ++++++++++++++++++++++++++++++++++++++-- 11 files changed, 139 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index d8164ee8..c94c165d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This code also generates the [NextCloudPi docker images](https://hub.docker.com/ * Raspbian 9 stretch * Nextcloud 14.0.1 * Apache 2.4.25, with HTTP2 enabled - * PHP 7.0 (double the speed of PHP5!) + * PHP 7.2 * MariaDB 10 * Redis memory cache ( NEW 11-12-2017 ) * 4.9 Linux Kernel ( NEW 03-13-2017 ) diff --git a/buildlib.sh b/buildlib.sh index 4346877f..8509a2b8 100644 --- a/buildlib.sh +++ b/buildlib.sh @@ -194,7 +194,7 @@ function resize_image() echo -e "\n\e[1m[ Resize Image ]\e[0m" fallocate -l$SIZE "$IMG" parted "$IMG" -- resizepart 2 -1s - DEV="$( losetup -f )" + DEV="$( sudo losetup -f )" mount_raspbian "$IMG" sudo resize2fs -f "$DEV" echo "Image resized" diff --git a/changelog.md b/changelog.md index c7ee6284..df54143a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,15 +1,19 @@ -[v0.60.8](https://github.com/nextcloud/nextcloudpi/commit/57999b6) (2018-09-24) ncp-web: put configuration in a separate file from available languages +[v0.62.0](https://github.com/nextcloud/nextcloudpi/commit/aca5004) (2018-09-23) upgrade to NC14 -[v0.60.7](https://github.com/nextcloud/nextcloudpi/commit/cdbb750) (2018-09-24) docker: disable auto-upgrade until it is adapted to containers +[v0.61.0, php72](https://github.com/nextcloud/nextcloudpi/commit/20c1e8a) (2018-06-21) upgrade to PHP7.2 + +[v0.60.8](https://github.com/nextcloud/nextcloudpi/commit/6152e7e) (2018-09-24) ncp-web: put configuration in a separate file from available languages + +[v0.60.7 ](https://github.com/nextcloud/nextcloudpi/commit/cdbb750) (2018-09-24) docker: disable auto-upgrade until it is adapted to containers [v0.60.6 ](https://github.com/nextcloud/nextcloudpi/commit/1150ed8) (2018-09-24) nc-format-USB: fix [v0.60.5 ](https://github.com/nextcloud/nextcloudpi/commit/3de5fe0) (2018-09-23) armbian: fix locales for ncp-config -[v0.60.4, master](https://github.com/nextcloud/nextcloudpi/commit/a7f0fd2) (2018-09-23) build: use a separate file for NCP database config +[v0.60.4 ](https://github.com/nextcloud/nextcloudpi/commit/a7f0fd2) (2018-09-23) build: use a separate file for NCP database config -[v0.60.3](https://github.com/nextcloud/nextcloudpi/commit/1bfcebc) (2018-09-23) nc-update-nextcloud: workaround news integrity bug +[v0.60.3 ](https://github.com/nextcloud/nextcloudpi/commit/1bfcebc) (2018-09-23) nc-update-nextcloud: workaround news integrity bug [v0.60.2 ](https://github.com/nextcloud/nextcloudpi/commit/5914624) (2018-09-21) DDNS_spdyn.sh : Send new IP only when changed. diff --git a/docker-common/lamp/010lamp b/docker-common/lamp/010lamp index 6948af92..b5f384c4 100755 --- a/docker-common/lamp/010lamp +++ b/docker-common/lamp/010lamp @@ -1,5 +1,7 @@ #!/bin/bash +PHPVER=7.2 + source /usr/local/etc/library.sh set -e @@ -8,7 +10,7 @@ set -e echo "Stopping apache" apachectl graceful-stop echo "Stopping PHP-fpm" - killall php-fpm7.0 + killall php-fpm${PHPVER} echo "Stopping mariaDB" mysqladmin -u root shutdown echo "LAMP cleanup complete" @@ -19,7 +21,7 @@ set -e persistent_cfg /etc/apache2 echo "Starting PHP-fpm" -php-fpm7.0 & +php-fpm${PHPVER} echo "Starting Apache" /usr/sbin/apache2ctl start diff --git a/etc/ncp-config.d/nc-datadir.sh b/etc/ncp-config.d/nc-datadir.sh index 4c4a45c4..ba97d2eb 100644 --- a/etc/ncp-config.d/nc-datadir.sh +++ b/etc/ncp-config.d/nc-datadir.sh @@ -14,6 +14,8 @@ DESCRIPTION="Change your data dir to a new location, like a USB drive" INFO="Note that non Unix filesystems such as NTFS are not supported because they do not provide a compatible user/permissions system" +PHPVER=7.2 + is_active() { local SRCDIR @@ -91,12 +93,12 @@ configure() # tmp upload dir mkdir -p "$DATADIR_/tmp" chown www-data:www-data "$DATADIR_/tmp" - sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $DATADIR_/tmp|" /etc/php/7.0/cli/php.ini - sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $DATADIR_/tmp|" /etc/php/7.0/fpm/php.ini - sed -i "s|^;\?sys_temp_dir =.*$|sys_temp_dir = $DATADIR_/tmp|" /etc/php/7.0/fpm/php.ini + sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $DATADIR_/tmp|" /etc/php/${PHPVER}/cli/php.ini + sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $DATADIR_/tmp|" /etc/php/${PHPVER}/fpm/php.ini + sed -i "s|^;\?sys_temp_dir =.*$|sys_temp_dir = $DATADIR_/tmp|" /etc/php/${PHPVER}/fpm/php.ini # opcache dir - sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$DATADIR_/.opcache|" /etc/php/7.0/mods-available/opcache.ini + sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$DATADIR_/.opcache|" /etc/php/${PHPVER}/mods-available/opcache.ini # update fail2ban logpath sed -i "s|logpath =.*nextcloud.log|logpath = $DATADIR_/nextcloud.log|" /etc/fail2ban/jail.conf diff --git a/etc/ncp-config.d/nc-limits.sh b/etc/ncp-config.d/nc-limits.sh index 2083a58b..1687d692 100644 --- a/etc/ncp-config.d/nc-limits.sh +++ b/etc/ncp-config.d/nc-limits.sh @@ -12,6 +12,7 @@ MAXFILESIZE_=10G MEMORYLIMIT_=0 PHPTHREADS_=0 REDISMEM_=0 +PHPVER=7.2 DESCRIPTION="Configure system limits for NextCloudPi" INFO="Examples: 200M or 2G. Write 0 for autoconfig" @@ -36,7 +37,7 @@ configure() sed -i "s/memory_limit=.*/memory_limit=$MEMORYLIMIT_/" "$CONF" # MAX PHP THREADS - local CONF=/etc/php/7.0/fpm/pool.d/www.conf + local CONF=/etc/php/${PHPVER}/fpm/pool.d/www.conf local CURRENT_THREADS=$( grep "^pm.max_children" "$CONF" | awk '{ print $3 }' ) [[ "$PHPTHREADS_" == "0" ]] && PHPTHREADS_=$( nproc ) && echo "Using $PHPTHREADS_ PHP threads" sed -i "s|pm.max_children =.*|pm.max_children = $PHPTHREADS_|" "$CONF" @@ -48,10 +49,10 @@ configure() [[ "$MEMORYLIMIT" != "$CURRENT_PHP_MEM" ]] || \ [[ "$MAXFILESIZE_" != "$CURRENT_FILE_SIZE" ]] && { bash -c " sleep 3 - service php7.0-fpm stop + service php${PHPVER}-fpm stop service mysql stop sleep 0.5 - service php7.0-fpm start + service php${PHPVER}-fpm start service mysql start " &>/dev/null & } diff --git a/etc/ncp-config.d/nc-nextcloud.sh b/etc/ncp-config.d/nc-nextcloud.sh index eee79c79..0ce3b075 100644 --- a/etc/ncp-config.d/nc-nextcloud.sh +++ b/etc/ncp-config.d/nc-nextcloud.sh @@ -15,6 +15,7 @@ MEMORYLIMIT_=768M MAXTRANSFERTIME_=3600 DBADMIN=ncadmin REDIS_MEM=3gb +PHPVER=7.2 DESCRIPTION="Install any NextCloud version" APTINSTALL="apt-get install -y --no-install-recommends" @@ -40,8 +41,9 @@ install() # Optional packets for Nextcloud and Apps apt-get update $APTINSTALL lbzip2 iputils-ping - $APTINSTALL php-smbclient # for external storage - $APTINSTALL php-imagick imagemagick-6-common # for gallery + $APTINSTALL -t buster php-smbclient # for external storage + $APTINSTALL -t buster imagemagick php${PHPVER}-imagick php${PHPVER}-exif # for gallery + # POSTFIX $APTINSTALL postfix || { @@ -54,8 +56,8 @@ install() mv /newaliases /usr/bin/newaliases } - # REDIS - $APTINSTALL redis-server php7.0-redis + $APTINSTALL redis-server + $APTINSTALL -t buster php${PHPVER}-redis local REDIS_CONF=/etc/redis/redis.conf local REDISPASS="default" @@ -74,10 +76,10 @@ install() systemctl restart redis-server systemctl enable redis-server - systemctl stop php7.0-fpm + systemctl stop php${PHPVER}-fpm systemctl stop mysql sleep 0.5 - systemctl start php7.0-fpm + systemctl start php${PHPVER}-fpm systemctl start mysql } @@ -155,8 +157,8 @@ configure() fi # create and configure opcache dir - OPCACHEDIR=/var/www/nextcloud/data/.opcache - sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$OPCACHEDIR|" /etc/php/7.0/mods-available/opcache.ini + local OPCACHEDIR=/var/www/nextcloud/data/.opcache + sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$OPCACHEDIR|" /etc/php/${PHPVER}/mods-available/opcache.ini mkdir -p $OPCACHEDIR chown -R www-data:www-data $OPCACHEDIR @@ -242,9 +244,9 @@ EOF local UPLOADTMPDIR=/var/www/nextcloud/data/tmp mkdir -p "$UPLOADTMPDIR" chown www-data:www-data "$UPLOADTMPDIR" - sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $UPLOADTMPDIR|" /etc/php/7.0/cli/php.ini - sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $UPLOADTMPDIR|" /etc/php/7.0/fpm/php.ini - sed -i "s|^;\?sys_temp_dir =.*$|sys_temp_dir = $UPLOADTMPDIR|" /etc/php/7.0/fpm/php.ini + sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $UPLOADTMPDIR|" /etc/php/${PHPVER}/cli/php.ini + sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $UPLOADTMPDIR|" /etc/php/${PHPVER}/fpm/php.ini + sed -i "s|^;\?sys_temp_dir =.*$|sys_temp_dir = $UPLOADTMPDIR|" /etc/php/${PHPVER}/fpm/php.ini # slow transfers will be killed after this time diff --git a/etc/ncp-config.d/nc-restore.sh b/etc/ncp-config.d/nc-restore.sh index ee1bd731..59321007 100644 --- a/etc/ncp-config.d/nc-restore.sh +++ b/etc/ncp-config.d/nc-restore.sh @@ -31,6 +31,7 @@ BACKUPFILE="$1" DBADMIN=ncadmin DBPASSWD="$( grep password /root/.my.cnf | sed 's|password=||' )" +PHPVER=7.2 DIR="$( cd "$( dirname "$BACKUPFILE" )" &>/dev/null && pwd )" #abspath @@ -140,14 +141,14 @@ else fi # Just in case we moved the opcache dir -sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$DATADIR/.opcache|" /etc/php/7.0/mods-available/opcache.ini +sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$DATADIR/.opcache|" /etc/php/${PHPVER}/mods-available/opcache.ini # tmp upload dir mkdir -p "$DATADIR/tmp" chown www-data:www-data "$DATADIR/tmp" -sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $DATADIR/tmp|" /etc/php/7.0/cli/php.ini -sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $DATADIR/tmp|" /etc/php/7.0/fpm/php.ini -sed -i "s|^;\?sys_temp_dir =.*$|sys_temp_dir = $DATADIR/tmp|" /etc/php/7.0/fpm/php.ini +sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $DATADIR/tmp|" /etc/php/${PHPVER}/cli/php.ini +sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $DATADIR/tmp|" /etc/php/${PHPVER}/fpm/php.ini +sed -i "s|^;\?sys_temp_dir =.*$|sys_temp_dir = $DATADIR/tmp|" /etc/php/${PHPVER}/fpm/php.ini # update fail2ban logpath [[ ! -f /.docker-image ]] && { @@ -161,10 +162,10 @@ bash /usr/local/bin/nextcloud-domain.sh # restart PHP if needed [[ "$NEED_RESTART" == "1" ]] && \ bash -c " sleep 3 - service php7.0-fpm stop + service php${PHPVER}-fpm stop service mysql stop sleep 0.5 - service php7.0-fpm start + service php${PHPVER}-fpm start service mysql start " &>/dev/null & EOF diff --git a/etc/ncp-config.d/samba.sh b/etc/ncp-config.d/samba.sh index aac737dd..367e9296 100644 --- a/etc/ncp-config.d/samba.sh +++ b/etc/ncp-config.d/samba.sh @@ -21,7 +21,7 @@ This can be done manually or automatically using 'nc-scan' and 'nc-scan-auto'" install() { apt-get update - apt-get install --no-install-recommends -y samba + apt-get install --no-install-recommends -y -t buster samba update-rc.d smbd disable update-rc.d nmbd disable diff --git a/lamp.sh b/lamp.sh index 8e05eee8..0ee59fbc 100644 --- a/lamp.sh +++ b/lamp.sh @@ -19,21 +19,36 @@ # More at https://ownyourbits.com/2017/02/13/nextcloud-ready-raspberry-pi-image/ # +PHPVER=7.2 APTINSTALL="apt-get install -y --no-install-recommends" export DEBIAN_FRONTEND=noninteractive install() { - apt-get update + # Raspbian still doesn't support Buster -> http://archive.raspberrypi.org/debian/dists/ + # Get Debian Buster sources + echo "deb https://deb.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list.d/ncp-buster.list +cat > /etc/apt/preferences.d/10-ncp-buster < /etc/php/7.0/mods-available/opcache.ini < /etc/php/${PHPVER}/mods-available/opcache.ini </dev/null } - # fix locale for Armbian images, for ncp-config - [[ "$LANG" == "" ]] && localectl set-locale LANG=en_US.utf8 + # PHP7.2 + [[ -e /etc/php/7.2 ]] || { + PHPVER=7.2 + APTINSTALL="apt-get install -y --no-install-recommends" + export DEBIAN_FRONTEND=noninteractive + + ncc maintenance:mode --on + + apt-get update + $APTINSTALL apt-transport-https + + echo "deb https://deb.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list.d/ncp-buster.list +cat > /etc/apt/preferences.d/10-ncp-buster < /etc/php/${PHPVER}/mods-available/opcache.ini </dev/null & + bash -c " sleep 3 + service php${PHPVER}-fpm stop + service mysql stop + sleep 0.5 + service php${PHPVER}-fpm start + service mysql start + " &>/dev/null & + } } # end - only live updates -- cgit v1.2.3