Project

General

Profile

20230614 LSZGS » History » Version 18

Carsten Rose, 15.06.2023 16:54

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