diff --git a/README.md b/README.md index 921c8c2e86..692c1f6f4d 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ Server installation. Simplified. :cloud: - PostgreSQL 12 - PHP-FPM 7.4 - Redis Memcache (latest stable version from PECL) -- APCu local cache (latest stable version from PECL) - PHP-igbinary (latest stable version from PECL - PHP-smbclient (latest stable version from PECL) - Nextcloud Server Latest diff --git a/addons/redis-server-ubuntu.sh b/addons/redis-server-ubuntu.sh index b46d79a10e..f3c5d9d040 100644 --- a/addons/redis-server-ubuntu.sh +++ b/addons/redis-server-ubuntu.sh @@ -61,7 +61,7 @@ sed -i "s|);||g" $NCPATH/config/config.php # Add the needed config to Nextclouds config.php cat <> $NCPATH/config/config.php - 'memcache.local' => '\\OC\\Memcache\\APCu', + 'memcache.local' => '\\OC\\Memcache\\Redis', 'filelocking.enabled' => true, 'memcache.distributed' => '\\OC\\Memcache\\Redis', 'memcache.locking' => '\\OC\\Memcache\\Redis', diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index 6a4660fd1b..41ffea2926 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -644,46 +644,6 @@ echo "igbinary.compact_strings=On" restart_webserver fi -# APCu (local cache) -if is_this_installed "php$PHPVER"-dev -then - if ! yes no | pecl install -Z apcu - then - msg_box "APCu PHP module installation failed" - exit - else - print_text_in_color "$IGreen" "APCu PHP module installation OK!" - fi -{ -echo "# APCu settings for Nextcloud" -echo "apc.enabled=1" -echo "apc.max_file_size=5M" -echo "apc.shm_segments=1" -echo "apc.shm_size=128M" -echo "apc.entries_hint=4096" -echo "apc.ttl=3600" -echo "apc.gc_ttl=7200" -echo "apc.mmap_file_mask=NULL" -echo "apc.slam_defense=1" -echo "apc.enable_cli=1" -echo "apc.use_request_time=1" -echo "apc.serializer=igbinary" -echo "apc.coredump_unmap=0" -echo "apc.preload_path" -} >> "$PHP_INI" -if [ ! -f $PHP_MODS_DIR/apcu.ini ] -then - touch $PHP_MODS_DIR/apcu.ini -fi -if ! grep -qFx extension=apcu.so $PHP_MODS_DIR/apcu.ini -then - echo "# PECL apcu" > $PHP_MODS_DIR/apcu.ini - echo "extension=apcu.so" >> $PHP_MODS_DIR/apcu.ini - check_command phpenmod -v ALL apcu -fi -restart_webserver -fi - # Fix https://github.com/nextcloud/vm/issues/714 print_text_in_color "$ICyan" "Optimizing Nextcloud..." yes | nextcloud_occ db:convert-filecache-bigint diff --git a/nextcloud_update.sh b/nextcloud_update.sh index ee41b84b2e..0245a99962 100644 --- a/nextcloud_update.sh +++ b/nextcloud_update.sh @@ -55,6 +55,19 @@ If you are sure that no update or backup is currently running, you can fix this exit 1 fi +# Change from APCu to Redis for local cache +# https://github.com/nextcloud/vm/pull/2040 +if pecl list | grep apcu >/dev/null 2>&1 +then + sed -i "/memcache.local/d" "$NCPATH"/config/config.php + if pecl list | grep redis >/dev/null 2>&1 + then + nextcloud_occ config:system:set memcache.local --value='\OC\Memcache\Redis' + else + nextcloud_occ config:system:delete memcache.local + fi +fi + # Create a snapshot before doing anything else check_free_space if ! [ -f "$SCRIPTS/nextcloud-startup-script.sh" ] && (does_snapshot_exist "NcVM-startup" \ @@ -324,13 +337,33 @@ then check_command phpenmod -v ALL redis fi -# Upgrade APCu and igbinary -#if [ "${CURRENTVERSION%%.*}" -ge "17" ] -if [ "${CURRENTVERSION%%.*}" -ge "23" ] +# Remove APCu https://github.com/nextcloud/vm/issues/2039 +if is_this_installed "php$PHPVER"-dev +then + # Delete PECL APCu + if pecl list | grep -q apcu + then + if ! yes no | pecl uninstall apcu + then + msg_box "APCu PHP module removal failed! Please report this to $ISSUES" + else + print_text_in_color "$IGreen" "APCu PHP module removal OK!" + fi + # Delete everything else + check_command phpdismod -v ALL apcu + rm -f $PHP_MODS_DIR/apcu.ini + sed -i "/extension=apcu.so/d" "$PHP_INI" + sed -i "/APCu/d" "$PHP_INI" + sed -i "/apc./d" "$PHP_INI" + fi +fi + +# Upgrade other PECL dependencies +if [ "${CURRENTVERSION%%.*}" -ge "17" ] then if [ -f "$PHP_INI" ] then - print_text_in_color "$ICyan" "Trying to upgrade igbinary, smbclient, and APCu..." + print_text_in_color "$ICyan" "Trying to upgrade igbinary, and smbclient..." if pecl list | grep igbinary >/dev/null 2>&1 then yes no | pecl upgrade igbinary @@ -373,35 +406,8 @@ then sed -i "/extension=smbclient.so/d" "$PHP_INI" fi fi - if pecl list | grep -q apcu - then - yes no | pecl upgrade apcu - # Remove old igbinary - if grep -qFx extension=apcu.so "$PHP_INI" - then - sed -i "/extension=apcu.so/d" "$PHP_INI" - fi - # Check if apcu is enabled and create the file if not - if [ ! -f $PHP_MODS_DIR/apcu.ini ] - then - touch $PHP_MODS_DIR/apcu.ini - fi - # Enable new apcu - if ! grep -qFx extension=apcu.so $PHP_MODS_DIR/apcu.ini - then - echo "# PECL apcu" > $PHP_MODS_DIR/apcu.ini - echo "extension=apcu.so" >> $PHP_MODS_DIR/apcu.ini - check_command phpenmod -v ALL apcu - fi - # Fix https://help.nextcloud.com/t/nc-21-manual-update-issues/108693/4?$ - if ! grep -qFx apc.enable_cli=1 $PHP_MODS_DIR/apcu.ini - then - echo "apc.enable_cli=1" >> $PHP_MODS_DIR/apcu.ini - check_command phpenmod -v ALL apcu - fi - fi if pecl list | grep -q inotify - then + then # Remove old inotify if grep -qFx extension=inotify.so "$PHP_INI" then