Project

General

Profile

Actions

IK-Tool: OS Update U18>U22, T3 V9>V11, PHP 7.2>8.1, MariaDB 10.1>10.6

Backup / Datenaustausch [tl] /scratch/tmp/30/ik/ OS:ik.system.tgz, DB:*.sql, html, dev
Lokaler Dump [inframitool01] /var/tmp/dev
Installtool https://www.ik.uzh.ch/typo3/install.php
MariaDB Update 10.1 > 10.6 - all columns need a default value if INSERT does not specify the column
  • The use of dump files doesn't include sql functions. Exporting them with phpMyAdmin from source to target is currently the best solution. In most cases not necessary because upgrade happens on an existing instance with given databases.
  • Sometimes T3 Cache could make problems while upgrading. Deleting the typo3temp folder helps.
  • Using relative paths in typo3 template editor could make problems in v11. It helps to change them to absolute paths. Good example for these situations are the use of 'cd.stylesheet =' options.

Times

  • 09:05 Apache stop
  • 09:09 VMWare einloggen
  • 09:16 do-release-upgrade 18 > 20
  • 09:40 reboot
  • 09:41 do-release-upgrade 20 > 22
  • 09:55 reboot

VMWare Konsole

  • Check das CR sich einloggen kann: https://wikiit.math.uzh.ch/it/bestpractice/vmware-console
    • Wird der IE genommen, funktioniert der Aufruf der vsphere Seite nciht.
    • Edge hat mehrere Minuten gebraucht um zu starten.
    • Firefox konnte sich anmelden, dann hat CR aber abgebrochen weil mittlerweile Edge gestartet ist.
  • Edge hat die Konsole gut dargestellt.

Preparation on production

# Check das der neueste Kernel aktiv ist, falls nicht reboot
$ uname -a
$ dpkg --list | grep linux

#
# Alle alten Kernel entfernen! Das ist wichtig damit der do-release-upgrade Process nicht unnoetig alte Kernel Module aktualisiert.
#
$ CURRENT=`uname -a | cut -f 3 -d ' '`
$ ALL=`dpkg --list | grep -e linux-modules -e linux-image | grep -v $CURRENT | awk '{ print $2 }'`
$ for II in $ALL; do apt purge -y $II; done

# Backup Dir anlegen:
[user@tlX] mkdir /scratch/tmp/30/ik
# Latest T3 nach Production kopieren
[user@tlX] scp /scratch/software/typo3/typo3_src-11.5.25.tgz root@inframitool01.uzh.ch:/var/tmp/

# T3 schonmal auspacken
[root@inframitool01] cd /var/html; tar zxf typo3_src-11.5.25.tgz

