.. | ||
.dockerignore | ||
.gitignore | ||
dendrite-sample.in.yaml | ||
dendrite.in.yaml | ||
docker-entrypoint.sh | ||
Dockerfile | ||
fly.toml | ||
README.md | ||
TODO |
Matrix Homeserver on fly.io
Quick notes on how to run dendrite for a small scale Matrix homeserver on fly.io with sqlite storage.
Requirements
- A domain name where you can create/change A, AAAA and SRV records
- A fly.io account and the
flyctl
cli installed - Docker or similar container runtime installed
Preparations
For federation (talking to other homeservers), your server needs is a matrix server key.
Generate the server key using either the dendrite container:
docker run --rm -it -v $(pwd):/key -w /key --entrypoint /usr/bin/generate-keys matrixdotorg/dendrite-monolith:latest --private-key matrix_key.pem
or the generate-keys
app:
go run github.com/matrix-org/dendrite/cmd/generate-keys \
--private-key=matrix_key.pem \
--tls-cert=server.crt \
--tls-key=server.key
Do not loose this key!
Next, make copy the dendrite-sample.in.yaml
to dentrite.in.yaml
and change the global.server_name
to your desired domain.
Finally, change the app = "dendrite-on-fly"
line in fly.toml
to an app name of your desire.
Deployment
Choose your Fly.io region (flyctl platform regions
) and edit the fly.toml
file.
Create a 10GB persistent volume mount in your desired region.
flyctl volumes create dendrite_data --region bos --size 10
Now you simply can deploy dendrite using
flyctl deploy
Secrets
flyctl secrets set "DATABASE_URL=postgresql://user:pass@hostname/database?params=..."
flyctl secrets set "REGISTRATION_SHARED_SECRET=imabad5cret!"
base64 -w0 matrix_key.pem | flyctl secrets set MATRIX_KEY_PEM=-
Domain configuration
After deployment, execute flyctl info
to obtain the IP addresses your app runs on.
Use these IPs to create A and AAAA records for the domain name you configured in dendrite.yaml
Usually matrix federates on port 8448, but it is possible to use a SRV record to specify a different port (8443 in our case).
Create a SRV record at _matrix._tcp.<the-original-domain>
with values 10 10 8443 <the-original-domain>
It is possible to test federation with the Matrix federation tester.
Once you have set up the A and AAAA records, obtain a TLS certificate using flyctl
flyctl certs add <hostname>
You now can create accounts on your homeserver and start chatting with people.
Still to figure out
- How to backup your sqlite file
Useful information
- flyctl v0.0.181 and dendrite v0.3.11 were used