Add federation and database pool configuration support#2
Merged
jevonearth merged 1 commit intomainfrom Feb 25, 2026
Merged
Conversation
Enables Matrix federation for servers behind Cloudflare and adds configurable database connection pool sizes. Changes: 1. Federation for Cloudflare-proxied servers - New env var: PUBLIC_BASEURL (defaults to https://SERVER_NAME) - New env var: SERVE_WELLKNOWN (set to "true" to enable) - When enabled, Synapse serves /.well-known/matrix/server - Tells other Matrix servers to connect on port 443 instead of 8448 - Required for federation when behind Cloudflare (doesn't proxy 8448) 2. Configurable database connection pools - New env var: DB_CP_MIN (minimum connections, default: 20) - New env var: DB_CP_MAX (maximum connections, default: 80) - Previously hardcoded, now tunable per deployment 3. Documentation - Added environment variable reference - Added Cloudflare federation setup guide - Explained reverse proxy requirements These changes maintain backward compatibility - all new variables have sensible defaults. Existing deployments work unchanged. Use case: ECAD's beacon servers are behind Cloudflare and need to federate with Papers' servers. This enables cross-operator relay infrastructure as intended by the Beacon/Matrix architecture.
jevonearth
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for Matrix federation behind Cloudflare and configurable database connection pools.
Problem
Solution
1. Cloudflare Federation Support
New environment variables:
PUBLIC_BASEURL: Public URL for federation (defaults tohttps://SERVER_NAME)SERVE_WELLKNOWN: Set to"true"to enable.well-known/matrix/serverdelegationWhen
SERVE_WELLKNOWN=true:/.well-known/matrix/serverwith delegation to port 443Implementation uses Synapse's built-in
serve_server_wellknownsetting, automatically added by the entrypoint script.2. Configurable Database Connection Pools
New environment variables:
DB_CP_MIN: Minimum connections (default:20)DB_CP_MAX: Maximum connections (default:80)Previously hardcoded values are now configurable per deployment.
Changes
Files Modified
homeserver.yaml: Addedpublic_baseurl, changedcp_min/cp_maxto use template variablessynctl_entrypoint.sh: Added defaults and variable substitution for new env vars, implemented SERVE_WELLKNOWN logicREADME.md: Documented new variables and added Cloudflare federation setup guideBackward Compatibility
✅ Fully backward compatible
Testing
docker-compose.example.ymlUse Case
ECAD operates beacon relay servers behind Cloudflare that need to federate with Papers' servers and other operators. This enables the multi-operator relay infrastructure that Beacon/Matrix is designed for.
References