Project

General

Profile

Docker » History » Version 110

Elias Villiger, 11.01.2024 11:01

1 108 Carsten Rose
h1. Docker
2 15 Benjamin Baer
3 29 Carsten Rose
{{toc}}
4 28 Carsten Rose
5 26 Carsten Rose
Handout
6
7 38 Carsten Rose
| *Topic* | *Description* |
8 97 Carsten Rose
| GIT Repo ssh | @git@git.math.uzh.ch:typo3/typo3-docker.git@ |
9
| GIT Repo http | @https://git.math.uzh.ch/typo3/typo3-docker.git@ |
10 93 Carsten Rose
| Docker Host | @webwork20@ - alle Befehle werden als @root@ ausgefuehrt |
11 51 Carsten Rose
| Docker Verzeichnis | @/var/docker/<username>@ |
12 74 Carsten Rose
| Konfiguration / Ports | @/var/docker/<username>/<username_instancename>/config.json@ |
13 64 Carsten Rose
| Save in kpdev | @Root > webwork20 > webwork20/crose_qfq [docker]@ |
14 51 Carsten Rose
| T3 FE, xdebug, PMA | @https://webwork20.math.uzh.ch:<port>@ |
15 110 Elias Villiger
| PMA Server / Username | Server: @db@, Username: @root@ |
16 51 Carsten Rose
| Start Docker | @docker compose up -d@ |
17
| Stop Docker | @docker compose down@ |
18 26 Carsten Rose
| *Update Docker Image* | @docker compose down; git pull; docker compose build; docker compose up -d@ |
19
20 1 Benjamin Baer
<pre>
21 21 Carsten Rose
[root@webwork20]
22
23
$ cd /var/docker/
24 40 Carsten Rose
$ mkdir <username>
25 1 Benjamin Baer
$ cd /var/docker/<username>
26
27 58 Carsten Rose
# Checkout git repo - decide to if you like to use 'http' or 'ssh'. 
28 1 Benjamin Baer
# You can change later, check: https://wiki.math.uzh.ch/public/Git#Change_Repo:_http_.3E_ssh
29 98 Carsten Rose
$ git clone https://git.math.uzh.ch/typo3/typo3-docker.git
30 58 Carsten Rose
31
# ssh: username/password is given automatically, login  via ssh-agent forward: ssh -A root@webwork20
32 97 Carsten Rose
$ git clone git@git.math.uzh.ch:typo3/typo3-docker.git <username_instancename>
33 58 Carsten Rose
34
# Main Branch ist Typo3 V10
35 37 Carsten Rose
36 39 Carsten Rose
# In case T3 V11 should be used
37 21 Carsten Rose
$ git checkout typo11
38
39 40 Carsten Rose
$ cd /var/docker/<username>/<username_instancename>
40 21 Carsten Rose
41 66 Carsten Rose
# Create docker images and prepare nginx, mariadb, pma
42 21 Carsten Rose
# execute bootstrap.py
43
$ python3 bootstrap.py
44 66 Carsten Rose
....
45
⠿ Network crose1_dev_default      Created                                                                                               0.1s
46
⠿ Container crose1_dev-mariadb-1  Healthy                                                                                              16.5s
47
⠿ Container crose1_dev-pma-1      Started                                                                                              17.0s
48
⠿ Container crose1_dev-nginx-1    Started                                                                                              17.2s
49
First time install: http://webwork20:51515/typo3/install.php
50
web: http://webwork20:51515
51
pma: http://webwork20:52195
52
xdebug: 53859
53
ssh: ssh root@webwork20 -p 58785
54
55
#-------------------------------------------------------
56
# Create a keepass entry in @kpdev@ under webwork20, incl. your instance password, with the above mentioned ports!
57
#-------------------------------------------------------
58
59
#-------------------------------------------------------
60
# Configure ssh passwordless access to the nginx/php docker.
61
# If not already done before, create a personal private/public SSH keys (in thinlinc): ssh-keygen -t ed25519
62
#-------------------------------------------------------
63
64
# Transfer the public SSH key from Thinlinc to the docker on webwork20.
65
[user@tlx] cat ~/.ssh/id_ed25519.pub
66
ssh-ed25519 AAA... 
67
68
# Copy/paste the key on webwork20
69 103 Carsten Rose
[root@webwork20] vim /var/docker/<username>/<username_instancename>/ssh/authorized_keys
70 66 Carsten Rose
71 1 Benjamin Baer
# Test the password less login ... accept the new SSH hostkey.
72 66 Carsten Rose
[user@tlx] ssh root@webwork20 -p 58785
73 64 Carsten Rose
</pre>
74
75 74 Carsten Rose
h1. Typo3
76 22 Carsten Rose
77 81 Carsten Rose
h2. Setup
78
79 67 Carsten Rose
* Open T3/BE: https://webwork20:xxxx/typo3/install.php
80 22 Carsten Rose
81 1 Benjamin Baer
!typo3_1.png!
82 22 Carsten Rose
83 1 Benjamin Baer
!typo3_2.png!
84 22 Carsten Rose
85
* Choose "take me straight to the backend"
86 1 Benjamin Baer
87 84 Carsten Rose
h2. Extensions: Fluid, T3 BE Highlight, QFQ, UZH_CD
88 1 Benjamin Baer
89 81 Carsten Rose
* Login > extension:
90
** *fluid styled content*
91
** *typo3 edit highlighting*
92
** *qfq* -  https://qfq.io/download/?dir=releases  
93
** *uzh_cd* - https://www.math.uzh.ch/repo/?dir=uzhcd/v9  
94
95 63 Carsten Rose
!clipboard-202303281403-ewftg.png!
96
97 1 Benjamin Baer
!t3editor.png!
98
99 82 Carsten Rose
h2. QFQ Extension Config
100
101
* Set baseUrl
102
103
!clipboard-202304211259-9zi62.png!
104
105 81 Carsten Rose
h2. Test Page 
106
107 15 Benjamin Baer
* Create first page:
108 24 Carsten Rose
109 1 Benjamin Baer
!typo3_4.png!
110 15 Benjamin Baer
!typo3_5.png!
111
!typo3_6.png!
112 24 Carsten Rose
113 15 Benjamin Baer
* Under access, set page visible to true
114 1 Benjamin Baer
* Add template to home (via plus):
115 15 Benjamin Baer
!typo3_7_t1.png!
116 1 Benjamin Baer
!typo3_7_t2.png!
117
!typo3_7_t3.png!
118
119 81 Carsten Rose
h2. Test Content
120
121 16 Benjamin Baer
* Add page content > QFQ to home
122
123 74 Carsten Rose
!https://project.math.uzh.ch/projects/qfq/wiki/Docker/qfq_1.png!
124 16 Benjamin Baer
125 1 Benjamin Baer
<pre>
126 16 Benjamin Baer
10.sql = SELECT "Hello world from QFQ, ", NOW()
127
</pre>
128
129
* Try view page on home for a first test:
130
!qfq2.png!
131
132
* As instructed, create a new page "Form" with pagecontent [QFQ] Form under Home and load the formEditor:
133 74 Carsten Rose
134 16 Benjamin Baer
<pre>
135
file=_formEditor
136 18 Enis Nuredini
</pre>
137
138
* Reload the page
139 1 Benjamin Baer
!qfq3.png!
140
141 81 Carsten Rose
h2. T3 Version
142
143 71 Carsten Rose
* Get and remember the T3 version (for source directory in PhpStorm)
144
145
!clipboard-202304181445-ecvvz.png!
146 1 Benjamin Baer
147 17 Benjamin Baer
* Done with typo3!
148
149 1 Benjamin Baer
h1. PhpStorm
150
151 81 Carsten Rose
h2. TCP Ports
152
153 65 Carsten Rose
* *Replace* the following ports with yours!
154 69 Carsten Rose
155 65 Carsten Rose
| Config File | @/var/docker/<username>/<username_instancename>/config.json@ |
156
| First time install | http://webwork20:51515/typo3/install.php |
157
| web | http://webwork20:51515 |
158 72 Carsten Rose
| pma | http://webwork20:52195 |
159 1 Benjamin Baer
| xdebug | 53859 |
160
| ssh | ssh root@webwork20 -p 58785 |
161
162 104 Elias Villiger
h2. Clone local qfq directory
163
164
* If you have not done so already, clone the qfq directory on your local environment for development in PhpStorm
165
<pre>
166
cd  ~/PhpstormProjects
167
git clone git@git.math.uzh.ch:typo3/qfq.git
168
169
# run makefile
170
cd qfq
171
make
172 107 Elias Villiger
npm run build
173 104 Elias Villiger
</pre>
174
* Open the project in PhpStorm
175
176 81 Carsten Rose
h2. Check Update T3 Sources in /scratch/software/typo3
177
178 1 Benjamin Baer
* Typo3: during docker bootstrap, the latest Typo3 V10 version will be downloaded - if that one is not already uploaded to @/scratch/software/typo3@, do this first.
179 81 Carsten Rose
180
h2. Content Root
181
182 75 Carsten Rose
* Add Content Root: @File > Settings > Directories > Add Content Root: /scratch/software/typo3/typo3_src-...@
183 1 Benjamin Baer
184
!clipboard-202304181453-83ajj.png!
185 81 Carsten Rose
186
h2. Default PHP Version / Remote PHP
187
188 75 Carsten Rose
* Set a) PHP Version and b) CLI Interpreter (used as default)
189
190
!clipboard-202304191618-zomdu.png!
191
192
!clipboard-202304191619-fafjc.png!
193 1 Benjamin Baer
194 75 Carsten Rose
!clipboard-202304191620-vbtni.png!
195 72 Carsten Rose
196 81 Carsten Rose
h2. Debug
197 1 Benjamin Baer
198
* PhpStorm: @File > Settings > PHP > Debug@
199
200
!clipboard-202304181438-qmb9t.png!
201
202
* List all of the xdebug ports of your docker containers, comma separated.
203 31 Carsten Rose
* REMOVE 9000, else phpstorm will still stop webwork16.
204 1 Benjamin Baer
205 81 Carsten Rose
h2. HTTP Server
206
207
* Add Server: @File > Settings > PHP > Server > [+] @
208
209 1 Benjamin Baer
!clipboard-202304181500-ozxt9.png!
210
211 76 Carsten Rose
* Please give a detailed name, eg. webwork20 dev, there will be multiple deployments on the same server!
212 1 Benjamin Baer
* Use the *http* port for the website, not the xdebug port!
213
214 74 Carsten Rose
* Map a) the path of extension > /var/www/html/typo3conf/ext/qfq/ and b) the Typo3 Sources
215 76 Carsten Rose
216 74 Carsten Rose
!clipboard-202304191625-sbryd.png!
217 76 Carsten Rose
218 74 Carsten Rose
!clipboard-202304191629-4csfm.png!
219 78 Carsten Rose
220 81 Carsten Rose
h2. Run / Debug Configuration
221
222 106 Elias Villiger
* Add a new @Run/Debug Configuration@ (upper right corner or @Run > Edit Configurations ...@):
223 1 Benjamin Baer
224
!clipboard-202304191632-rhyoj.png!
225 78 Carsten Rose
226 1 Benjamin Baer
!clipboard-202304191636-sv3pw.png!
227 79 Carsten Rose
228
* Remove webwork16 if you didn't remove port 9000, to not stop webwork16 by accident.
229 74 Carsten Rose
230 81 Carsten Rose
h2. Deployment
231 17 Benjamin Baer
232 81 Carsten Rose
* Deployment path: @Tools > Deployment > Configuration > [+] > Sftp > New Servername: ...@
233
234
!20230421-102743-842.png!
235 33 Carsten Rose
236 89 Carsten Rose
!clipboard-202304211320-eis7t.png!
237 30 Carsten Rose
238 34 Carsten Rose
* Wenn gewuenscht kann der automatische Upload aktiviert werden:
239
240
!clipboard-202303281501-vsrv2.png!
241
242 94 Carsten Rose
h1. PHPUnit Tests
243
244
* Aktuell ist noch ein Workaround noetig (Ruecksprache mit Benj) - nur damit phpunit lokal im Docker installiert ist. 
245
* Im Docker als @root@:
246
<pre>
247
$ apt install composer
248 99 Krzysztof Putyra
$ cd /var/www/html/typo3conf/ext/qfq
249 94 Carsten Rose
$ composer update
250 100 Krzysztof Putyra
$ composer dump-autoload
251 94 Carsten Rose
</pre>
252 101 Krzysztof Putyra
  The last command is required by PHPUnit to be loaded properly in the next step.
