Add example docker compose; fix dynamic reg

This commit is contained in:
Andrew Ferrazzutti
2025-09-03 15:36:42 -04:00
parent e52083e29a
commit 9e89c4ced3
10 changed files with 153 additions and 8 deletions

View File

@@ -209,6 +209,7 @@ A docker compose file `dev-backend-docker-compose.yml` is provided to start the
whole stack of components which is required for a local development environment:
- Minimum Synapse Setup (servername: `synapse.m.localhost`)
- Matrix Authentication Service Setup (issuer: `mas.m.localhost`)
- MatrixRTC Authorization Service (Note requires Federation API and hence a TLS reverse proxy)
- Minimum LiveKit SFU Setup using dev defaults for config
- Redis db for completeness
@@ -218,6 +219,7 @@ whole stack of components which is required for a local development environment:
certificates
- Minimum TLS reverse proxy for
- Synapse homeserver: `synapse.m.localhost`
- Matrix Authentication Service: `mas.m.localhost`
- MatrixRTC backend: `matrix-rtc.m.localhost`
- Local Element Call development `call.m.localhost` via `yarn dev --host `
- Element Web `app.m.localhost`

View File

@@ -12,6 +12,11 @@ listeners:
- names: [client, federation, openid]
compress: false
matrix_authentication_service:
enabled: true
secret: "mas-matrix-secret"
endpoint: http://mas:8080
database:
name: sqlite3
args:
@@ -46,9 +51,5 @@ rc_message:
per_second: 0.5
burst_count: 30
# Required for Element Call in Single Page Mode due to on-the-fly user registration
enable_registration: true
enable_registration_without_verification: true
report_stats: false
serve_server_wellknown: true

96
backend/dev_mas.yaml Normal file
View File

@@ -0,0 +1,96 @@
http:
listeners:
- name: web
resources:
- name: discovery
- name: human
- name: oauth
- name: assets
- name: adminapi
binds:
- address: '[::]:8080'
proxy_protocol: false
trusted_proxies:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/10
- 127.0.0.1/8
- fd00::/8
- ::1/128
public_base: https://mas.m.localhost/
database:
uri: postgres://postgres@mas-db/mas
max_connections: 10
min_connections: 0
connect_timeout: 30
idle_timeout: 600
max_lifetime: 1800
email:
from: '"Authentication Service" <root@localhost>'
reply_to: '"Authentication Service" <root@localhost>'
transport: blackhole
secrets:
encryption: 91c9eda308d874d1b8ba51c0f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s+dWYjfrscFJUEx8CZh0GeoLE4H3uru
GlwqPnc9sMPee98mj4yDMyrNqLx/VaXV+wnpbGECgYAh4JoKSa9+SLCdYVxBT2/v
OHN43LmcOto8NLlRRl0EfUCn9xUdJ4Za8YH6v6e/DZYA2dzMfv63xn2+tXRpPbU1
9TZHekvVEPUp1XHtKTqaF87V+/LdyVJ3NH+whxTR7zyXuMkyFchkS3Lcb8nV9URB
7vfP3zPCHWRkTYOkTuJ+UQKBgFCrj8ZgMOSoPJMlppvayTtFLypTFjJ7rIT6cwnH
bnkduIrfD5fu5MSV2nyauT+DXbYiKo8GsBhFm849f41oMnKs0ks2Zi++9UiLkGlX
XUs6phc0KUrP7AOSejkBmxgrzk2KZ/DPS8w0U8vR6reNcBPedwb2Tvl6jkDj9QjJ
9VohAoGAISjlufqw3y8F/0on1AhqyROlJghTBsQ+xDEBZ9txx/HcKVghqMhBCbFj
LRf8B4vH9QXtlZVtPFj0wE3INxsYtilsbD8wbwkxsLeGUFdPDucPacfBSyX+wLRh
S1/twrPS9KVhkU5d0TbyfOlEB1OSXZTWZ1n9NaqOZUPf6FAwm78=
-----END RSA PRIVATE KEY-----
- kid: VrRd3Y2OeF
key: |
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIB3zBxhuh275A3piMMDZ2BEM6vsoxswNLrTJRiaY+m80oAoGCCqGSM49
AwEHoUQDQgAECqFotDpyEYNrWf2UZaUB0CZz6KiptQL2wi8oRNkKlarjgDDNCBzR
dgCokx9C8bLpfqhTJE/6aSe6T19qkaPHIg==
-----END EC PRIVATE KEY-----
- kid: SHaCwxflXU
key: |
-----BEGIN EC PRIVATE KEY-----
MIGkAgEBBDCdchyP7aFxQce7vA+QMPkMkOaYKbmNoN1fnlKviKsJK1riq+1eKSEe
UeUF5BOczfugBwYFK4EEACKhZANiAAR1pIE4xN9xkULiCgMd/uztt4Lnu8FhvEZD
3BhUfy5kdBVbYyk1khgKy3k+dQvXaTVkzsHkQN8K78WxlUDlF5zKXLjgkeEiqgz7
HU0rr2e8geUiaEE2AkzWhvmIikvhuMo=
-----END EC PRIVATE KEY-----
- kid: ngjUaMfCuT
key: |
-----BEGIN EC PRIVATE KEY-----
MHQCAQEEIE11jnxjUvPk93ylMuIcwcayJsFUhsSH2EqAn97CiHf8oAcGBSuBBAAK
oUQDQgAE1XySwFNBUkzZ946MBf2/3ecXVptrauZEQ8d8zqUdBS7wOe5pZwZ15Jx4
aZhlusZ3BPl0KiTlWwOlaRDMrw9EGA==
-----END EC PRIVATE KEY-----
passwords:
enabled: true
schemes:
- version: 1
algorithm: argon2id
minimum_complexity: 0
matrix:
kind: synapse
homeserver: synapse.m.localhost
secret: "mas-matrix-secret"
endpoint: http://homeserver:8008/

