Skip to content

Amm1rr/Synapse-Installer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Synapse Installer

Native package-based Matrix Synapse installer for Ubuntu and Debian systems.

What is Synapse Installer?

Synapse Installer is a standalone installer that sets up Matrix Synapse homeserver using official system packages. It provides a complete, production-ready Matrix setup with PostgreSQL, Element Web, and Synapse Admin.

Why Use It?

  • Native Packages β€” Uses official system packages (apt) for better integration
  • Multi-OS Support β€” Works on Ubuntu and Debian
  • Standalone Capable β€” Can run independently or as part of the broader Matrix ecosystem
  • SSL Integration β€” Seamless Root Key certificate management for federation
  • Modular Design β€” Each component (manage, ssl, diagnostics) can run standalone
  • Element Web Included β€” Optional Element Web and Synapse Admin installation
  • Comprehensive Management β€” Full configuration management via YAML editing interface

Quick Start

git clone https://github.com/amm1rr/synapse-installer
cd synapse-installer/
./install.sh

What It Does

  • Synapse Installation β€” Installs Matrix Synapse from official sources
  • PostgreSQL Setup β€” Configures PostgreSQL database with optimized settings
  • SSL Certificates β€” Integrates with Matrix Installer Root Key or custom certificates
  • Element Web β€” Optional web client installation
  • Synapse Admin β€” Optional admin panel installation
  • Configuration Management β€” Interactive YAML-based configuration editor
  • Service Management β€” Complete service lifecycle control

Project Structure

synapse-installer/
β”œβ”€β”€ install.sh              # Main installer
β”œβ”€β”€ manage.sh               # Configuration management library
β”œβ”€β”€ ssl.sh                  # SSL certificate management
β”œβ”€β”€ diagnostics.sh          # Diagnostic tools (WIP)
β”œβ”€β”€ cache/                  # Downloaded packages (gitignored)
β”œβ”€β”€ .gitignore
β”œβ”€β”€ CLAUDE.md               # AI assistant guide
└── README.md               # This file

Script Overview

Script Purpose
install.sh Main Synapse installer
manage.sh Configuration management & YAML editor
ssl.sh SSL certificate management
diagnostics.sh Diagnostic tools (in development)

Component Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           install.sh                                    β”‚
β”‚                            (Orchestrator)                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚ sources
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                β–Ό                    β–Ό                    β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚     manage.sh     β”‚  β”‚      ssl.sh       β”‚  β”‚  diagnostics.sh   β”‚
    β”‚                   β”‚  β”‚                   β”‚  β”‚                   β”‚
    β”‚ β€’ YAML utilities  β”‚  β”‚ β€’ Certificate     β”‚  β”‚ β€’ Service status  β”‚
    β”‚ β€’ IP whitelist    β”‚  β”‚   management      β”‚  β”‚ β€’ Health checks   β”‚
    β”‚ β€’ Management menu β”‚  β”‚ β€’ Root CA install β”‚  β”‚ β€’ Logs viewer     β”‚
    β”‚ β€’ Shared helpers  β”‚  β”‚ β€’ Auto-detection  β”‚  β”‚                   β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

OS Specifications (Ubuntu/Debian)

  • Package Manager: apt-get
  • Synapse Package: matrix-synapse (from packages.matrix.org)
  • PostgreSQL: postgresql
  • Service Name: matrix-synapse
  • Config Directory: /etc/synapse
  • Data Directory: /var/lib/synapse
  • Service User: matrix-synapse
  • Web Server User: www-data
  • System CA Path: /usr/local/share/ca-certificates/

Running Scripts

Main Installer

./install.sh

Configuration Management

# Standalone
./manage.sh

SSL Certificate Management

# Standalone
./ssl.sh

Diagnostic Tools

# Standalone (when complete)
./diagnostics.sh

Features

Configuration Management

The manage.sh script provides comprehensive YAML-based configuration editing:

  • General Settings β€” Server name, listeners, logging
  • TLS & Certificates β€” Certificate management and Root CA installation
  • Database Settings β€” PostgreSQL connection configuration
  • Registrations β€” User registration control and shared secrets
  • Federation β€” Federation rules and certificate verification
  • Rooms β€” Room creation, retention, and moderation
  • Media β€” Media storage, URL preview, and quotas
  • Rate Limiting β€” Rate limiting per-user and per-host
  • Statistics β€” Usage reporting and analytics

SSL Certificate Management

