3.9 KiB
3.9 KiB
Adding New Bridges Guide
This guide explains how to integrate additional Matrix bridges into your Synapse setup. It covers the general process and provides a template for maintaining consistency with the existing bridge configurations.
Prerequisites
Before adding a new bridge, ensure you have:
- A working Synapse setup using this repository's structure.
- Basic understanding of Docker and Docker Compose.
- Familiarity with Matrix bridges and their configuration.
General Steps
-
Choose a Bridge
- Verify the bridge is compatible with Synapse.
- Check if it has a Docker image available.
- Review its documentation for specific requirements.
-
Add Database Support
- Access the PostgreSQL container:
docker compose exec postgres psql -U synapse
- Create a new database and grant permissions:
CREATE DATABASE your_bridge_name; GRANT ALL PRIVILEGES ON DATABASE your_bridge_name TO synapse;
- Verify the database was created:
\l
- Exit the PostgreSQL prompt:
\q
-
Update Docker Compose
- Add a new service in
docker-compose.yml
:
your-bridge-name: hostname: your-bridge-name image: repository/bridge-image:tag restart: no volumes: - ./config/mautrix-your-bridge:/data - /etc/localtime:/etc/localtime:ro depends_on: postgres: condition: service_healthy healthcheck: test: ["CMD-SHELL", "test -f /data/config.yaml -a -f /data/registration.yaml"] interval: 30s timeout: 10s retries: 1 start_period: 5s
- Add a new service in
-
Create Bridge Configuration Directory
mkdir -p config/mautrix-your-bridge
-
Configure the Bridge
- Follow the bridge's official documentation for setup and configuration.
- Common configuration points:
- Database connection string.
- Homeserver settings (using internal Docker network).
- Bridge-specific authentication or API settings.
- Permissions and access controls.
- Make sure to generate any required registration files.
- Update Synapse configuration to include the new bridge's registration file.
Integration Checklist
Use this checklist to ensure proper integration:
- Database created manually in PostgreSQL.
- Service added to
docker-compose.yml
. - Configuration directory created.
- Tested with existing setup.
- Verified all dependencies.
Best Practices
-
Configuration Consistency
- Follow the existing pattern for database names.
- Use similar Docker Compose service definitions.
- Maintain consistent volume mount paths.
-
Testing
- Test the bridge in isolation first.
- Verify interaction with existing bridges.
- Check for potential port conflicts.
- Validate database connectivity.
-
Security Considerations
- Review bridge-specific security requirements.
- Follow least-privilege principle for configurations.
- Document any security-related settings.
Common Issues
-
Database Connection
- Verify database name matches in all configurations.
- Check database user permissions.
- Ensure proper connection string format.
-
Docker Networking
- Confirm service name resolution works.
- Check for port conflicts.
- Verify network dependencies.
-
Configuration Files
- Ensure proper file permissions.
- Validate YAML syntax.
- Check for required configuration options.
Contributing
If you successfully integrate a new bridge, consider:
- Documenting any special considerations.
- Sharing your configuration templates.
- Updating this guide with new insights.
- Creating a pull request with your additions.
Next Steps
After adding a new bridge:
- Test thoroughly with existing bridges.
- Update your backup procedures.
- Document any maintenance requirements.
- Share your experience with the community.