Project

General

Profile

20230614 LSZGS » History » Version 1

Carsten Rose, 13.06.2023 20:10

1 1 Carsten Rose
{{child_pages}}
2
3
{{toc}}
4
5
h1. LSZGS / join: OS Update U18>U22, T3 V9>V11, PHP 7.2>8.1, MariaDB 10.1>10.6
6
7
| Backup / Datenaustausch | @[tl] /scratch/tmp/30/forkred/@ OS:forkred.system.tgz, DB:*.sql, html, dev |
8
| Lokaler Dump | @[forkred] /var/tmp/dev@ |
9
| Installtool | https://www.myuzhgrants.uzh.ch/typo3/install.php |
10
| MariaDB | Update 10.1 > 10.6 - all columns need a default value if INSERT does not specify the column |
11
12
* 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.
13
* Sometimes T3 Cache could make problems while upgrading. Deleting the typo3temp folder helps.
14
* 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.
15
16
h2. VMWare Konsole
17
18
* Check das CR sich einloggen kann: https://wikiit.math.uzh.ch/it/bestpractice/vmware-console
19
20
  * Wird der IE genommen, funktioniert der Aufruf der vsphere Seite nciht.
21
  * Edge hat mehrere Minuten gebraucht um zu starten.
22
  * Firefox konnte sich anmelden, dann hat CR aber abgebrochen weil mittlerweile Edge gestartet ist.
