Project

General

Profile

Actions

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

Backup / Datenaustausch [tl] /scratch/tmp/30/hms/ OS:hms.system.tgz, DB:*.sql, html, dev
Lokaler Dump [hms-tool] /var/tmp/dev
Installtool https://hms-tool.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.

Process

  • 15:43 Start do-release-upgrade (U18 > U20)
  • 16:03 Reboot
  • 16:05 Start do-release-upgrade (U20 > U22)
  • 16:22 Reboot
  • 17:18 Migration abgeschlossen

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 nicht.
    • 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/hms
# Latest T3 nach Production kopieren
[user@tlX] scp /scratch/software/typo3/typo3_src-11.5.25.tgz root@hms-tool.uzh.ch:/var/tmp/

# T3 schonmal auspacken
[root@hms-tool] 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/hms`
# 
[root@hms-tool
$ cd /
$ tar --exclude=var/www/html -czvf /var/tmp/hms.system.tgz bin boot etc home initrd.img lib lib64 opt root sbin snap srv swap.img usr var vmlinuz
$ scp /var/tmp/hms.system.tgz crose@ssh.math.uzh.ch:/scratch/tmp/30/hms/
$ rsync -av /var/www/html crose@ssh.math.uzh.ch:/scratch/tmp/30/hms/

# 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 config.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="hms_preview_db hms_preview_t3 hms_prod_db hms_prod_t3 mysql" 
$ ALL="hms_prod_db hms_prod_t3 mysql" 
$ for II in $ALL; do echo $II; mysqldump $II > $II.sql ; done
$ mysqldump hms_prod_t3 fe_users > mi_prod_t3.fe_users.sql
$ scp *.sql crose@ssh.math.uzh.ch:/scratch/tmp/30/hms/

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

# 
# OS Migration: 
# 

# Ubuntu 20
$ do-release-upgrade 

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

# Ubuntu 22
$ do-release-upgrade 

# Login HMS(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* 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/hms_dev_t3_v11.sql

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

File transfer: Dev to Production

Jump host TL

[crose@tlX]
$ scp root@webwork22:/var/tmp/hms_dev_t3_v11.sql /scratch/tmp/30/hms/dev/
$ scp root@webwork22:/var/tmp/hms_dev_v11.tgz /scratch/tmp/30/hms/dev/

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

Setup Production

[root@hms-tool]

$ 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/hms_dev_v11.tgz
$ mv hms html

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

# Drop old T3 (tables might be changed), create empty one
$ mysql
% drop database hms_prod_t3;
% create database hms_prod_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/hms_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/hms/
$ ./hmsPreviewProdSync.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/prod/fileadmin/protected /var/www/html/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
  • flagProduction

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 hms-tool
    
    [root@hms-tool]
    $ 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 HMS 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

Updated by Carsten Rose about 1 year ago · 1 revisions