Project

General

Profile

20230616 GRC » History » Version 3

Carsten Rose, 16.06.2023 09:56

1 1 Carsten Rose
{{child_pages}}
2
3
{{toc}}
4
5
h1. GRC / grc: 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/grc/@ OS:grc.system.tgz, DB:*.sql, html, dev |
8
| Lokaler Dump | @[grc] /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/grc
42
# Latest T3 nach Production kopieren
43 2 Carsten Rose
[user@tlX] scp /scratch/software/typo3/typo3_src-11.5.25.tgz root@grc-tool.uzh.ch:/var/tmp/
44 1 Carsten Rose
45
# T3 schonmal auspacken
46
[root@grc] 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/grc`
50
# 
51
[root@grc]
52
$ cd /
53
$ tar --exclude=var/www/html -czvf /tmp/grc.system.tgz bin boot etc home initrd.img lib lib64 opt root sbin snap srv swap.img usr var vmlinuz
54
$ scp /tmp/grc.tgz crose@ssh.math.uzh.ch:/scratch/tmp/30/grc/
55
$ rsync -av /var/www/html crose@ssh.math.uzh.ch:/scratch/tmp/30/grc/
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="grctool_preview_db grctool_preview_t3 grctool_prod_db grctool_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/grc/
75
76
# Backup latest files:
77
$ rsync -av --delete /var/www/html/ crose@ssh.math.uzh.ch:/scratch/tmp/30/grc/html/
78
79
# 
80
# OS Migration: 
81
# 
82
83
# Ubuntu 20
84
$ do-release-upgrade 
85
86
# Login grc(u20) und Apache direkt wieder anhalten:
87
$ service apache2 stop
88
89
# Ubuntu 22
90
$ do-release-upgrade 
91
92
# Login grc(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
# Bei dieser Migration fehlten nach der Migration @php-xml@, @php-json@.
98
$ dpkg --list | grep php
99 3 Carsten Rose
$ apt purge php7.0* php7.4* libapache2-mod-php7.2
100 1 Carsten Rose
$ apt install php-xml php-json
101
</pre>
102
103
h2. Preparation on dev (webwork22)
104
105
<pre>
106
# Create dump of typo3 database:
107
$ mysqldump grc_dev_t3 > /var/tmp/grc_dev_t3_v11.sql
108
109
# Filestruktur 
110
$ cd /var/www/html
111
$ tar zcf /var/tmp/grc_dev_v11.tgz grc
112
</pre>
113
114
h2. File transfer: Dev to Production
115
116
Jump host TL
117
<pre>
118
[crose@tlX]
119
$ scp root@webwork22:/var/tmp/grc_dev_t3_v11.sql /scratch/tmp/30/grc/dev/
120
$ scp root@webwork22:/var/tmp/grc_dev_v11.tgz /scratch/tmp/30/grc/dev/
121
122
$ rsync -av  /scratch/tmp/30/grc/dev root@grc.math.uzh.ch:/var/tmp/
123
</pre>
124
125
h2. Setup Production
126
127
<pre>
128
[root@grc]
129
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 2 Carsten Rose
$ tar -xzf /var/tmp/dev/grc_dev_v11.tgz
138 1 Carsten Rose
$ mv grc html
139
140
# Preview
141 2 Carsten Rose
$ tar -xzf /var/tmp/dev/grc_dev_v11.tgz
142 1 Carsten Rose
$ mv grc html/preview
143
144
# Drop old T3 (tables might be changed), create empty one
145
$ mysql
146 2 Carsten Rose
% drop database grc_prod_t3;
147
% drop database grc_preview_t3;
148
% create database grc_prod_t3;
149
% create database grc_preview_t3;
150 1 Carsten Rose
151
# Not necessary if there is a full sync in the next step: Import T3 DBs (Prod & Peview same)
152 2 Carsten Rose
$ mysql grc_prod_t3 < /var/tmp/dev/grc_dev_t3_v11.sql
153
$ mysql grc_preview_t3 < /var/tmp/dev/grc_dev_t3_v11.sql
154 1 Carsten Rose
155
#
156
# ** Sync QFQ Data **
157
# 
158
[crose@tlX]
159
$ cd /scratch/share/system/sync/grc/
160
$ ./grcDevPreviewSync.sh -f
161
$ ./grcDevProdSync.sh -f
162
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
$ \rm -R /var/www/html/preview/fileadmin/protected 
176
$ 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
* Play ansible playbook
210
<pre>
211
[user@tlX] 
212
$ cd git/it/ansible/playbooks
213
$ ansible-playbook -i ../hosts qfq.yml --limit grc
214
215
[root@grc]
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
# Alle Cronjobs aktvieren:
227
$ cronjob -e
228
$ cronjob -e -u www-data
229
</pre>
230
231
* Check Backup.
232
* Remove old grc dev instance (webwork16).
233
234
  * Incl. 'Autocron' Dev
235
236
* Update kpit PWs with webwork16/webwork22 credentials.
237
* Update "Project Wiki":https://project.math.uzh.ch/projects/grc/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
* Das FE Login Template sieht schlecht aus. Im @typo3_src@ Vezeichnis hat EN einige Anpassungen gemacht (webwork22) - darum als Quickfix die angepasste Version auf grc kopiert (geht mit dem naechsten Typo3 Update verloren (@typo3_src-11.5.25/typo3/sysext/felogin/Resources/Private/Templates/Login/Login.html@)