23
24
* Edge hat die Konsole gut dargestellt.
25
26
h2. Preparation on production
27
28
<pre>
29
# Check das der neueste Kernel aktiv ist, falls nicht reboot
30
$ uname -a
31
$ dpkg --list | grep linux
32
33
#
34
# Alle alten Kernel entfernen! Das ist wichtig damit der do-release-upgrade Process nicht unnoetig alte Kernel Module aktualisiert.
35
#
36
$ CURRENT=`uname -a | cut -f 3 -d ' '`
37
$ ALL=`dpkg --list | grep -e linux-modules -e linux-image | grep -v $CURRENT | awk '{ print $2 }'`
38
$ for II in $ALL; do apt purge -y $II; done
39
40
# Backup Dir anlegen:
41
[user@tlX] mkdir /scratch/tmp/30/forkred
42
# Latest T3 nach Production kopieren
43
[user@tlX] scp /scratch/software/typo3/typo3_src-11.5.25.tgz root@forkred.uzh.ch:/var/tmp/
44
45
# T3 schonmal auspacken
46
[root@forkred] cd /var/html; tar zxf typo3_src-11.5.25.tgz
47
48
# ** Am Tag vor der Migration **
49
# Backup anlegen. Zuerst auf TL: `mkdir /scratch/tmp/30/forkred`
50
# 
51
[root@forkred]
52
$ cd /
53
$ tar --exclude=var/local/prod --exclude=var/www/html -czvf /tmp/forkred.system.tgz bin boot etc home initrd.img lib lib64 opt root sbin snap srv swap.img usr var vmlinuz
54
$ scp /tmp/forkred.tgz crose@ssh.math.uzh.ch:/scratch/tmp/30/forkred/
55
$ rsync -av /var/www/html crose@ssh.math.uzh.ch:/scratch/tmp/30/forkred/
56
57
# 
58
# ** Am Tag der Migration **
59
#
60
61
# Apache anhalten
62
$ service apache2 stop
63
64
# Alle Cronjobs anhalten:
65
$ cronjob -e
66
$ cronjob -e -u www-data
67
68
# DBs - einmal lokal ablegen und dann nochmal remote sichern
69
$ mkdir /var/tmp/prod; cd /var/tmp/prod
70
$ rm *.sql
71
$ ALL="forkred_preview_db forkred_preview_t3 forkred_prod_db forkred_prod_t3 mysql"
72
$ for II in $ALL; do mysqldump $II > $II.sql ; done
73
$ scp *.sql crose@ssh.math.uzh.ch:/scratch/tmp/30/forkred/
74
75
# Backup latest files:
76
$ rsync -av --delete /var/www/html/ crose@ssh.math.uzh.ch:/scratch/tmp/30/forkred/html/
77
78
# 
79
# OS Migration: 
80
# 
81
82
# Ubuntu 20
83
$ do-release-upgrade 
84
85
# Login forkred(u20) und Apache direkt wieder anhalten:
86
$ service apache2 stop
87
88
# Ubuntu 22
89
$ do-release-upgrade 
90
91
# Login forkred(u22) und Apache direkt wieder anhalten:
92
$ service apache2 stop
93
94
# 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@.
95
$ dpkg --list | grep php
96
</pre>
97
98
h2. Preparation on dev (webwork22)
99
100
<pre>
101
# Create dump of typo3 database:
102
$ mysqldump forkred_dev_t3 > /var/tmp/forkred_dev_t3_v11.sql
103
104
# Filestruktur 
105
$ cd /var/www/html
106
$ tar zcf /var/tmp/forkred_dev_v11.tgz forkred
107
</pre>
108
109
h2. File transfer: Dev to Production
110
111
Jump host TL
112
<pre>
113
[crose@tlX]
114
$ scp root@webwork22:/var/tmp/forkred_dev_t3_v11.sql /scratch/tmp/30/forkred/dev/
115
$ scp root@webwork22:/var/tmp/forkred_dev_v11.tgz /scratch/tmp/30/forkred/dev/
116
117
$ rsync -av  /scratch/tmp/30/forkred/dev root@forkred.math.uzh.ch:/var/tmp/
118
</pre>
119
120
h2. Setup Production
121
122
<pre>
123
[root@forkred]
124
125
$ cd /var/www/
126
$ mv html html.v9
127
128
# Unpack page instance for prod and preview. Rename them to original name and check the right permissions:
129
130
# Prod
131
$ cd /var/www/
132
$ tar -xzf /var/tmp/dev/forkred_dev_v11.tgz
133
$ mv forkred html
134
135
# Preview
136
$ tar -xzf /var/tmp/dev/forkred_dev_v11.tgz
137
$ mv forkred html/preview
138
139
# Import T3 DBs (Prod & Peview same)
140
$ mysql forkred_prod_t3 < /var/tmp/dev/forkred_dev_t3_v11.sql
141
$ mysql forkred_preview_t3 < /var/tmp/dev/forkred_dev_t3_v11.sql
142
143
#
144
# ** Sync QFQ Data **
145
# 
146
[crose@tlX]
147
$ cd /scratch/share/system/sync/forkred/
148
$ ./forkredDevPreviewSync.sh -f
149
$ ./forkredDevProdSync.sh -f
150
151
# 
152
# Restore fileadmin
153
# 
154
$ mkdir /var/tmp/fileadmin.dev
155
156
# Keep dev version temporarily on prod for comparison in case 
157
$ mv /var/www/html/fileadmin/financialrequests /var/tmp/fileadmin.dev/financialrequests
158
$ mv /var/www/html/fileadmin/protected /var/tmp/fileadmin/.dev/protected
159
160
# Restore prod: financialrequests & protected
161
$ mv /var/www/html.v9/fileadmin/financialrequests /var/www/html/fileadmin/
162
$ mv /var/www/html.v9/fileadmin/protected /var/www/html/fileadmin/
163
164
# Restore preview: financialrequests & protected
165
$ \rm -R /var/www/html/preview/fileadmin/protected /var/www/html/preview/fileadmin/financialrequests
166
$ mv /var/www/html.v9/preview/fileadmin/financialrequests /var/www/html/preview/fileadmin/
167
$ mv /var/www/html.v9/preview/fileadmin/protected /var/www/html/preview/fileadmin/
168
</pre>
169
170
h2. Configuration: qfq.json and LocalConfiguration.php
171
172
* Prepare the final config files in `/var/tmp/dev/prev|prod`
173
174
qfq.json:
175
176
* DB_1_USER
177
* DB_1_PASSWORD
178
* DB_1_NAME
179
180
LocalConfiguration.php:
181
182
* db
183
* user
184
* password
185
* baseUrl
186
* wkhtmltopdf 
187
* redirect E-Mail
188
* sitename
189
* installtoolpw
190
191
Copy config files:
192
193
<pre>
194
$ cp /var/tmp/dev/prod/LocalConfiguration.php /var/www/html/typo3conf/
195
$ cp /var/tmp/dev/prev/LocalConfiguration.php /var/www/html/preview/typo3conf/
196
</pre>
197
198
h2. Finalize
199
200
<pre>
201
# Alle Cronjobs aktvieren:
202
$ cronjob -e
203
$ cronjob -e -u www-data
204
</pre>
205
206
* Check Backup.
207
* Check PDF to SMB.
208
* Remove old forkred dev instance (webwork16).
209
* Update kpit PWs with webwork16/webwork22 credentials.
210
* Update "Project Wiki":https://project.math.uzh.ch/projects/forkred/wiki summary with new dev instance (webwork22).
211
*
212
213
h2. Probleme bei der Migration
214
215
* Nach dem @do-release-upgrade@ waren noch viele PHP 7.4 Pakete (Status: rc) installiert. @apt purge php7.4*@
216
* Es fehlten PHP Pakete: @apt install php-xml php-json@. Nach der Migration konnte Typo3 weder BE noch FE rendern. CR hat dann eine neue T3 Instanz hochgezogen, da wurde php-xml moniert. Damit war der Fehler klar. In den Apache Logs war der Fehler nicht zu erkennen.
217
* 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@
218
* Das FE Login Template sieht schlecht aus. Im @typo3_src@ Vezeichnis hat EN einige Anpassungen gemacht (webwork22) - darum als Quickfix die angepasste Version auf forkred kopiert (geht mit dem naechsten Typo3 Update verloren (@typo3_src-11.5.25/typo3/sysext/felogin/Resources/Private/Templates/Login/Login.html@)