View File

@@ -40,6 +40,23 @@ server {
}
# Matrix Authentication Server reverse proxy
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name mas.m.localhost;
ssl_certificate /root/ssl/cert.pem;
ssl_certificate_key /root/ssl/key.pem;
location / {
proxy_pass "http://mas:8080";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page 500 502 503 504 /50x.html;
}
# MatrixRTC reverse proxy
# - MatrixRTC Authorization Service
# - LiveKit SFU websocket signaling connection

View File

@@ -15,5 +15,8 @@
"delayed_leave_event_delay_ms": 18000,
"delayed_leave_event_restart_ms": 4000,
"network_error_retry_ms": 100
},
"oidc_metadata": {
"client_name": "Element Call (dev)"
}
}

View File

@@ -68,6 +68,31 @@ services:
volumes:
- ./backend/synapse_tmp:/data:Z
- ./backend/dev_homeserver.yaml:/data/cfg/homeserver.yaml:Z
depends_on:
- mas
networks:
- ecbackend
mas:
# To add users, see `docker exec element-call-mas-1 mas-cli manage register-user -h`
image: ghcr.io/element-hq/matrix-authentication-service:latest
pull_policy: always
hostname: mas
volumes:
- ./backend/dev_mas.yaml:/config.yaml:ro,Z
depends_on:
- mas-db
networks:
- ecbackend
mas-db:
image: docker.io/postgres:16-alpine
hostname: mas-db
restart: always
shm_size: 128mb
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
- POSTGRES_DB=mas
networks:
- ecbackend
@@ -101,7 +126,9 @@ services:
- "host.docker.internal:host-gateway"
depends_on:
- synapse
- mas
networks:
ecbackend:
aliases:
- mas.m.localhost
- matrix-rtc.m.localhost

View File

@@ -89,7 +89,7 @@ export const App: FC<Props> = ({ vm }) => {
<Routes>
<SentryRoute path="/" element={<HomePage />} />
<SentryRoute path="/login" element={<LoginPage />} />
<SentryRoute path="/after_login" element={<OidcRedirectPage />} />
<SentryRoute path="/after-login" element={<OidcRedirectPage />} />
<SentryRoute path="/register" element={<RegisterPage />} />
<SentryRoute path="*" element={<RoomPage />} />
</Routes>

View File

@@ -163,9 +163,7 @@ export interface ConfigOptions {
oidc_metadata?: {
client_name?: string;
client_uri?: string;
redirect_uris?: string[];
logo_uri?: string;
application_type?: string;
tos_uri?: string;
policy_uri?: string;
contacts?: string[];

View File

@@ -10,5 +10,5 @@ Please see LICENSE in the repository root for full details.
*/
export function getOidcCallbackUrl(): URL {
// TODO: save the path somewhere
return new URL("after_login", window.location.origin);
return new URL("after-login", window.location.origin);
}

View File

@@ -51,6 +51,7 @@ export async function getOidcClientId(
{
clientName: config.oidc_metadata?.client_name ?? "Element Call",
clientUri: config.oidc_metadata?.client_uri ?? window.location.origin,
logoUri: config.oidc_metadata?.logo_uri,
redirectUris: [getOidcCallbackUrl().href],
applicationType: "web",
contacts: config.oidc_metadata?.contacts,