diff options
author | nachoparker <nacho@ownyourbits.com> | 2018-09-27 05:38:30 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-09-29 17:55:23 +0300 |
commit | 4bce1bb99f05cbe0b742b2dad1cd0e6447c19318 (patch) | |
tree | 193461775a4fb1951bfb13f0eff97e403dfa57a6 | |
parent | 66e4d83917c2014f17ad0259fe3de664246e814b (diff) |
upgrade to PHP7.2v0.62.0
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | buildlib.sh | 2 | ||||
-rw-r--r-- | changelog.md | 12 | ||||
-rwxr-xr-x | docker-common/lamp/010lamp | 6 | ||||
-rw-r--r-- | etc/ncp-config.d/nc-datadir.sh | 10 | ||||
-rw-r--r-- | etc/ncp-config.d/nc-limits.sh | 7 | ||||
-rw-r--r-- | etc/ncp-config.d/nc-nextcloud.sh | 24 | ||||
-rw-r--r-- | etc/ncp-config.d/nc-restore.sh | 13 | ||||
-rw-r--r-- | etc/ncp-config.d/samba.sh | 2 | ||||
-rw-r--r-- | lamp.sh | 29 | ||||
-rwxr-xr-x | update.sh | 74 |
11 files changed, 139 insertions, 42 deletions
@@ -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 @@ -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 <<EOF +Package: * +Pin: release n=stretch +Pin-Priority: 600 +EOF + + # Debian Buster repository keys are not in the Raspbian Stretch keyring. Install the Debian keyring + apt-get --allow-unauthenticated update + $APTINSTALL --allow-unauthenticated debian-archive-keyring # INSTALL ########################################## + apt-get update $APTINSTALL apt-utils cron $APTINSTALL apache2 - $APTINSTALL php7.0 php7.0-curl php7.0-gd php7.0-fpm php7.0-cli php7.0-opcache \ - php7.0-mbstring php7.0-xml php7.0-zip php7.0-fileinfo php7.0-ldap \ - php7.0-intl libmagickcore-6.q16-2-extra php7.0-imagick php-mcrypt + + $APTINSTALL -t buster php${PHPVER} php${PHPVER}-curl php${PHPVER}-gd php${PHPVER}-fpm php${PHPVER}-cli php${PHPVER}-opcache \ + php${PHPVER}-mbstring php${PHPVER}-xml php${PHPVER}-zip php${PHPVER}-fileinfo php${PHPVER}-ldap \ + php${PHPVER}-intl php${PHPVER}-bz2 php${PHPVER}-json + mkdir -p /run/php # mariaDB password @@ -43,7 +58,7 @@ install() debconf-set-selections <<< "mariadb-server-5.5 mysql-server/root_password password $DBPASSWD" debconf-set-selections <<< "mariadb-server-5.5 mysql-server/root_password_again password $DBPASSWD" - $APTINSTALL mariadb-server php7.0-mysql + $APTINSTALL mariadb-server php${PHPVER}-mysql mkdir -p /run/mysqld chown mysql /run/mysqld @@ -85,7 +100,7 @@ EOF # CONFIGURE PHP7 ########################################## - cat > /etc/php/7.0/mods-available/opcache.ini <<EOF + cat > /etc/php/${PHPVER}/mods-available/opcache.ini <<EOF zend_extension=opcache.so opcache.enable=1 opcache.enable_cli=1 @@ -101,7 +116,7 @@ EOF a2enmod http2 a2enconf http2 a2enmod proxy_fcgi setenvif - a2enconf php7.0-fpm + a2enconf php${PHPVER}-fpm a2enmod rewrite a2enmod headers a2enmod dir @@ -186,8 +186,78 @@ EOF cd - &>/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 <<EOF +Package: * +Pin: release n=stretch +Pin-Priority: 600 +EOF + + apt-get --allow-unauthenticated update + $APTINSTALL --allow-unauthenticated debian-archive-keyring + + apt-get update + + apt-get purge -y php7.0-* + apt-get autoremove -y + + $APTINSTALL -t buster php${PHPVER} php${PHPVER}-curl php${PHPVER}-gd php${PHPVER}-fpm php${PHPVER}-cli php${PHPVER}-opcache \ + php${PHPVER}-mbstring php${PHPVER}-xml php${PHPVER}-zip php${PHPVER}-fileinfo php${PHPVER}-ldap \ + php${PHPVER}-intl php${PHPVER}-bz2 php${PHPVER}-json + + $APTINSTALL php${PHPVER}-mysql + $APTINSTALL -t buster php${PHPVER}-redis + $APTINSTALL -t buster php-smbclient # for external storage + $APTINSTALL -t buster imagemagick php${PHPVER}-imagick php${PHPVER}-exif # for gallery + + cat > /etc/php/${PHPVER}/mods-available/opcache.ini <<EOF +zend_extension=opcache.so +opcache.enable=1 +opcache.enable_cli=1 +opcache.fast_shutdown=1 +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=10000 +opcache.memory_consumption=128 +opcache.save_comments=1 +opcache.revalidate_freq=1 +opcache.file_cache=/tmp; +EOF + a2enconf php${PHPVER}-fpm + + + DATADIR="$( grep datadirectory /var/www/nextcloud/config/config.php | awk '{ print $3 }' | grep -oP "[^']*[^']" | head -1 )" + UPLOADTMPDIR="$DATADIR"/tmp + 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 + + OPCACHEDIR="$DATADIR"/.opcache + sed -i "s|^opcache.file_cache=.*|opcache.file_cache=$OPCACHEDIR|" /etc/php/${PHPVER}/mods-available/opcache.ini + + apt-get autoremove -y + + ncc maintenance:mode --off + + bash -c "sleep 5 && service apache2 restart" &>/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 |