The ssl.sh script provides intelligent certificate handling:

  • Auto-Detection β€” Automatically detects certificate files from directory or individual paths
  • Multiple Formats β€” Supports full-chain and separate file formats
  • Root CA Integration β€” Installs Root CA to system trust store for federation
  • Certificate Summary β€” Shows expiry, SANs, issuer, and installation status
  • Color-Coded Status β€” Visual indicators for certificate validity

Screenshots

Main Configuration Menu

Configuration Menu

SSL Certificate Status

SSL Certificate Status

Installation Flow

1. OS Detection
   └── Ubuntu/Debian check

2. Prerequisites Check
   β”œβ”€β”€ System requirements
   └── Required packages (systemd, curl, openssl, yq)

3. PostgreSQL Setup
   β”œβ”€β”€ Install PostgreSQL
   β”œβ”€β”€ Create database and user
   └── Configure connection

4. Synapse Installation
   β”œβ”€β”€ Add official Matrix repository
   β”œβ”€β”€ Install Synapse package
   └── Generate configuration

5. SSL Configuration
   β”œβ”€β”€ Install Root CA (if available)
   β”œβ”€β”€ Configure certificates
   └── Set permissions

6. Optional Components
   β”œβ”€β”€ Element Web (optional)
   └── Synapse Admin (optional)

7. Service Enablement
   β”œβ”€β”€ Enable PostgreSQL
   β”œβ”€β”€ Enable Synapse
   └── Create admin user

Configuration Files

homeserver.yaml

Main Synapse configuration at /etc/synapse/homeserver.yaml

server_name: "matrix.example.com"
pid_file: /var/lib/synapse/homeserver.pid

listeners:
  - port: 8448
    tls: true
    type: http
    x_forwarded: true

database:
  name: psycopg2
  args:
    user: synapse
    password: <generated>
    database: synapsedb
    host: localhost

tls_certificate_path: /etc/synapse/matrix.example.com.crt
tls_private_key_path: /etc/synapse/matrix.example.com.key

federation_verify_certificates: true

# local ip support for federation
ip_range_whitelist:[]

Requirements

System Requirements

Requirement Minimum Recommended
RAM 512MB 2GB
CPU 1 core 2+ cores
Disk 10GB 50GB+

Software Dependencies

Dependency Requirement Status
systemd βœ… required Native
bash 4+ Native
curl βœ… required Native
openssl βœ… required Native
yq βœ… required Native

Package Dependencies

Ubuntu/Debian:

  • postgresql, postgresql-contrib, python3-psycopg2
  • matrix-synapse (from packages.matrix.org)

Common Tasks

View Configuration

# Run management script
./manage.sh

# Get YAML value programmatically
source manage.sh
yaml_get "server_name" "/etc/synapse/homeserver.yaml"

Update SSL Certificates

# Run SSL script
./ssl.sh
# Select: Update Synapse Certificates
# Enter path to file or directory (auto-detects)

Check Service Status

systemctl status matrix-synapse

View Logs

journalctl -u matrix-synapse -f

Security Considerations

File Permissions

File Type Permissions Owner
homeserver.yaml 0640 matrix-synapse:matrix-synapse
*.key 0600 matrix-synapse:matrix-synapse
*.crt 0644 matrix-synapse:matrix-synapse
/var/lib/synapse 0750 matrix-synapse:matrix-synapse

Root CA Integration

When using Root Key certificates:

  1. Root CA installed to system trust store
  2. Server certificates configured for Synapse
  3. Federation enabled with certificate verification
  4. Automatic trust between servers with same Root Key

Troubleshooting

Certificate Issues

# Check certificate expiry
openssl x509 -in /etc/synapse/matrix.example.com.crt -noout -dates

# Verify certificate chain
openssl s_client -connect matrix.example.com:8448 -showcerts

# Check Root CA installation
ls /usr/local/share/ca-certificates/*Root-CA*

Service Issues

# Check service status
systemctl status matrix-synapse

# View logs
journalctl -u matrix-synapse -f

# Test configuration
matrix-synapse --config-path /etc/synapse/homeserver.yaml

Documentation

  • CLAUDE.md β€” AI assistant development guide

External Sources

Component Source URL
Synapse (Ubuntu/Debian) packages.matrix.org https://packages.matrix.org/debian/
Element Web GitHub Releases https://github.com/element-hq/element-web/releases
Synapse Admin GitHub Releases https://github.com/Awesome-Technologies/synapse-admin/releases

License

MIT

Related Projects

License

MIT

Related Projects

About

Matrix Synapse Installer

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages