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

Another php8.1 upgrade #2418

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion conf/nginx-top.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
## your own --- please do not ask for help from us.

upstream php-fpm {
server unix:/var/run/php/php8.0-fpm.sock;
server unix:/var/run/php/php8.1-fpm.sock;
}

4 changes: 2 additions & 2 deletions management/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def service_command(service, command, quit=None):
if quit:
sys.exit(code)

service_command("php8.0-fpm", "stop", quit=True)
service_command("php8.1-fpm", "stop", quit=True)
service_command("postfix", "stop", quit=True)
service_command("dovecot", "stop", quit=True)
service_command("postgrey", "stop", quit=True)
Expand Down Expand Up @@ -333,7 +333,7 @@ def service_command(service, command, quit=None):
service_command("postgrey", "start", quit=False)
service_command("dovecot", "start", quit=False)
service_command("postfix", "start", quit=False)
service_command("php8.0-fpm", "start", quit=False)
service_command("php8.1-fpm", "start", quit=False)

# Remove old backups. This deletes all backup data no longer needed
# from more than 3 days ago.
Expand Down
2 changes: 1 addition & 1 deletion setup/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# -o pipefail: don't ignore errors in the non-last command in a pipeline
set -euo pipefail

PHP_VER=8.0
PHP_VER=8.1

function hide_output {
# This function hides the output of a command unless the command fails
Expand Down
30 changes: 24 additions & 6 deletions setup/nextcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,24 @@ InstallNextcloud() {
echo "Upgrading to Nextcloud version $version"
echo

# set PHP version, set to earlier version if required for upgrade
nc_php_ver="$PHP_VER"
if [[ ${version} =~ ^2[0123] ]]; then
matidau marked this conversation as resolved.
Show resolved Hide resolved
nc_php_ver=8.0
fi

# install earlier PHP version
if [ "$nc_php_ver" != "$PHP_VER" ]; then
matidau marked this conversation as resolved.
Show resolved Hide resolved
apt_install curl php"${nc_php_ver}" php"${nc_php_ver}"-fpm \
php"${nc_php_ver}"-cli php"${nc_php_ver}"-sqlite3 php"${nc_php_ver}"-gd php"${nc_php_ver}"-imap php"${nc_php_ver}"-curl \
php"${nc_php_ver}"-dev php"${nc_php_ver}"-gd php"${nc_php_ver}"-xml php"${nc_php_ver}"-mbstring php"${nc_php_ver}"-zip php"${nc_php_ver}"-apcu \
php"${nc_php_ver}"-intl php"${nc_php_ver}"-imagick php"${nc_php_ver}"-gmp php"${nc_php_ver}"-bcmath

tools/editconf.py /etc/php/"$nc_php_ver"/mods-available/apcu.ini -c ';' \
apc.enabled=1 \
apc.enable_cli=1
fi

# Download and verify
wget_verify "https://download.nextcloud.com/server/releases/nextcloud-$version.zip" "$hash" /tmp/nextcloud.zip

Expand Down Expand Up @@ -138,23 +156,23 @@ InstallNextcloud() {
if [ -e "$STORAGE_ROOT/owncloud/owncloud.db" ]; then
# ownCloud 8.1.1 broke upgrades. It may fail on the first attempt, but
# that can be OK.
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ upgrade
sudo -u www-data php"$nc_php_ver" /usr/local/lib/owncloud/occ upgrade
E=$?
if [ $E -ne 0 ] && [ $E -ne 3 ]; then
echo "Trying ownCloud upgrade again to work around ownCloud upgrade bug..."
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ upgrade
sudo -u www-data php"$nc_php_ver" /usr/local/lib/owncloud/occ upgrade
E=$?
if [ $E -ne 0 ] && [ $E -ne 3 ]; then exit 1; fi
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ maintenance:mode --off
sudo -u www-data php"$nc_php_ver" /usr/local/lib/owncloud/occ maintenance:mode --off
echo "...which seemed to work."
fi

# Add missing indices. NextCloud didn't include this in the normal upgrade because it might take some time.
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ db:add-missing-indices
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ db:add-missing-primary-keys
sudo -u www-data php"$nc_php_ver" /usr/local/lib/owncloud/occ db:add-missing-indices
sudo -u www-data php"$nc_php_ver" /usr/local/lib/owncloud/occ db:add-missing-primary-keys

# Run conversion to BigInt identifiers, this process may take some time on large tables.
sudo -u www-data php"$PHP_VER" /usr/local/lib/owncloud/occ db:convert-filecache-bigint --no-interaction
sudo -u www-data php"$nc_php_ver" /usr/local/lib/owncloud/occ db:convert-filecache-bigint --no-interaction
fi
}

Expand Down
4 changes: 2 additions & 2 deletions tools/owncloud-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if [ ! -f "$1/config.php" ]; then
fi

echo "Restoring backup from $1"
service php8.0-fpm stop
service php8.1-fpm stop

# remove the current ownCloud/Nextcloud installation
rm -rf /usr/local/lib/owncloud/
Expand All @@ -45,5 +45,5 @@ chown www-data:www-data "$STORAGE_ROOT/owncloud/config.php"

sudo -u www-data "php$PHP_VER" /usr/local/lib/owncloud/occ maintenance:mode --off

service php8.0-fpm start
service php8.1-fpm start
echo "Done"