# ** Am Tag vor der Migration **
# Backup anlegen. Zuerst auf TL: `mkdir /scratch/tmp/30/ik`
# 
[root@inframitool01
$ cd /
$ tar --exclude=var/www/html -czvf /tmp/ik.system.tgz bin boot etc home initrd.img lib lib64 opt root sbin snap srv swap.img usr var vmlinuz
$ scp /var/tmp/ik.system.tgz crose@ssh.math.uzh.ch:/scratch/tmp/30/ik/
$ rsync -av /var/www/html crose@ssh.math.uzh.ch:/scratch/tmp/30/ik/

# phpMyAdmin
$ scp crose@ssh.math.uzh.ch:/scratch/software/php/phpMyAdmin-5.2.1-all-languages.zip /var/tmp/
$ cd /var/www/; unzip /var/tmp/phpMyAdmin-5.2.1-all-languages.zip
$ cd /var/www/phpMyAdmin-5.2.1-all-languages/
$ cp config.sample.inc.php 
$ vim config.inc.php

# 
# ** Am Tag der Migration **
#

# Apache anhalten
$ service apache2 stop

# Alle Cronjobs anhalten:
$ crontab -e
$ crontab -e -u www-data

# DBs - einmal lokal ablegen und dann nochmal remote sichern
$ mkdir /var/tmp/prod; cd /var/tmp/prod
$ rm *.sql

$ ALL="mi_preview_db mi_preview_t3 mi_prod_db mi_prod_t3 mysql" 
$ for II in $ALL; do echo $II; mysqldump $II > $II.sql ; done
$ mysqldump mi_prod_t3 fe_users > mi_prod_t3.fe_users.sql
$ scp *.sql crose@ssh.math.uzh.ch:/scratch/tmp/30/ik/

# Backup latest files:
$ rsync -av --delete /var/www/html/ crose@ssh.math.uzh.ch:/scratch/tmp/30/ik/html/

# 
# OS Migration: 
# 

# Ubuntu 20
$ do-release-upgrade 

# Login IK(u20) und Apache direkt wieder anhalten:
$ service apache2 stop

# Ubuntu 22
$ do-release-upgrade 

# Login IK(u22) und Apache direkt wieder anhalten:
$ service apache2 stop

# Check welche PHP Version installiert. Ggfs. sind noch alte installiert. 
# Am besten vergleichen ob alle PHP Pakete von der alten Version auch in der neuen installiert sind. 
$ dpkg --list | grep php
$ apt purge php7.0* php7.4* libapache2-mod-php7.2 libapache2-mod-php7.0
$ apt install php-xml php-json
$ rm /etc/apache2/mods-enabled/php7.4*
$ a2enmod php8.1

Preparation on dev (webwork22)

# Create dump of typo3 database:
$ mysqldump mi_dev_t3 > /var/tmp/ik_dev_t3_v11.sql

# Filestruktur 
$ cd /var/www/html
$ tar zcf /var/tmp/ik_dev_v11.tgz mi

File transfer: Dev to Production

Jump host TL

[crose@tlX]
$ scp root@webwork22:/var/tmp/ik_dev_t3_v11.sql /scratch/tmp/30/ik/dev/
$ scp root@webwork22:/var/tmp/ik_dev_v11.tgz /scratch/tmp/30/ik/dev/

$ rsync -av  /scratch/tmp/30/ik/dev root@inframitool01.uzh.ch:/var/tmp/

Setup Production

[root@inframitoool01]

$ cd /var/www/
$ mv html /var/tmp/html.v8

# Unpack page instance for prod and preview. Rename them to original name and check the right permissions:

# Prod
$ cd /var/www/
$ tar -xzf /var/tmp/dev/ik_dev_v11.tgz
$ mv mi html

# Preview
$ tar -xzf /var/tmp/dev/ik_dev_v11.tgz
$ mv mi html/preview

# Drop old T3 (tables might be changed), create empty one
$ mysql
% drop database mi_prod_t3;
% drop database mi_preview_t3;
% create database mi_prod_t3;
% create database mi_preview_t3;

# Not necessary if there is a full sync in the next step: Import T3 DBs (Prod & Peview same)
$ mysql mi_prod_t3 < /var/tmp/dev/ik_dev_t3_v11.sql
$ mysql mi_preview_t3 < /var/tmp/dev/ik_dev_t3_v11.sql

# FE Users
$ mysql mi_prod_t3 < /var/tmp/prod/mi_prod_t3.fe_users.sql

#
# ** Sync QFQ Data **
# 
[crose@tlX]
$ cd /scratch/share/system/sync/ik/
$ ./IKDevPreviewSync.sh -f
$ ./IKPreviewProdSync.sh -f

# 
# Restore fileadmin
# 
$ mkdir /var/tmp/fileadmin.dev

# Keep dev version temporarily on prod for comparison in case 
$ mv /var/www/html/fileadmin/protected /var/tmp/prod/dev-protected

# Restore prod: financialrequests & protected
$ mv /var/tmp/html.v8/fileadmin/protected /var/www/html/fileadmin/

# Restore preview: financialrequests & protected
$ \rm -R /var/www/html/preview/fileadmin/protected 
$ mv /var/tmp/html.v8/preview/fileadmin/protected /var/www/html/preview/fileadmin/

Configuration: qfq.json and LocalConfiguration.php

  • Prepare the final config files in `/var/tmp/dev/prev|prod`

LocalConfiguration.php:

  • db
  • user
  • password
  • baseUrl
  • wkhtmltopdf
  • redirect E-Mail
  • sitename
  • installtoolpw

Copy config files:

$ cp /var/tmp/dev/prod/LocalConfiguration.php /var/www/html/typo3conf/
$ cp /var/tmp/dev/prev/LocalConfiguration.php /var/www/html/preview/typo3conf/

Finalize

  • Play ansible playbook
    [user@tlX] 
    $ cd git/it/ansible/playbooks
    $ ansible-playbook -i ../hosts qfq.yml --limit inframitool01
    
    [root@inframitool01]
    $ a2enmod php8.1 
    $ service apache2 restart
    
    
  • Misc
    # Set Permissions
    $ chown -R www-data:www-data /var/www/html
    
    # Alle Cronjobs aktvieren:
    $ cronjob -e
    $ cronjob -e -u www-data
    
  • Check Backup.
  • Remove old IK dev instance (webwork16).
    • Incl. 'Autocron' Dev
  • Update kpit PWs with webwork16/webwork22 credentials.
  • Update Project Wiki summary with new dev instance (webwork22).

Probleme bei der Migration

  • Netzwerk Config /etc/network/interfaces wurde nicht ubertragen nach /etc/netplan/50-cloud-init.yaml ... Manuell angelegt.
  • Auf webwork22 war die Extension 'Redirect' nicht noetig, aber weder https://www.ik.uzh.ch noch https://www.ik.uzh.ch/preview haben funktioniert. Nachdem die Extension aktiviert wurde und ein Redirect von der Base URL auf die Homepage konfiguriert wurde hat der Aufruf geklappt.

  • Beim speichern von Datumsfeldern und Dezimal Values gibt es ein Problem wenn nur '' (leerer String) und kein '0000-00-00' oder '0' (Dezimal). Das muss in QFQ eingebaut werden. Als temporaerer Workaround auf prod und preview in der QFQ DB Init den MariaDB Default 'STRICT_TRANS_TABLES' entfernt, in dem der SQL_MODE ohne diese Option gesetzt wird: set names utf8; SET sql_mode = 'ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';.
  • T3 Site-Konfiguration: T3 hat in der Site Konfiguration die URL von webwork22 gehabt (dump von webwork22). Das wird aktuell durch die I-MATH Sync Skripte noch nicht automatisch angepasst. Sites > Site Configuration > Entry Point
  • Das FE Login Template sieht schlecht aus. Im typo3_src Vezeichnis hat EN einige Anpassungen gemacht (webwork22) - darum als Quickfix die angepasste Version auf IK kopiert (geht mit dem naechsten Typo3 Update verloren (typo3_src-11.5.25/typo3/sysext/felogin/Resources/Private/Templates/Login/Login.html)

Updated by Carsten Rose about 1 year ago · 5 revisions