Project

General

Profile

20230621 Geolean » History » Version 2

Enis Nuredini, 24.11.2023 09:11

1 1 Carsten Rose
{{child_pages}}
2
3
{{toc}}
4
5
h1. lean: 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/lean/@ OS:lean.system.tgz, DB:*.sql, html, dev |
8
| Lokaler Dump | @[lean] /var/tmp/dev@ |
9
| Installtool | https://lean.geo.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. Konsole
17
18
* Via GEO IT
19
20
h2. Preparation on production
21
22
<pre>
23
# Check das der neueste Kernel aktiv ist, falls nicht reboot
24
$ uname -a
25
$ dpkg --list | grep linux
26
27
#
28
# Alle alten Kernel entfernen! Das ist wichtig damit der do-release-upgrade Process nicht unnoetig alte Kernel Module aktualisiert.
29
#
30
$ CURRENT=`uname -a | cut -f 3 -d ' '`
31
$ ALL=`dpkg --list | grep -e linux-modules -e linux-image | grep -v $CURRENT | awk '{ print $2 }'`
32
$ for II in $ALL; do apt purge -y $II; done
33
34
# Backup Dir anlegen:
35
[user@tlX] mkdir /scratch/tmp/30/lean
36
# Latest T3 nach Production kopieren
37
[root@dev] cd /var/www; tar zcf /var/tmp/lean.typo3_src-11.5.25.tgz  typo3_src-11.5.25; scp /var/tmp/lean.typo3_src-11.5.25.tgz crose@ssh:/scratch/tmp/30/lean/
38
[user@tlX] scp /scratch/tmp/30/lean/lean.typo3_src-11.5.25.tgz lean.geo.uzh.ch:/var/tmp/
39
[user@tlX] scp /scratch/tmp/30/lean/lean.typo3_src-11.5.25.tgz lean-gate.geo.uzh.ch:/var/tmp/
40
41
# T3 schonmal auspacken
42
[root@lean] cd /var/html; tar zxf typo3_src-11.5.25.tgz
43
[root@lean-gate] cd /var/html; tar zxf typo3_src-11.5.25.tgz
44
45
# ** Am Tag vor der Migration **
46
# Backup anlegen. Zuerst auf TL: `mkdir /scratch/tmp/30/lean`
47
# 
48
[root@lean]
49
$ cd /
50
$ tar --exclude=var/local/prod --exclude=var/www/html -czvf /tmp/lean.system.tgz bin boot etc home initrd.img lib lib64 opt root sbin snap srv swap.img usr var vmlinuz
51
$ scp /tmp/lean.tgz crose@ssh.math.uzh.ch:/scratch/tmp/30/lean/
52
$ rsync -av /var/www/html crose@ssh.math.uzh.ch:/scratch/tmp/30/lean/
53
54
# 
55
# ** Am Tag der Migration **
56
#
57
58
# Apache anhalten
59
$ service apache2 stop
60
61
# Alle Cronjobs anhalten:
62
$ crontab -e
63
$ crontab -e -u www-data
64
65
# DBs - einmal lokal ablegen und dann nochmal remote sichern
66
$ mkdir /var/tmp/prod; cd /var/tmp/prod
67
$ rm *.sql
68
$ ALL="lean_gate_prod_t3 lean_preview_db lean_preview_t3 lean_prod_db lean_prod_t3 mysql"
69
$ for II in $ALL; do mysqldump $II > $II.sql ; done
70
$ mysqldump --no-create-info --ignore-columns=lockToDomain lean_prod_t3 fe_users > lean_prod_t3.fe_users.sql
71
$ scp *.sql crose@ssh.math.uzh.ch:/scratch/tmp/30/lean/
72
73
# 
74
# OS Migration: 
75
# 
76
77
# Ubuntu 20
78
$ do-release-upgrade 
79
80
# Login lean(u20) und Apache direkt wieder anhalten:
81
$ service apache2 stop
82
83
# Ubuntu 22
84
$ do-release-upgrade 
85
86
# Login lean(u22) und Apache direkt wieder anhalten:
87
$ service apache2 stop
88
89
# 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@.
90
$ dpkg --list | grep php
91
92
# Pakete
93
$ apt install wkhtmltopdf
94
</pre>
95
96
h2. Preparation on dev (webwork22)
97
98
<pre>
99
# Create dump of typo3 database:
100
$ mysqldump lean_dev_t3 > /var/tmp/lean_dev_t3_v11.sql
101
102
# Filestruktur 
103
$ cd /var/www/html
104
$ tar zcf /var/tmp/lean_dev_v11.tgz lean
105
</pre>
106
107
h2. File transfer: Dev to Production
108
109
Jump host TL
110
<pre>
111
[crose@tlX]
112
$ scp root@webwork22:/var/tmp/lean_dev_t3_v11.sql /scratch/tmp/30/lean/dev/
113
$ scp root@webwork22:/var/tmp/lean_dev_v11.tgz /scratch/tmp/30/lean/dev/
114
115
$ rsync -av  /scratch/tmp/30/lean/dev root@lean.math.uzh.ch:/var/tmp/
116
</pre>
117
118
h2. Setup Production
119
120
<pre>
121
[root@lean]
122
123
$ cd /var/www/
124
$ mv html html.v9
125
126
# Unpack page instance for prod and preview. Rename them to original name and check the right permissions:
127
128
# Prod
129
$ cd /var/www/
130
$ tar -xzf /var/tmp/dev/lean_dev_v11.tgz
131
$ mv lean html
132
133
# Preview
134
$ tar -xzf /var/tmp/dev/lean_dev_v11.tgz
135
$ mv lean html/preview
136
137
# Import T3 DBs (Prod & Peview same)
138
$ mysql lean_prod_t3 < /var/tmp/dev/lean_dev_t3_v11.sql
139
$ mysql lean_preview_t3 < /var/tmp/dev/lean_dev_t3_v11.sql
140
141
#
142
# ** Sync QFQ Data **
143
# 
144
[crose@tlX]
145
$ cd /scratch/share/system/sync/lean/
146
$ ./leanDevPreviewSync.sh -f
147
$ ./leanDevProdSync.sh -f
148
149
# 
150
# Restore FE_USERS
151
# 
152
$ mysql lean_prod_t3 < /var/tmp/prod/lean_prod_t3.fe_users.sql
153
$ mysql lean_preview_t3 < /var/tmp/prod/lean_prod_t3.fe_users.sql
154
155
# 
156
# Restore fileadmin
157
# 
158
$ mkdir /var/tmp/fileadmin.dev
159
160
# Keep dev version temporarily on prod for comparison in case 
161
$ mv /var/www/html/fileadmin/financialrequests /var/tmp/fileadmin.dev/financialrequests
162
$ mv /var/www/html/fileadmin/protected /var/tmp/fileadmin/.dev/protected
163
164
# Restore prod: financialrequests & protected
165
$ mv /var/www/html.v9/fileadmin/financialrequests /var/www/html/fileadmin/
166
$ mv /var/www/html.v9/fileadmin/protected /var/www/html/fileadmin/
167
168
# Restore preview: financialrequests & protected
169
$ \rm -R /var/www/html/preview/fileadmin/protected /var/www/html/preview/fileadmin/financialrequests
170
$ mv /var/www/html.v9/preview/fileadmin/financialrequests /var/www/html/preview/fileadmin/
171
$ mv /var/www/html.v9/preview/fileadmin/protected /var/www/html/preview/fileadmin/
172
</pre>
173
174
h2. Configuration: qfq.json and LocalConfiguration.php
175
176
* Prepare the final config files in `/var/tmp/dev/prev|prod`
177
178
qfq.json:
179
180
* DB_1_USER
181
* DB_1_PASSWORD
182
* DB_1_NAME
183
184
LocalConfiguration.php:
185
186
* db
187
* user
188
* password
189
* baseUrl
190
* wkhtmltopdf 
191
* redirect E-Mail
192
* sitename
193
* installtoolpw
194
195
Copy config files:
196
197
<pre>
198
$ cp /var/tmp/dev/prod/LocalConfiguration.php /var/www/html/typo3conf/
199
$ cp /var/tmp/dev/prev/LocalConfiguration.php /var/www/html/preview/typo3conf/
200
</pre>
201
202
h2. Finalize
203
204
<pre>
205
# Alle Cronjobs aktvieren:
206
$ cronjob -e
207
$ cronjob -e -u www-data
208
</pre>
209
210
* Check Backup.
211
* Check PDF to SMB.
212
* Remove old lean dev instance (webwork16).
213
* Update kpit PWs with webwork16/webwork22 credentials.
214
* Update "Project Wiki":https://project.math.uzh.ch/projects/lean/wiki summary with new dev instance (webwork22).
215
*
216
217 2 Enis Nuredini
h2. Python Module
218
219
Folgende Module werden für die verwendeten Skripte benötigt:
220
<pre>
221
pandas
222
openpyxl
223
cvxpy
224
cvxopt
225
</pre>
226
227 1 Carsten Rose
h2. Probleme bei der Migration
228
229
* Nach dem @do-release-upgrade@ waren noch viele PHP 7.4 Pakete (Status: rc) installiert. @apt purge php7.4*@
230
* 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.
231
* 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@
232
* Das FE Login Template sieht schlecht aus. Im @typo3_src@ Vezeichnis hat EN einige Anpassungen gemacht (webwork22) - darum als Quickfix die angepasste Version auf lean kopiert (geht mit dem naechsten Typo3 Update verloren (@typo3_src-11.5.25/typo3/sysext/felogin/Resources/Private/Templates/Login/Login.html@)