Project

General

Profile

20230610 Forkred » History » Revision 2

Revision 1 (Carsten Rose, 09.06.2023 11:05) → Revision 2/44 (Carsten Rose, 09.06.2023 13:47)

h1. Forkred: OS Update U18 zu U22, T3 V9 zu V11, PHP 8.2 

 h2. VMWare Konsole 

 * Check das CR sich einloggen kann: https://wikiit.math.uzh.ch/it/bestpractice/vmware-console 

   kann 
 * 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. Check das ein Ubuntu 22.04 Image zur Verfuegung steht 

 * Edge hat die Konsole gut dargestellt. 

 h2. Preparation on production 

 <pre> 
 # 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/forkred </pre> 





 =================================== 


 Create dump files from databases: 
 # Latest T3 nach Production kopieren <pre> 
 [user@tlX] scp /scratch/software/typo3/typo3_src-11.5.25.tgz root@forkred.uzh.ch:/var/tmp/ 

 # T3 schonmal auspacken mysqldump lean_prod_db > /var/tmp/lean_prod_db_dump.sql 
 [root@forkred] cd /var/html; tar zxf typo3_src-11.5.25.tgz 

 # ** Am Tag vor der Migration ** mysqldump lean_prod_t3 > /var/tmp/lean_prod_t3_dump.sql 
 # Backup anlegen. Zuerst auf TL: `mkdir /scratch/tmp/30/forkred` 
 #  
 $ cd / 
 $ tar cjfv /tmp/forkred.tar.bz2 boot etc initrd.img lib snap    swap.img var bin home lib64 opt root sbin srv usr vmlinuz 
 $ scp /tmp/forkred.tar.bz2 crose@ssh.math.uzh.ch:/scratch/tmp/30/forkred/ 
 $ rsync -av /var/www/html crose@ssh.math.uzh.ch:/scratch/tmp/30/forkred/ 

 #  
 # ** Am Tag der Migration ** 
 # 

 # Apache anhalten 
 $ service apache2 stop 

 # DBs 
 $ rm /tmp/*.sql 
 $ ALL="forkred_preview_db forkred_preview_t3 forkred_prod_db forkred_prod_t3 mysql" 
 $ for II in $ALL; do mysqldump $II /tmp/$II.sql ; done lean_gate_prod_t3 > /var/tmp/lean_gate_t3_dump.sql 
 $ scp /tmp/*.sql crose@ssh.math.uzh.ch:/scratch/tmp/30/forkred/ </pre> 

 # Backup latest files: 
 $ rsync -av --delete Move page instance folder as backup from /var/www/html/ crose@ssh.math.uzh.ch:/scratch/tmp/30/forkred/html/ 

 #  
 # OS Migration:  
 #  

 # Ubuntu 20 to /var/www/ 
 $ do-release-upgrade  

 # Login forkred(u20) und Apache direkt wieder anhalten: <pre> 
 $ service apache2 stop 

 # Ubuntu 22 mv /var/www/html/prod /var/www/html/prod.v9.old    
 mv /var/www/html/preview /var/www/html/prod.v9.old 
 $ do-release-upgrade  

 # Login forkred(u22) und Apache direkt wieder anhalten: </pre> 
 $ service apache2 stop 
 </pre> Do the same for other pages. 

 h2. Preparation on dev (webwork22) 

 Switch to dev server: 
 <pre> 
 # webwork22r 
 </pre> 

 Create dump of typo3 database: 
 $ <pre> 
 mysqldump forkred_dev_t3 lean_dev_t3 > /var/tmp/forkred_dev_t3_v11.sql /var/tmp/lean_prod_t3_v11.sql 
 $ mysqldump forkred_dev_db lean_gate_t3 > /var/tmp/forkred_dev_db_v11.sql /var/tmp/lean_gate_t3_v11.sql 
 </pre> 

 # Filestruktur  
 $ Archive sql dump files: 
 <pre> 
 cd /var/tmp 
 tar -czf lean_gate_db_t3_v11.tar.gz lean_prod_t3_v11.sql lean_gate_t3_v11.sql 
 </pre> 

 Archive page instance: 
 <pre> 
 cd /var/www/html 
 $ tar zcf /var/tmp/forkred_dev_v11.tgz forkred -czf /var/tmp/lean.tar.gz lean/  
 tar -czf /var/tmp/leangate.tar.gz leangate/ 
 </pre>  

 Archive new typo3 v11 (In this example the feLogin templates for geolean are included): 
 <pre> 
 cd /var/www 
 tar -czf /var/tmp/typo3_v11.tar.gz typo3_src-11.5.25 
 </pre> 

 h2. File transfer: Dev to Production 

 Jump host TL Transfer archived page instance to production server: 
 <pre> 
 [crose@tlX] scp -r root@webwork22:/var/tmp/lean.tar.gz root@lean.geo.uzh.ch:/var/tmp 
 $ scp root@webwork22:/var/tmp/forkred_dev_*.sql /scratch/tmp/30/forkred/dev/ -r root@webwork22:/var/tmp/leangate.tar.gz root@lean-gate.geo.uzh.ch:/var/tmp 
 $ </pre> 

 Transfer typo3 v11 to production server: 
 <pre> 
 scp root@webwork22:/var/tmp/forkred_dev_v11.tgz /scratch/tmp/30/forkred/dev/ -r root@webwork22:/var/tmp/typo3_v11.tar.gz root@lean.geo.uzh.ch:/var/tmp 
 scp -r root@webwork22:/var/tmp/typo3_v11.tar.gz root@lean-geo.uzh.ch:/var/tmp 
 </pre> 

 $ rsync -av    /scratch/tmp/30/forkred/dev root@forkred.math.uzh.ch:/var/tmp/ Transfer typo3 database dump files to production server: 
 <pre> 
 scp -r root@webwork22:/var/tmp/lean_gate_db_t3_v11.tar.gz root@lean.geo.uzh.ch:/var/tmp 
 </pre> 

 h2. Setup Production 

 <pre> 
 [root@forkred] 

 $ 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 
 $ <pre> 
 ssh lean.geo.uzh.ch 
 cd /var/www/ /var/tmp 
 $ tar -xzf /var/tmp/dev/forkred_dev_v11.tgz lean.tar.gz -C /var/www/html/ 
 $ mv forkred html 

 # Preview lean prod 
 $ tar -xzf /var/tmp/dev/forkred_dev_v11.tgz lean.tar.gz -C /var/www/html/ 
 $ mv forkred prod/preview lean preview 
 </pre> 

 # Import DBs (Prod & Peview same) Unpack typo3 v11 and check the right permissions: 
 $ mysql forkred_prod_db < /var/tmp/dev/forkred_dev_db_v11.sql <pre> 
 $ tar -xzf typo3_v11.tar.gz -C /var/www/ 
 </pre> 

 Unpack typo3 database dump files and use them in production and preview: 
 <pre> 
 tar -xzf lean_gate_db_t3_v11.tar.gz -C ./ 

 mysql forkred_prod_t3 lean_prod_t3 < /var/tmp/dev/forkred_dev_t3_v11.sql /var/tmp/lean_prod_t3_v11.sql 
 $ mysql forkred_preview_db lean_preview_t3 < /var/tmp/dev/forkred_dev_db_v11.sql 
 $ /var/tmp/lean_prod_t3_v11.sql  
 mysql forkred_preview_t3 lean_gate_prod_t3 < /var/tmp/dev/forkred_dev_t3_v11.sql 
 /var/tmp/lean_gate_t3_v11.sql  
 </pre> 

 Do the same for all existing page instances. (lean-gate) 

 h2. Configuration: Configuraiton: qfq.json and LocalConfiguration.php 

 qfq.json: 

 Now we need to change the used credentials from dev to the original ones from production. Btw best practice would be to refresh the used passwords. This will improve the security. 
 Change the typo3 database credentials in LocalConfiguration.php for production and preview:  
 * DB_1_USER dbname 
 * DB_1_PASSWORD password 
 * DB_1_NAME user 

 LocalConfiguration.php 

 Change qfq.json database credentials for production and preview: 
 * db DB_1_USER 
 * user DB_1_PASSWORD 
 * password DB_1_NAME 

 Change these QFQ Configurations: 
 * baseUrl 
 * wkhtmltopdf  
 (for geolean would be: LD_LIBRARY_PATH=/opt/wkhtmltox/lib /opt/wkhtmltox/bin/wkhtmltopdf) 
 * remove redirect E-Mail 
 * sitename 

 * Do not copy 'installtoolpw', instead set it again via interface - this creates 'argon' as latest hashing method. the same for all other instances. (lean-gate) 

 h2. Fullsync: New dev to new production 

 There may be refactoring changes in Form and FormElements that are required for the new T3 version. 

 # First change the sync script for new instances. 
 # Execute full sync from dev > prev > production. 

 h2. SQL Funtions 

 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. 

 h2. Others 

 Sometimes T3 Cache could make problems while upgrading. Deleting the typo3temp folder helps. 

 
 Hint: 

 
 Using relative paths in typo3 template editor could make problems in v11. It helps to change them to aboslute paths. Good example for these situations are the use of 'cd.stylesheet =' options. 


 

 Maybe its necessary to refresh ldap password? Would help to improve security.