You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/services/etherpad/How it works.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
- ETHERPAD__URI - Uri of etherpad api for all calls like create, delete etc. Used as base path for api client in nest and feathers backend.
13
13
14
14
- ETHERPAD__PAD_URI - URI to etherpad client api. Used in backend in collaborative text editor and lesson to build return url. Used in legacy client to build url.
15
-
-ETHERPAD_OLD_PAD_URI - Used in feathers backend to restrict access to old etherpad urls to lesson context. Only defined in default.schema.json and not in dof-app-deploy
15
+
-ETHERPAD__OLD_PAD_URI - Used in feathers backend to restrict access to old etherpad urls to lesson context. Only defined in default.schema.json and not in dof-app-deploy
16
16
- ETHERPAD__PAD_PATH - Path to etherpad client api. Used in legacy client to set path on cookie.
17
17
18
18
- ETHERPAD__NEW_DOMAIN - Etherpad Domain. Used in legacy client to validate url
We'll use this file to set a fixed Etherpad's API key on the Etherpad server's start.
17
17
18
-
3. Create also a file called settings.env with the following content:
18
+
3. Create also a file called `settings.env` with the following content:
19
19
20
20
```
21
21
REQUIRE_SESSION="true"
@@ -24,99 +24,122 @@ Create a directory called sc-etherpad and then enter it, in Unix-like systems y
24
24
DEFAULT_PAD_TEXT="Schreib etwas!\n\nDieses Etherpad wird synchronisiert, während du tippst, so dass alle Betrachter jederzeit den selben Text sehen. So könnt ihr auf einfache Weise gemeinsam an Dokumenten arbeiten."
Here we're using the host.docker.internal hostname which should make it possible for the Etherpad's container to connect to the host's local network and should work out of the box e.g. on macOS. But please modify it accordingly to your needs and your Docker's network configuration. An alternative configuaration would be to use `DB_URL=mongodb://localhost:27017/etherpad` and than add `--network="host"` to the following docker run command.
35
+
Here we're using the `host.docker.internal` hostname which should make it possible for the Etherpad's container to connect to the host's local network and should work out of the box e.g. on macOS. On WSL2 it might not work out of the box and need some extra work, see e.g. this [stackoverflow thread](https://stackoverflow.com/questions/63898430/how-can-i-access-a-service-running-on-wsl2-from-inside-a-docker-container).
36
+
37
+
An alternative configuaration would be to use `DB_URL=mongodb://localhost:27017/etherpad` and then add `--network="host"` to the following docker run command. `--network="host"` removes the port mapping though. You can change the port Etherpad is listening on by adding `PORT=9002` (or the port number you need) to settings.env.
35
38
36
39
4. Next, start the Etherpad's container:
37
40
```
38
41
docker run -d \
39
-
-p 9001:9001 \
42
+
-p 9002:9001 \
40
43
--env-file ./settings.env \
41
44
-v ./APIKEY.txt:/opt/etherpad-lite/APIKEY.txt \
42
45
--name sc-etherpad \
43
-
docker.io/etherpad/etherpad:2.0.0
46
+
docker.io/etherpad/etherpad:2.2.7
44
47
```
45
-
Please note we're using the docker.io/etherpad/etherpad:2.0.0 image in the command above which might be not the one that is being used anytime in the future when you read this article. To make sure you're using the current version (the one that is currently being used in the SchulCloud platform), please refer to the https://github.com/hpi-schul-cloud/dof_app_deploy/blob/main/ansible/group_vars/infra/dof_etherpad.yml file.
46
-
47
-
Now we should have the Etherpad service running locally on port 9001, we can verify it's working properly e.g. by fetching the current Etherpad's API version:
48
-
49
-
```
50
-
~ curl -v http://127.0.0.1:9001/api
51
-
* Trying 127.0.0.1:9001...
52
-
* Connected to 127.0.0.1 (127.0.0.1) port 9001
53
-
> GET /api HTTP/1.1
54
-
> Host: 127.0.0.1:9001
55
-
> User-Agent: curl/8.4.0
56
-
> Accept: */*
57
-
>
58
-
< HTTP/1.1 200 OK
59
-
< X-Powered-By: Express
60
-
< X-UA-Compatible: IE=Edge,chrome=1
61
-
< Referrer-Policy: same-origin
62
-
< Content-Type: application/json; charset=utf-8
63
-
< Content-Length: 26
64
-
< ETag: W/"1a-2HmNLqF3wPt+KQRlEmGwH4O+xu4"
65
-
< Date: Fri, 29 Mar 2024 13:27:00 GMT
66
-
< Connection: keep-alive
67
-
< Keep-Alive: timeout=5
68
-
<
69
-
* Connection #0 to host 127.0.0.1 left intact
70
-
{"currentVersion":"1.3.0"}
71
-
```
72
-
73
-
We can also verify that the API key has been set successfully, let's use the example API call from the Etherpad's documentation ( https://etherpad.org/doc/v2.0.0/#_example_1 ):
> GET /api/1/createAuthorIfNotExistsFor?apikey=secret&name=Michael&authorMapper=7 HTTP/1.1
105
-
> Host: 127.0.0.1:9001
106
-
> User-Agent: curl/8.4.0
107
-
> Accept: */*
108
-
>
109
-
< HTTP/1.1 401 Unauthorized
110
-
< X-Powered-By: Express
111
-
< X-UA-Compatible: IE=Edge,chrome=1
112
-
< Referrer-Policy: same-origin
113
-
< Content-Type: application/json; charset=utf-8
114
-
< Content-Length: 54
115
-
< ETag: W/"36-dbJd0O+vdNi3zPpwRXE+1EGLTho"
116
-
< Date: Fri, 29 Mar 2024 13:39:44 GMT
117
-
< Connection: keep-alive
118
-
< Keep-Alive: timeout=5
119
-
<
120
-
* Connection #0 to host 127.0.0.1 left intact
121
-
{"code":4,"message":"no or wrong API Key","data":null}
122
-
```
48
+
We're using the docker.io/etherpad/etherpad:2.2.7 image in the command above. To make sure you're using the version that is currently used in the SchulCloud platform, please refer to https://github.com/hpi-schul-cloud/dof_app_deploy/blob/main/ansible/roles/dof_etherpad/defaults/main.yml.
49
+
50
+
The bound port on the host (here 9002) is arbitrary, though port 9001 is used by MinIO in our default project setup and thus we use a different one here.
51
+
52
+
5. Now we should have the Etherpad service running locally on port 9002, we can verify it's working properly e.g. by fetching the current Etherpad's API version:
53
+
54
+
```
55
+
~ curl -v http://127.0.0.1:9002/api
56
+
* Trying 127.0.0.1:9002...
57
+
* Connected to 127.0.0.1 (127.0.0.1) port 9002
58
+
> GET /api HTTP/1.1
59
+
> Host: 127.0.0.1:9002
60
+
> User-Agent: curl/8.4.0
61
+
> Accept: */*
62
+
>
63
+
< HTTP/1.1 200 OK
64
+
< X-Powered-By: Express
65
+
< X-UA-Compatible: IE=Edge,chrome=1
66
+
< Referrer-Policy: same-origin
67
+
< Content-Type: application/json; charset=utf-8
68
+
< Content-Length: 26
69
+
< ETag: W/"1a-2HmNLqF3wPt+KQRlEmGwH4O+xu4"
70
+
< Date: Fri, 29 Mar 2024 13:27:00 GMT
71
+
< Connection: keep-alive
72
+
< Keep-Alive: timeout=5
73
+
<
74
+
* Connection #0 to host 127.0.0.1 left intact
75
+
{"currentVersion":"1.3.0"}
76
+
```
77
+
78
+
We can also verify that the API key has been set successfully, let's use the example API call from the Etherpad's documentation ( https://etherpad.org/doc/v2.2.7/#_example_1 ):
0 commit comments