Skip to content

resources for running matrix-synapse in namespaced debian containers

Notifications You must be signed in to change notification settings

DWeb-Deconstruction-Project/synapse-nspawn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

synapse-nspawn

Run Synapse on localhost in a Debian container.

Note to self: as of Nov 30 2021, I noticed that recent versions of mkosi produce an image missing /etc/resolv.conf and without working name resolution. Unsure why. In the meantime, the following version works:

python3 -m pip install --user git+https://github.com/systemd/mkosi.git@f9b565e11a7310d69c314f12d4c8d173e3196812

Prerequisites (minimum)

To install prerequisites on Debian-based distributions, run:

sudo apt install systemd-container debootstrap debian-archive-keyring
python3 -m pip install --user git+https://github.com/systemd/mkosi.git

To install prerequisites on other systemd-based platforms:

  • If your distribution lacks systemd-nspawn and machinectl, install the package systemd-container
  • Install the packages debootstrap and debian-archive-keyring, then install mkosi from source

Quickstart

To spawn a minimal Synapse homeserver on localhost:8008, run:

git clone https://github.com/matrix-org/synapse.git
git clone https://github.com/DWeb-Deconstruction-Project/synapse-nspawn.git
cd synapse-nspawn
sudo -E python3 -m mkosi --build-sources ../synapse --minimize
sudo systemd-nspawn --machine synapse --settings trusted

Usage

mkosi uses a two-phase process to allow fast incremental builds of code in the container. Run mkosi with the --incremental flag and with --build-sources set to the root of your existing Synapse code tree. On subsequent builds, use the --force flag to install your modified code:

sudo -E python3 -m mkosi --build-sources ../synapse --incremental --force

The image synapse.raw is created in /var/lib/machines/, and can be easily booted with systemd-nspawn:

sudo systemd-nspawn --machine synapse --settings trusted

Notes

  • Ignore the btrfs error at the end of the mkosi build process
  • mkosi does not cache the Python packages installed in mkosi.prepare, so these packages are downloaded twice during the initial build process
  • The included Synapse service, sysuser, and tmpfile configs are based on those of the Arch package
  • The included systemd log config is from the official Synapse repo

Releases

No releases published

Packages

No packages published

Languages