Project

General

Profile

20230626 HMS » History » Version 1

Carsten Rose, 27.06.2023 14:44

1 1 Carsten Rose
{{child_pages}}
2
3
{{toc}}
4
5
h1. HMS-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/hms/@ OS:hms.system.tgz, DB:*.sql, html, dev |
8
| Lokaler Dump | @[hms-tool] /var/tmp/dev@ |
9
| Installtool | https://hms-tool.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. Process
17
18
* 15:43 Start do-release-upgrade (U18 > U20)
19
* 16:03 Reboot
20
* 16:05 Start do-release-upgrade (U20 > U22)
21
* 16:22 Reboot
22
* 17:18 Migration abgeschlossen
23
24
25
h2. VMWare Konsole
26
27
* Check das CR sich einloggen kann: https://wikiit.math.uzh.ch/it/bestpractice/vmware-console
28
29
  * Wird der IE genommen, funktioniert der Aufruf der vsphere Seite nicht.
30
  * Edge hat mehrere Minuten gebraucht um zu starten.
31
  * Firefox konnte sich anmelden, dann hat CR aber abgebrochen weil mittlerweile Edge gestartet ist.
32
33
* Edge hat die Konsole gut dargestellt.
34
35
h2. Preparation on production
36
37
<pre>
38
# Check das der neueste Kernel aktiv ist, falls nicht reboot
39
$ uname -a
40
$ dpkg --list | grep linux
41
42
#
43
# Alle alten Kernel entfernen! Das ist wichtig damit der do-release-upgrade Process nicht unnoetig alte Kernel Module aktualisiert.
44
#
45
$ CURRENT=`uname -a | cut -f 3 -d ' '`
46
$ ALL=`dpkg --list | grep -e linux-modules -e linux-image | grep -v $CURRENT | awk '{ print $2 }'`
47
$ for II in $ALL; do apt purge -y $II; done
48
49
# Backup Dir anlegen:
50
[user@tlX] mkdir /scratch/tmp/30/hms
51
# Latest T3 nach Production kopieren
52
[user@tlX] scp /scratch/software/typo3/typo3_src-11.5.25.tgz root@hms-tool.uzh.ch:/var/tmp/
53
54
# T3 schonmal auspacken
55
[root@hms-tool] cd /var/html; tar zxf typo3_src-11.5.25.tgz
56
57
# ** Am Tag vor der Migration **
58
# Backup anlegen. Zuerst auf TL: `mkdir /scratch/tmp/30/hms`
59
# 
60
[root@hms-tool
61
$ cd /
62
$ tar --exclude=var/www/html -czvf /var/tmp/hms.system.tgz bin boot etc home initrd.img lib lib64 opt root sbin snap srv swap.img usr var vmlinuz
63
$ scp /var/tmp/hms.system.tgz crose@ssh.math.uzh.ch:/scratch/tmp/30/hms/
64
$ rsync -av /var/www/html crose@ssh.math.uzh.ch:/scratch/tmp/30/hms/
65
66
# phpMyAdmin
67
$ scp crose@ssh.math.uzh.ch:/scratch/software/php/phpMyAdmin-5.2.1-all-languages.zip /var/tmp/
68
$ cd /var/www/; unzip /var/tmp/phpMyAdmin-5.2.1-all-languages.zip
69
$ cd /var/www/phpMyAdmin-5.2.1-all-languages/
70
$ cp config.sample.inc.php config.inc.php
71
$ vim config.inc.php
72
73
# 
74
# ** Am Tag der Migration **
75
#
76
77
# Apache anhalten
78
$ service apache2 stop
79
80
# Alle Cronjobs anhalten:
81
$ crontab -e
82
$ crontab -e -u www-data
83
84
# DBs - einmal lokal ablegen und dann nochmal remote sichern
85
$ mkdir /var/tmp/prod; cd /var/tmp/prod
86
$ rm *.sql
87
88
#$ ALL="hms_preview_db hms_preview_t3 hms_prod_db hms_prod_t3 mysql"
89
$ ALL="hms_prod_db hms_prod_t3 mysql"
90
$ for II in $ALL; do echo $II; mysqldump $II > $II.sql ; done
91
$ mysqldump hms_prod_t3 fe_users > mi_prod_t3.fe_users.sql
92
$ scp *.sql crose@ssh.math.uzh.ch:/scratch/tmp/30/hms/
93
94
# Backup latest files:
95
$ rsync -av --delete /var/www/html/ crose@ssh.math.uzh.ch:/scratch/tmp/30/hms/html/
96
97
# 
98
# OS Migration: 
99
# 
100
101
# Ubuntu 20
102
$ do-release-upgrade 
103
104
# Login HMS(u20) und Apache direkt wieder anhalten:
105
$ service apache2 stop
106
107
# Ubuntu 22
108
$ do-release-upgrade 
109
110
# Login HMS(u22) und Apache direkt wieder anhalten:
111
$ service apache2 stop
112
113
# Check welche PHP Version installiert. Ggfs. sind noch alte installiert. 
114
# Am besten vergleichen ob alle PHP Pakete von der alten Version auch in der neuen installiert sind. 
115
$ dpkg --list | grep php
116
$ apt purge php7* libapache2-mod-php7.2 libapache2-mod-php7.0
117
$ apt install php-xml php-json
118
$ rm /etc/apache2/mods-enabled/php7.4*
119
$ a2enmod php8.1
120
121
</pre>
122
123
h2. Preparation on dev (webwork22)
124
125
<pre>
126
# Create dump of typo3 database:
127
$ mysqldump mi_dev_t3 > /var/tmp/hms_dev_t3_v11.sql
128
129
# Filestruktur 
130
$ cd /var/www/html
131
$ tar zcf /var/tmp/hms_dev_v11.tgz mi
132
</pre>
133
134
h2. File transfer: Dev to Production
135
136
Jump host TL
137
<pre>
138
[crose@tlX]
139
$ scp root@webwork22:/var/tmp/hms_dev_t3_v11.sql /scratch/tmp/30/hms/dev/
140
$ scp root@webwork22:/var/tmp/hms_dev_v11.tgz /scratch/tmp/30/hms/dev/
141
142
$ rsync -av  /scratch/tmp/30/hms/dev root@hms-tool.uzh.ch:/var/tmp/
143
</pre>
144
145
h2. Setup Production
146
147
<pre>
148
[root@hms-tool]
149
150
$ cd /var/www/
151
$ mv html /var/tmp/html.v8
152
153
# Unpack page instance for prod and preview. Rename them to original name and check the right permissions:
154
155
# Prod
156
$ cd /var/www/
157
$ tar -xzf /var/tmp/dev/hms_dev_v11.tgz
158
$ mv hms html
159
160
# Preview
161
$ tar -xzf /var/tmp/dev/hms_dev_v11.tgz
162
$ mv mi html/preview
163
164
# Drop old T3 (tables might be changed), create empty one
165
$ mysql
166
% drop database hms_prod_t3;
167
% create database hms_prod_t3;
168
169
# Not necessary if there is a full sync in the next step: Import T3 DBs (Prod & Peview same)
170
$ mysql mi_prod_t3 < /var/tmp/dev/hms_dev_t3_v11.sql
171
172
# FE Users
173
$ mysql mi_prod_t3 < /var/tmp/prod/mi_prod_t3.fe_users.sql
174
175
#
176
# ** Sync QFQ Data **
177
# 
178
[crose@tlX]
179
$ cd /scratch/share/system/sync/hms/
180
$ ./hmsPreviewProdSync.sh -f
181
182
# 
183
# Restore fileadmin
184
# 
185
$ mkdir /var/tmp/fileadmin.dev
186
187
# Keep dev version temporarily on prod for comparison in case 
188
$ mv /var/www/html/fileadmin/protected /var/tmp/prod/dev-protected
189
190
# Restore prod: financialrequests & protected
191
$ mv /var/tmp/html.v8/prod/fileadmin/protected /var/www/html/fileadmin/
192
193
</pre>
194
195
h2. Configuration: qfq.json and LocalConfiguration.php
196
197
* Prepare the final config files in `/var/tmp/dev/prev|prod`
198
199
LocalConfiguration.php:
200
201
* db
202
* user
203
* password
204
* baseUrl
205
* wkhtmltopdf 
206
* redirect E-Mail
207
* sitename
208
* installtoolpw
209
* flagProduction
210
211
Copy config files:
212
213
<pre>
214
$ cp /var/tmp/dev/prod/LocalConfiguration.php /var/www/html/typo3conf/
215
$ cp /var/tmp/dev/prev/LocalConfiguration.php /var/www/html/preview/typo3conf/
216
</pre>
217
218
h2. Finalize
219
220
* Play ansible playbook
221
<pre>
222
[user@tlX] 
223
$ cd git/it/ansible/playbooks
224
$ ansible-playbook -i ../hosts qfq.yml --limit hms-tool
225
226
[root@hms-tool]
227
$ a2enmod php8.1 
228
$ service apache2 restart
229
230
</pre>
231
232
* Misc
233
<pre>
234
# Set Permissions
235
$ chown -R www-data:www-data /var/www/html
236
237
# Alle Cronjobs aktvieren:
238
$ cronjob -e
239
$ cronjob -e -u www-data
240
</pre>
241
242
* Check Backup.
243
* Remove old HMS dev instance (webwork16).
244
245
  * Incl. 'Autocron' Dev
246
247
* Update kpit PWs with webwork16/webwork22 credentials.
248
* Update "Project Wiki":https://project.math.uzh.ch/projects/hms-tool/wiki summary with new dev instance (webwork22).
249
250
h2. Probleme bei der Migration