Skip to content

Commit a204dbe

Browse files
authoredMar 17, 2025··
Merge pull request #3098 from element-hq/valere/playwright_dev_backend_no_ratelimit
Keep rate limits for dev backend, disable only for playwright tests
2 parents af58161 + bd38a56 commit a204dbe

File tree

4 files changed

+158
-18
lines changed

4 files changed

+158
-18
lines changed
 

‎.github/workflows/playwright.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: yarn playwright install --with-deps
2020
- name: Run backend components
2121
run: |
22-
docker compose -f dev-backend-docker-compose.yml up -d
22+
docker compose -f playwright-backend-docker-compose.yml up -d
2323
docker ps
2424
- name: Copy config file
2525
run: cp config/config.devenv.json public/config.json

‎backend/dev_homeserver.yaml

+4-17
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,10 @@ max_event_delay_duration: 24h
4141
# - burst_count: number of requests a client can send before being throttled.
4242

4343
rc_message:
44-
per_second: 10000
45-
burst_count: 10000
46-
47-
rc_login:
48-
address:
49-
per_second: 10000
50-
burst_count: 10000
51-
account:
52-
per_second: 10000
53-
burst_count: 10000
54-
failed_attempts:
55-
per_second: 10000
56-
burst_count: 10000
57-
58-
rc_registration:
59-
per_second: 10000
60-
burst_count: 10000
44+
# This needs to match at least the heart-beat frequency plus a bit of headroom
45+
# Currently the heart-beat is every 5 seconds which translates into a rate of 0.2s
46+
per_second: 0.5
47+
burst_count: 30
6148

6249
# Required for Element Call in Single Page Mode due to on-the-fly user registration
6350
enable_registration: true

‎backend/playwright_homeserver.yaml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
server_name: "synapse.localhost"
2+
public_baseurl: http://synapse.localhost:8008/
3+
4+
pid_file: /data/homeserver.pid
5+
6+
listeners:
7+
- port: 8008
8+
tls: false
9+
type: http
10+
x_forwarded: true
11+
resources:
12+
- names: [client, federation, openid]
13+
compress: false
14+
15+
database:
16+
name: sqlite3
17+
args:
18+
database: /data/homeserver.db
19+
20+
media_store_path: /data/media_store
21+
signing_key_path: "/data/SERVERNAME.signing.key"
22+
trusted_key_servers:
23+
- server_name: "matrix.org"
24+
25+
experimental_features:
26+
# MSC3266: Room summary API. Used for knocking over federation
27+
msc3266_enabled: true
28+
# MSC4222 needed for syncv2 state_after. This allow clients to
29+
# correctly track the state of the room.
30+
msc4222_enabled: true
31+
32+
# The maximum allowed duration by which sent events can be delayed, as
33+
# per MSC4140. Must be a positive value if set. Defaults to no
34+
# duration (null), which disallows sending delayed events.
35+
max_event_delay_duration: 24h
36+
37+
# Ratelimiting settings for client actions (registration, login, messaging).
38+
#
39+
# Each ratelimiting configuration is made of two parameters:
40+
# - per_second: number of requests a client can send per second.
41+
# - burst_count: number of requests a client can send before being throttled.
42+
43+
rc_message:
44+
per_second: 10000
45+
burst_count: 10000
46+
47+
rc_login:
48+
address:
49+
per_second: 10000
50+
burst_count: 10000
51+
account:
52+
per_second: 10000
53+
burst_count: 10000
54+
failed_attempts:
55+
per_second: 10000
56+
burst_count: 10000
57+
58+
rc_registration:
59+
per_second: 10000
60+
burst_count: 10000
61+
62+
# Required for Element Call in Single Page Mode due to on-the-fly user registration
63+
enable_registration: true
64+
enable_registration_without_verification: true
65+
66+
report_stats: false
67+
serve_server_wellknown: true

‎playwright-backend-docker-compose.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
networks:
2+
ecbackend:
3+
4+
services:
5+
auth-service:
6+
image: ghcr.io/element-hq/lk-jwt-service:latest-ci
7+
hostname: auth-server
8+
environment:
9+
- LK_JWT_PORT=8080
10+
- LIVEKIT_URL=ws://localhost:7880
11+
- LIVEKIT_KEY=devkey
12+
- LIVEKIT_SECRET=secret
13+
# If the configured homeserver runs on localhost, it'll probably be using
14+
# a self-signed certificate
15+
- LIVEKIT_INSECURE_SKIP_VERIFY_TLS=YES_I_KNOW_WHAT_I_AM_DOING
16+
deploy:
17+
restart_policy:
18+
condition: on-failure
19+
ports:
20+
# HOST_PORT:CONTAINER_PORT
21+
- 8009:8080
22+
networks:
23+
- ecbackend
24+
25+
livekit:
26+
image: livekit/livekit-server:latest
27+
command: --dev --config /etc/livekit.yaml
28+
restart: unless-stopped
29+
# The SFU seems to work far more reliably when we let it share the host
30+
# network rather than opening specific ports (but why?? we're not missing
31+
# any…)
32+
ports:
33+
# HOST_PORT:CONTAINER_PORT
34+
- 7880:7880/tcp
35+
- 7881:7881/tcp
36+
- 7882:7882/tcp
37+
- 50100-50200:50100-50200/udp
38+
volumes:
39+
- ./backend/dev_livekit.yaml:/etc/livekit.yaml:Z
40+
networks:
41+
- ecbackend
42+
43+
redis:
44+
image: redis:6-alpine
45+
command: redis-server /etc/redis.conf
46+
ports:
47+
# HOST_PORT:CONTAINER_PORT
48+
- 6379:6379
49+
volumes:
50+
- ./backend/redis.conf:/etc/redis.conf:Z
51+
networks:
52+
- ecbackend
53+
54+
synapse:
55+
hostname: homeserver
56+
image: docker.io/matrixdotorg/synapse:latest
57+
environment:
58+
- SYNAPSE_CONFIG_PATH=/data/cfg/homeserver.yaml
59+
# Needed for rootless podman-compose such that the uid/gid mapping does
60+
# fit local user uid. If the container runs as root (uid 0) it is fine as
61+
# it actually maps to your non-root user on the host (e.g. 1000).
62+
# Otherwise uid mapping will not match your non-root user.
63+
- UID=0
64+
- GID=0
65+
volumes:
66+
- ./backend/synapse_tmp:/data:Z
67+
- ./backend/playwright_homeserver.yaml:/data/cfg/homeserver.yaml:Z
68+
networks:
69+
- ecbackend
70+
71+
nginx:
72+
# openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout tls_localhost_key.pem -out tls_localhost_cert.pem -subj "/C=GB/ST=London/L=London/O=Alros/OU=IT Department/CN=localhost"
73+
hostname: synapse.localhost
74+
image: nginx:latest
75+
volumes:
76+
- ./backend/tls_localhost_nginx.conf:/etc/nginx/conf.d/default.conf:Z
77+
- ./backend/tls_localhost_key.pem:/root/ssl/key.pem:Z
78+
- ./backend/tls_localhost_cert.pem:/root/ssl/cert.pem:Z
79+
ports:
80+
# HOST_PORT:CONTAINER_PORT
81+
- "8008:80"
82+
- "4443:443"
83+
depends_on:
84+
- synapse
85+
networks:
86+
- ecbackend

0 commit comments

Comments
 (0)