rearrange install script (#2551)

This commit is contained in:
Daniel Hansson 2023-08-25 10:32:27 +02:00 committed by GitHub
parent fd92b6ed24
commit 3f16f77cd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 107 additions and 109 deletions

View File

@ -56,18 +56,6 @@ then
fi
install_if_not redis-server
# Add the needed config to Nextclouds config.php
nextcloud_occ config:system:set memcache.local --value='\OC\Memcache\Redis'
nextcloud_occ config:system:set filelocking.enabled --value='true'
nextcloud_occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
nextcloud_occ config:system:set memcache.locking --value='\OC\Memcache\Redis'
nextcloud_occ config:system:set redis host --value="$REDIS_SOCK"
nextcloud_occ config:system:set redis port --value=0
nextcloud_occ config:system:set redis dbindex --value=0
nextcloud_occ config:system:set redis timeout --value=0.5
nextcloud_occ config:system:set redis timeout --value="$REDIS_PASS"
## Redis performance tweaks ##
if ! grep -Fxq "vm.overcommit_memory = 1" /etc/sysctl.conf
then
@ -102,4 +90,16 @@ apt-get update -q4 & spinner_loading
apt-get autoremove -y
apt-get autoclean
# Add the needed config to Nextclouds config.php
nextcloud_occ config:system:set memcache.local --value='\OC\Memcache\Redis'
nextcloud_occ config:system:set filelocking.enabled --value='true'
nextcloud_occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
nextcloud_occ config:system:set memcache.locking --value='\OC\Memcache\Redis'
nextcloud_occ config:system:set redis host --value="$REDIS_SOCK"
nextcloud_occ config:system:set redis port --value=0
nextcloud_occ config:system:set redis dbindex --value=0
nextcloud_occ config:system:set redis timeout --value=0.5
nextcloud_occ config:system:set redis timeout --value="$REDIS_PASS"
exit

View File

@ -63,50 +63,6 @@ fi
# Restart mode: (l)ist only, (i)nteractive or (a)utomatically.
sed -i "s|#\$nrconf{restart} = .*|\$nrconf{restart} = 'a';|g" /etc/needrestart/needrestart.conf
# Fix LVM on BASE image
if grep -q "LVM" /etc/fstab
then
if [ -n "$PROVISIONING" ] || yesno_box_yes "Do you want to make all free space available to your root partition?"
then
# Resize LVM (live installer is &%¤%/!
# VM
print_text_in_color "$ICyan" "Extending LVM, this may take a long time..."
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
# Run it again manually just to be sure it's done
while :
do
lvdisplay | grep "Size" | awk '{print $3}'
if ! lvextend -L +10G /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +1G /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +100M /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +1M /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
resize2fs /dev/ubuntu-vg/ubuntu-lv
break
fi
fi
fi
fi
done
fi
fi
# Install needed dependencies
install_if_not lshw
install_if_not net-tools
install_if_not whiptail
install_if_not apt-utils
install_if_not keyboard-configuration
# Nice to have dependencies
install_if_not bash-completion
install_if_not htop
install_if_not iputils-ping
# Check for flags
if [ "$1" = "" ]
then
@ -156,6 +112,50 @@ Enabling this will also force an automatic reboot after running the update scrip
fi
fi
# Fix LVM on BASE image
if grep -q "LVM" /etc/fstab
then
if [ -n "$PROVISIONING" ] || yesno_box_yes "Do you want to make all free space available to your root partition?"
then
# Resize LVM (live installer is &%¤%/!
# VM
print_text_in_color "$ICyan" "Extending LVM, this may take a long time..."
lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
# Run it again manually just to be sure it's done
while :
do
lvdisplay | grep "Size" | awk '{print $3}'
if ! lvextend -L +10G /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +1G /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +100M /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
if ! lvextend -L +1M /dev/ubuntu-vg/ubuntu-lv >/dev/null 2>&1
then
resize2fs /dev/ubuntu-vg/ubuntu-lv
break
fi
fi
fi
fi
done
fi
fi
# Install needed dependencies
install_if_not lshw
install_if_not net-tools
install_if_not whiptail
install_if_not apt-utils
install_if_not keyboard-configuration
# Nice to have dependencies
install_if_not bash-completion
install_if_not htop
install_if_not iputils-ping
# Download needed libraries before execution of the first script
mkdir -p "$SCRIPTS"
download_script GITHUB_REPO lib
@ -542,7 +542,7 @@ This is used when you login to Nextcloud itself, i.e. on the web."
fi
# Install Nextcloud
print_text_in_color "$ICyan" "Installing Nextcloud..."
print_text_in_color "$ICyan" "Installing Nextcloud, it might take a while..."
cd "$NCPATH"
nextcloud_occ maintenance:install \
--data-dir="$NCDATA" \
@ -552,11 +552,59 @@ nextcloud_occ maintenance:install \
--database-pass="$PGDB_PASS" \
--admin-user="$GUIUSER" \
--admin-pass="$GUIPASS"
echo
print_text_in_color "$ICyan" "Nextcloud version:"
nextcloud_occ status
sleep 3
echo
# Install PECL dependencies
install_if_not php"$PHPVER"-dev
# Install Redis (distributed cache)
run_script ADDONS redis-server-ubuntu
# Install smbclient
# php"$PHPVER"-smbclient does not yet work in PHP 7.4
install_if_not libsmbclient-dev
yes no | pecl install smbclient
if [ ! -f "$PHP_MODS_DIR"/smbclient.ini ]
then
touch "$PHP_MODS_DIR"/smbclient.ini
fi
if ! grep -qFx extension=smbclient.so "$PHP_MODS_DIR"/smbclient.ini
then
echo "# PECL smbclient" > "$PHP_MODS_DIR"/smbclient.ini
echo "extension=smbclient.so" >> "$PHP_MODS_DIR"/smbclient.ini
check_command phpenmod -v ALL smbclient
fi
# Enable igbinary for PHP
# https://github.com/igbinary/igbinary
if is_this_installed "php$PHPVER"-dev
then
if ! yes no | pecl install -Z igbinary
then
msg_box "igbinary PHP module installation failed"
exit
else
print_text_in_color "$IGreen" "igbinary PHP module installation OK!"
fi
{
echo "# igbinary for PHP"
echo "session.serialize_handler=igbinary"
echo "igbinary.compact_strings=On"
} >> "$PHP_INI"
if [ ! -f "$PHP_MODS_DIR"/igbinary.ini ]
then
touch "$PHP_MODS_DIR"/igbinary.ini
fi
if ! grep -qFx extension=igbinary.so "$PHP_MODS_DIR"/igbinary.ini
then
echo "# PECL igbinary" > "$PHP_MODS_DIR"/igbinary.ini
echo "extension=igbinary.so" >> "$PHP_MODS_DIR"/igbinary.ini
check_command phpenmod -v ALL igbinary
fi
restart_webserver
fi
# Prepare cron.php to be run every 5 minutes
crontab -u www-data -l | { cat; echo "*/5 * * * * php -f $NCPATH/cron.php > /dev/null 2>&1"; } | crontab -u www-data -
@ -662,56 +710,6 @@ echo "pgsql.ignore_notice = 0"
echo "pgsql.log_notice = 0"
} >> "$PHP_FPM_DIR"/conf.d/20-pdo_pgsql.ini
# Install PECL dependencies
install_if_not php"$PHPVER"-dev
# Install Redis (distributed cache)
run_script ADDONS redis-server-ubuntu
# Install smbclient
# php"$PHPVER"-smbclient does not yet work in PHP 7.4
install_if_not libsmbclient-dev
yes no | pecl install smbclient
if [ ! -f "$PHP_MODS_DIR"/smbclient.ini ]
then
touch "$PHP_MODS_DIR"/smbclient.ini
fi
if ! grep -qFx extension=smbclient.so "$PHP_MODS_DIR"/smbclient.ini
then
echo "# PECL smbclient" > "$PHP_MODS_DIR"/smbclient.ini
echo "extension=smbclient.so" >> "$PHP_MODS_DIR"/smbclient.ini
check_command phpenmod -v ALL smbclient
fi
# Enable igbinary for PHP
# https://github.com/igbinary/igbinary
if is_this_installed "php$PHPVER"-dev
then
if ! yes no | pecl install -Z igbinary
then
msg_box "igbinary PHP module installation failed"
exit
else
print_text_in_color "$IGreen" "igbinary PHP module installation OK!"
fi
{
echo "# igbinary for PHP"
echo "session.serialize_handler=igbinary"
echo "igbinary.compact_strings=On"
} >> "$PHP_INI"
if [ ! -f "$PHP_MODS_DIR"/igbinary.ini ]
then
touch "$PHP_MODS_DIR"/igbinary.ini
fi
if ! grep -qFx extension=igbinary.so "$PHP_MODS_DIR"/igbinary.ini
then
echo "# PECL igbinary" > "$PHP_MODS_DIR"/igbinary.ini
echo "extension=igbinary.so" >> "$PHP_MODS_DIR"/igbinary.ini
check_command phpenmod -v ALL igbinary
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