Multi-Instance

Run multiple Freedom Messenger instances on a single server — useful for hosting separate workspaces for different groups or for staging/production separation.

How It Works

Each instance has its own:

  • Configuration file (config.toml)
  • Data directory (database + uploaded files)
  • Systemd service
  • Domain name

An nginx reverse proxy in front handles TLS termination and routes traffic to the correct instance based on the domain.

Setup

Use the add-instance script to create a new instance:

./add-instance.sh

The script will:

  1. Create a separate config and data directory for the new instance
  2. Run the setup wizard for the new instance
  3. Create a dedicated systemd service
  4. Configure nginx to route the new domain to this instance
  5. Obtain a TLS certificate via certbot

Architecture

                     nginx (:443)
                    /          \
  team.example.com  /            \  family.example.com
                  /              \
  instance-1 (:8081)    instance-2 (:8082)

Each instance listens on a different internal port. Nginx terminates TLS and proxies to the correct instance based on the Host header.

Managing Instances

# List all instances
systemctl list-units 'freedom-mess-*'

# Manage a specific instance
sudo systemctl status freedom-mess-team
sudo systemctl restart freedom-mess-family
sudo journalctl -u freedom-mess-team -f

Considerations

  • Each instance uses its own SQLite database — instances do not share data
  • Users can connect to multiple instances using the Workspaces feature
  • Monitor disk space and memory — each instance uses approximately 50-100 MB of RAM at idle
  • Back up each instance separately