Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove APCu and replace with Redis instead #2040

Merged
merged 4 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion addons/redis-server-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ sed -i "s|);||g" $NCPATH/config/config.php

# Add the needed config to Nextclouds config.php
cat <<ADD_TO_CONFIG >> $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',
Expand Down
40 changes: 0 additions & 40 deletions nextcloud_install_production.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
65 changes: 33 additions & 32 deletions nextcloud_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,41 @@ then
check_command phpenmod -v ALL redis
fi

# Upgrade APCu and igbinary
#if [ "${CURRENTVERSION%%.*}" -ge "17" ]
if [ "${CURRENTVERSION%%.*}" -ge "23" ]
# Change from APCu to Redis for local cache
if pecl list | grep redis >/dev/null 2>&1
then
nextcloud_occ config:system:set memcache.local --value='\OC\Memcache\Redis'
enoch85 marked this conversation as resolved.
Show resolved Hide resolved
else
nextcloud_occ config:system:delete memcache.local
fi

# 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 -Z 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
Expand Down Expand Up @@ -373,35 +401,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
Expand Down