Project

General

Profile

20230623 IK » History » Version 1

Carsten Rose, 23.06.2023 08:46

1 1 Carsten Rose
{{child_pages}}
2
3
{{toc}}
4
5
h1. IK-Tool: 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/ik/@ OS:ik.system.tgz, DB:*.sql, html, dev |
8
| Lokaler Dump | @[inframitool01] /var/tmp/dev@ |
9
| Installtool | https://www.ik.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/ik
42
# Latest T3 nach Production kopieren
43
[user@tlX] scp /scratch/software/typo3/typo3_src-11.5.25.tgz root@inframitool01.uzh.ch:/var/tmp/
44
45
# T3 schonmal auspacken
46
[root@IK] 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/ik`
50
# 
51
[root@IK]
52
$ cd /
53
$ tar --exclude=var/www/html -czvf /tmp/ik.system.tgz bin boot etc home initrd.img lib lib64 opt root sbin snap srv swap.img usr var vmlinuz
54
$ scp /var/tmp/ik.system.tgz crose@ssh.math.uzh.ch:/scratch/tmp/30/ik/
55
$ rsync -av /var/www/html crose@ssh.math.uzh.ch:/scratch/tmp/30/ik/
56
57
# 
58
# ** Am Tag der Migration **
59
#
60
61
# Apache anhalten
62
$ service apache2 stop
63
64
# Alle Cronjobs anhalten:
65
$ crontab -e
66
$ crontab -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
72
$ ALL="mi_preview_db mi_preview_t3 mi_prod_db mi_prod_t3 mysql"
73
$ for II in $ALL; do echo $II; mysqldump $II > $II.sql ; done
74
$ scp *.sql crose@ssh.math.uzh.ch:/scratch/tmp/30/ik/
75
76
# Backup latest files:
77
$ rsync -av --delete /var/www/html/ crose@ssh.math.uzh.ch:/scratch/tmp/30/ik/html/
78
79
# 
80
# OS Migration: 
81
# 
82
83
# Ubuntu 20
84
$ do-release-upgrade 
85
86
# Login IK(u20) und Apache direkt wieder anhalten:
87
$ service apache2 stop
88
89
# Ubuntu 22
90
$ do-release-upgrade 
91
92
# Login IK(u22) und Apache direkt wieder anhalten:
93
$ service apache2 stop
94
95
# Check welche PHP Version installiert. Ggfs. sind noch alte installiert. 
96
# Am besten vergleichen ob alle PHP Pakete von der alten Version auch in der neuen installiert sind. 
97
$ dpkg --list | grep php
98
$ apt purge php7.0* php7.4* libapache2-mod-php7.2
99
$ apt install php-xml php-json
100
</pre>
101
102
h2. Preparation on dev (webwork22)
103
104
<pre>
105
# Create dump of typo3 database:
106
$ mysqldump mi_dev_t3 > /var/tmp/mi_dev_t3_v11.sql
107
108
# Filestruktur 
109
$ cd /var/www/html
110
$ tar zcf /var/tmp/mi_dev_v11.tgz mi
111
</pre>
112
113
h2. File transfer: Dev to Production
114
115
Jump host TL
116
<pre>
117
[crose@tlX]
118
$ scp root@webwork22:/var/tmp/mi_dev_t3_v11.sql /scratch/tmp/30/ik/dev/
119
$ scp root@webwork22:/var/tmp/mi_dev_v11.tgz /scratch/tmp/30/ik/dev/
120
121
$ rsync -av  /scratch/tmp/30/ik/dev root@inframitool01.uzh.ch:/var/tmp/
122
</pre>
123
124
h2. Setup Production
125
126
<pre>
127
[root@inframitoool01]
128
129
$ cd /var/www/
130
$ mv html html.v8
131
132
# Unpack page instance for prod and preview. Rename them to original name and check the right permissions:
133
134
# Prod
135
$ cd /var/www/
136
$ tar -xzf /var/tmp/dev/ik_dev_v11.tgz
137
$ mv IK html
138
139
# Preview
140
$ tar -xzf /var/tmp/dev/ik_dev_v11.tgz
141
$ mv mi html/preview
142
143
# Drop old T3 (tables might be changed), create empty one
144
$ mysql
145
% drop database mi_prod_t3;
146
% drop database mi_preview_t3;
147
% create database mi_prod_t3;
148
% create database mi_preview_t3;
149
150
# Not necessary if there is a full sync in the next step: Import T3 DBs (Prod & Peview same)
151
$ mysql mi_prod_t3 < /var/tmp/dev/ik_dev_t3_v11.sql
152
$ mysql mi_preview_t3 < /var/tmp/dev/ik_dev_t3_v11.sql
153
154
#
155
# ** Sync QFQ Data **
156
# 
157
[crose@tlX]
158
$ cd /scratch/share/system/sync/ik/
159
$ ./IKDevPreviewSync.sh -f
160
$ ./IKDevProdSync.sh -f
161
162
# 
163
# Restore fileadmin
164
# 
165
$ mkdir /var/tmp/fileadmin.dev
166
167
# Keep dev version temporarily on prod for comparison in case 
168
$ mv /var/www/html/fileadmin/protected /var/tmp/fileadmin/.dev/protected
169
170
# Restore prod: financialrequests & protected
171
$ mv /var/www/html.v9/fileadmin/protected /var/www/html/fileadmin/
172
173
# Restore preview: financialrequests & protected
174
$ \rm -R /var/www/html/preview/fileadmin/protected 
175
$ mv /var/www/html.v8/preview/fileadmin/protected /var/www/html/preview/fileadmin/
176
</pre>
177
178
h2. Configuration: qfq.json and LocalConfiguration.php
179
180
* Prepare the final config files in `/var/tmp/dev/prev|prod`
181
182
LocalConfiguration.php:
183
184
* db
185
* user
186
* password
187
* baseUrl
188
* wkhtmltopdf 
189
* redirect E-Mail
190
* sitename
191
* installtoolpw
192
193
Copy config files:
194
195
<pre>
196
$ cp /var/tmp/dev/prod/LocalConfiguration.php /var/www/html/typo3conf/
197
$ cp /var/tmp/dev/prev/LocalConfiguration.php /var/www/html/preview/typo3conf/
198
</pre>
199
200
h2. Finalize
201
202
* Play ansible playbook
203
<pre>
204
[user@tlX] 
205
$ cd git/it/ansible/playbooks
206
$ ansible-playbook -i ../hosts qfq.yml --limit inframitool01
207
208
[root@IK]
209
$ a2enmod php8.1 
210
$ service apache2 restart
211
212
</pre>
213
214
* Misc
215
<pre>
216
# Set Permissions
217
$ chown -R www-data:www-data /var/www/html
218
219
# Alle Cronjobs aktvieren:
220
$ cronjob -e
221
$ cronjob -e -u www-data
222
</pre>
223
224
* Check Backup.
225
* Remove old IK dev instance (webwork16).
226
227
  * Incl. 'Autocron' Dev
228
229
* Update kpit PWs with webwork16/webwork22 credentials.
230
* Update "Project Wiki":https://project.math.uzh.ch/projects/IK/wiki summary with new dev instance (webwork22).
231
232
h2. Probleme bei der Migration
233
234
* 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@
235
* Das FE Login Template sieht schlecht aus. Im @typo3_src@ Vezeichnis hat EN einige Anpassungen gemacht (webwork22) - darum als Quickfix die angepasste Version auf IK kopiert (geht mit dem naechsten Typo3 Update verloren (@typo3_src-11.5.25/typo3/sysext/felogin/Resources/Private/Templates/Login/Login.html@)