Project

General

Profile

20230614 LSZGS » History » Version 15

Carsten Rose, 14.06.2023 17:11

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 2 Carsten Rose
$ tar --exclude=var/local/prod --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
$ 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
# 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@.
96
$ dpkg --list | grep php
97 13 Carsten Rose
$ apt purge php7.4* libapache2-mod-php7.2
98 9 Carsten Rose
$ apt install php-xml php-json
99 1 Carsten Rose
</pre>
100
101
h2. Preparation on dev (webwork22)
102
103
<pre>
104
# Create dump of typo3 database:
105 2 Carsten Rose
$ mysqldump join_dev_t3 > /var/tmp/join_dev_t3_v11.sql
106 1 Carsten Rose
107
# Filestruktur 
108
$ cd /var/www/html
109 2 Carsten Rose
$ tar zcf /var/tmp/join_dev_v11.tgz join
110 1 Carsten Rose
</pre>
111
112
h2. File transfer: Dev to Production
113
114
Jump host TL
115
<pre>
116
[crose@tlX]
117 2 Carsten Rose
$ scp root@webwork22:/var/tmp/join_dev_t3_v11.sql /scratch/tmp/30/join/dev/
118
$ scp root@webwork22:/var/tmp/join_dev_v11.tgz /scratch/tmp/30/join/dev/
119 1 Carsten Rose
120 2 Carsten Rose
$ rsync -av  /scratch/tmp/30/join/dev root@join.math.uzh.ch:/var/tmp/
121 1 Carsten Rose
</pre>
122
123
h2. Setup Production
124
125
<pre>
126 2 Carsten Rose
[root@join]
127 1 Carsten Rose
128
$ cd /var/www/
129
$ mv html html.v9
130
131
# Unpack page instance for prod and preview. Rename them to original name and check the right permissions:
132
133
# Prod
134
$ cd /var/www/
135 10 Carsten Rose
$ tar -xzf /var/tmp/dev/lszgs_dev_v11.tgz
136 2 Carsten Rose
$ mv join html
137 1 Carsten Rose
138
# Preview
139 10 Carsten Rose
$ tar -xzf /var/tmp/dev/lszgs_dev_v11.tgz
140 2 Carsten Rose
$ mv join html/preview
141 1 Carsten Rose
142 11 Carsten Rose
# Drop old T3 (tables might be changed), create empty one
143
$ mysql
144
% drop database lszgs_prod_t3;
145
% drop database lszgs_preview_t3;
146
% create database lszgs_prod_t3;
147
% create database lszgs_preview_t3;
148
149
# Not necessary if there is a full sync in the next step: Import T3 DBs (Prod & Peview same)
150 10 Carsten Rose
$ mysql lszgs_prod_t3 < /var/tmp/dev/lszgs_dev_t3_v11.sql
151
$ mysql lszgs_preview_t3 < /var/tmp/dev/lszgs_dev_t3_v11.sql
152 1 Carsten Rose
153
#
154
# ** Sync QFQ Data **
155
# 
156
[crose@tlX]
157 2 Carsten Rose
$ cd /scratch/share/system/sync/join/
158
$ ./joinDevPreviewSync.sh -f
159
$ ./joinDevProdSync.sh -f
160 1 Carsten Rose
161
# 
162
# Restore fileadmin
163
# 
164
$ mkdir /var/tmp/fileadmin.dev
165
166
# Keep dev version temporarily on prod for comparison in case 
167
$ mv /var/www/html/fileadmin/protected /var/tmp/fileadmin/.dev/protected
168
169
# Restore prod: financialrequests & protected
170
$ mv /var/www/html.v9/fileadmin/protected /var/www/html/fileadmin/
171
172
# Restore preview: financialrequests & protected
173 12 Carsten Rose
$ \rm -R /var/www/html/preview/fileadmin/protected 
174 1 Carsten Rose
$ mv /var/www/html.v9/preview/fileadmin/protected /var/www/html/preview/fileadmin/
175
</pre>
176
177
h2. Configuration: qfq.json and LocalConfiguration.php
178
179
* Prepare the final config files in `/var/tmp/dev/prev|prod`
180
181
qfq.json:
182
183
* DB_1_USER
184
* DB_1_PASSWORD
185
* DB_1_NAME
186
187
LocalConfiguration.php:
188
189
* db
190
* user
191
* password
192
* baseUrl
193
* wkhtmltopdf 
194
* redirect E-Mail
195
* sitename
196
* installtoolpw
197
198
Copy config files:
199
200
<pre>
201
$ cp /var/tmp/dev/prod/LocalConfiguration.php /var/www/html/typo3conf/
202
$ cp /var/tmp/dev/prev/LocalConfiguration.php /var/www/html/preview/typo3conf/
203
</pre>
204
205
h2. Finalize
206
207 14 Carsten Rose
* Play ansible playbook
208 1 Carsten Rose
<pre>
209 14 Carsten Rose
[user@tlX] 
210
$ cd git/it/ansible/playbooks
211
$ ansible-playbook -i ../hosts qfq.yml --limit join
212
213
[root@join]
214
$ a2enmod php8.1 
215
$ service apache2 restart
216
217
</pre>
218
219
* Misc
220
<pre>
221
# Set Permissions
222
$ chown -R www-data:www-data /var/www/html
223
224 1 Carsten Rose
# Alle Cronjobs aktvieren:
225
$ cronjob -e
226
$ cronjob -e -u www-data
227
</pre>
228
229 2 Carsten Rose
* Check Backup.
230 1 Carsten Rose
* Remove old join dev instance (webwork16).
231 2 Carsten Rose
* Update kpit PWs with webwork16/webwork22 credentials.
232 1 Carsten Rose
* Update "Project Wiki":https://project.math.uzh.ch/projects/join/wiki summary with new dev instance (webwork22).
233
234
h2. Probleme bei der Migration
235
236
* 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@
237 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@)