setup dendrite

This commit is contained in:
Adithya 2023-10-29 23:26:49 +05:30
parent 2bf22ef378
commit 28c0868f7d
Signed by: adtya
GPG key ID: 48FC9915FFD326D0
5 changed files with 140 additions and 59 deletions

View file

@ -34,7 +34,6 @@
inputs.nixpkgs.follows = "nixpkgs";
};
wiki = {
url = "github:adtya/wiki";
inputs.nixpkgs.follows = "nixpkgs";

View file

@ -1,7 +1,7 @@
{...}: {
imports = [
./caddy.nix
./dendrite.nix
./dendrite
./frpc.nix
./nats.nix
./postgresql.nix

View file

@ -1,57 +0,0 @@
_: {
services = {
caddy.virtualHosts."matrix.adtya.xyz" = {
extraConfig = ''
reverse_proxy /_matrix/* 127.0.0.1:8008
'';
};
dendrite = let
database = {
connection_string = "postgresql://dendrite@localhost/dendrite?sslmode=disable";
max_open_conns = 50;
max_idle_conns = 5;
conn_max_lifetime = -1;
};
in {
enable = false;
settings = {
global = {
server_name = "adtya.xyz";
private_key = "/etc/dendrite/matrix_key.pem";
jetstream = {
addresses = "localhost:4222";
};
inherit database;
};
app_service_api = {
database = null;
};
federation_api = {
database = null;
};
key_server = {
database = null;
};
media_api = {
database = null;
};
mscs = {
database = null;
};
relay_api = {
database = null;
};
room_server = {
database = null;
};
sync_api = {
database = null;
};
user_api = {
account_database = null;
device_database = null;
};
};
};
};
}

View file

@ -0,0 +1,118 @@
version: 2
global:
server_name: adtya.xyz
private_key: /etc/dendrite/matrix_key.pem
key_validity_period: 168h0m0s
database:
connection_string: postgresql://dendrite@localhost/dendrite?sslmode=disable
max_open_conns: 90
max_idle_conns: 5
conn_max_lifetime: -1
cache:
max_size_estimated: 1gb
max_age: 1h
well_known_server_name: "matrix.adtya.xyz:443"
well_known_client_name: "matrix.adtya.xyz:443"
trusted_third_party_id_servers:
- matrix.org
- vector.im
disable_federation: false
presence:
enable_inbound: false
enable_outbound: false
jetstream:
addresses:
- localhost:4222
disable_tls_validation: false
storage_path: /var/lib/dendrite/nats
topic_prefix: Dendrite
dns_cache:
enabled: true
cache_size: 256
cache_lifetime: "5m"
client_api:
registration_disabled: true
guests_disabled: true
registration_shared_secret: ""
enable_registration_captcha: false
recaptcha_public_key: ""
recaptcha_private_key: ""
recaptcha_bypass_secret: ""
# TURN server information that this homeserver should send to clients.
federation_api:
send_max_retries: 16
disable_tls_validation: false
disable_http_keepalives: false
key_perspectives:
- server_name: matrix.org
keys:
- key_id: ed25519:auto
public_key: Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw
- key_id: ed25519:a_RXGa
public_key: l8Hft5qXKn1vfHrg3p4+W8gELQVo8N13JkluMfmn2sQ
prefer_direct_fetch: false
media_api:
base_path: /var/lib/dendrite/media
max_file_size_bytes: 10485760
dynamic_thumbnails: false
max_thumbnail_generators: 10
thumbnail_sizes:
- width: 32
height: 32
method: crop
- width: 96
height: 96
method: crop
- width: 640
height: 480
method: scale
sync_api:
real_ip_header: X-Real-IP
search:
enabled: false
index_path: "/var/lib/dendrite/searchindex"
language: "en"
# Configuration for the User API.
user_api:
bcrypt_cost: 10
auto_join_rooms:
# - "#main:matrix.org"
tracing:
enabled: false
jaeger:
serviceName: ""
disabled: false
rpc_metrics: false
tags: []
sampler: null
reporter: null
headers: null
baggage_restrictions: null
throttler: null
logging:
- type: std
level: info
- type: file
level: info
params:
path: ./logs

View file

@ -0,0 +1,21 @@
{pkgs, ...}: {
services = {
caddy.virtualHosts."matrix.adtya.xyz" = {
extraConfig = ''
reverse_proxy /_matrix/* 127.0.0.1:8008
'';
};
};
systemd.services.dendrite = {
description = "Dendrite Matrix homeserver";
after = ["network.target"];
wantedBy = ["multi-user.target"];
serviceConfig = {
Type = "simple";
LimitNOFILE = 65535;
ExecStart = ''
${pkgs.dendrite}/bin/dendrite -http-bind-address 127.0.0.1:8008 -https-bind-address 127.0.0.1:8448 -config ${./config.yaml}
'';
};
};
}