253 94 Carsten Rose
254
* PHPUnit by Remote Interpreter
255
256
!clipboard-202304211328-e4st5.png!
257
258 95 Carsten Rose
!clipboard-202304211339-hsuwe.png!
259
260 96 Zhoujie Li
!manual_nr7_phpunit.png!
261 94 Carsten Rose
262 90 Carsten Rose
h1. Issues / Probleme
263 1 Benjamin Baer
264 90 Carsten Rose
h2. Problems showing icons
265
266 50 Carsten Rose
* If the FormEditor is broken and has problems to show note.gif, the baseUrl is probably not configure in QFQ setup.
267 49 Carsten Rose
* Configure correct Site entry point
268
269
!clipboard-202304081911-mfwna.png!
270 85 Carsten Rose
271 1 Benjamin Baer
272 87 Carsten Rose
h2. Docker funktionierte nicht mehr auf webwork20
273
274
* #15745 / Docker
275 1 Benjamin Baer
276 91 Carsten Rose
h2. Class 'ComposerAutoloaderInit40...' not found
277 93 Carsten Rose
278 86 Carsten Rose
* Testweise QFQ tt-content records deaktivieren > Danach funktioniert die Seite wieder.
279
* Ursache: das @extension/composer.json@ wurde beim Deployment von Thinlinc in den Container kopiert ... das funktioniert aktuell nicht. @composer.json@  im Docker loeschen.
280 88 Carsten Rose
  !clipboard-202304211305-ig94v.png!
281
282 93 Carsten Rose
h2. Install QFQ Extension: Could not remove extension directory
283 86 Carsten Rose
284 93 Carsten Rose
* @ERROR: Could not remove extension directory "typo3conf/ext/qfq/". Reasons@
285 86 Carsten Rose
286 85 Carsten Rose
  * Fix: in docker container @chown -R www-data:www-data /var/www/html/typo3conf/ext/qfq@
287 62 Carsten Rose
288
!clipboard-202304211307-p22de.png!