Project

General

Profile

Actions

20230616 GRC » History » Revision 1

Revision 1/4 | Next »
Carsten Rose, 16.06.2023 09:05


GRC / grc: OS Update U18>U22, T3 V9>V11, PHP 7.2>8.1, MariaDB 10.1>10.6

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

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

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

# 
# ** 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="grctool_preview_db grctool_preview_t3 grctool_prod_db grctool_prod_t3 mysql" 
$ for II in $ALL; do echo $II; mysqldump $II > $II.sql ; done
$ scp *.sql crose@ssh.math.uzh.ch:/scratch/tmp/30/grc/

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

# 
# OS Migration: 
# 

# Ubuntu 20
$ do-release-upgrade 

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

# Ubuntu 22
$ do-release-upgrade 

# Login grc(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. 
# Bei dieser Migration fehlten nach der Migration @php-xml@, @php-json@.
$ dpkg --list | grep php
$ apt purge php7.4* libapache2-mod-php7.2
$ apt install php-xml php-json

Preparation on dev (webwork22)

# Create dump of typo3 database:
$ mysqldump grc_dev_t3 > /var/tmp/grc_dev_t3_v11.sql

# Filestruktur 
$ cd /var/www/html
$ tar zcf /var/tmp/grc_dev_v11.tgz grc

File transfer: Dev to Production

Jump host TL

[crose@tlX]
$ scp root@webwork22:/var/tmp/grc_dev_t3_v11.sql /scratch/tmp/30/grc/dev/
$ scp root@webwork22:/var/tmp/grc_dev_v11.tgz /scratch/tmp/30/grc/dev/

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

Setup Production

[root@grc]

$ cd /var/www/
$ mv html html.v9

# 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/lszgs_dev_v11.tgz
$ mv grc html

# Preview
$ tar -xzf /var/tmp/dev/lszgs_dev_v11.tgz
$ mv grc html/preview

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

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

#
# ** Sync QFQ Data **
# 
[crose@tlX]
$ cd /scratch/share/system/sync/grc/
$ ./grcDevPreviewSync.sh -f
$ ./grcDevProdSync.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/fileadmin/.dev/protected

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

# Restore preview: financialrequests & protected
$ \rm -R /var/www/html/preview/fileadmin/protected 
$ mv /var/www/html.v9/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`

qfq.json:

  • DB_1_USER
  • DB_1_PASSWORD
  • DB_1_NAME

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 grc
    
    [root@grc]
    $ 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 grc 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

  • 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 grc 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 · 1 revisions