Home: Add chat server.

This commit is contained in:
Dmitry Voronin 2024-12-06 05:45:32 +03:00
parent 673eb2c98f
commit 7ef99042fe
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
4 changed files with 76 additions and 0 deletions

View file

@ -17,6 +17,7 @@
(mkBind "jellyfin_cache" "/var/cache/jellyfin")
(mkBind "kavita" "/var/lib/kavita")
(mkBind "letsencrypt" "/etc/letsencrypt")
(mkBind "mattermost" "/var/lib/mattermost")
(mkBind "nextcloud" "/var/lib/nextcloud")
(mkBind "ovpn" "/var/lib/ovpn")
(mkBind "paperless" "/var/lib/paperless")

View file

@ -0,0 +1,54 @@
{
pkgs,
...
}: {
services.mattermost = {
enable = true;
listenAddress = ":9609";
localDatabaseCreate = false;
mutableConfig = false;
# package = pkgs.mattermost;
siteName = "Chat";
siteUrl = "https://chat.voronind.com";
statePath = "/var/lib/mattermost";
plugins = [
(pkgs.fetchurl rec {
hash = "sha256-yQGBpBPgXxC+Pm6dHlbwlNEdvn6wg9neSpNNTC4YYAA=";
url = "https://github.com/mattermost/mattermost-plugin-calls/releases/download/v${version}/mattermost-plugin-calls-v${version}.tar.gz";
version = "1.2.0";
})
];
extraConfig = {
SqlSettings = {
DataSource = "postgres:///mattermost?host=/run/postgresql";
DriverName = "postgres";
};
};
};
services.turn-rs = {
enable = true;
settings = {
auth = {
static_credentials = {
mattermost = "mattermost";
};
};
turn = {
interfaces = [
{
bind = "127.0.0.1:3478";
external = "127.0.0.1:3478";
transport = "udp";
}
{
bind = "127.0.0.1:3478";
external = "127.0.0.1:3478";
transport = "tcp";
}
];
realm = "localhost";
};
};
};
}

View file

@ -193,6 +193,10 @@ in {
# Terraria server.
ip46tables -I INPUT -j ACCEPT -i ${wan} -p tcp --dport 22777
# TURN server.
ip46tables -I INPUT -j ACCEPT -i ${wan} -p tcp --dport 3478
ip46tables -I INPUT -j ACCEPT -i ${wan} -p udp --dport 3478
# Public SSH access.
# ip46tables -I INPUT -j ACCEPT -i ${wan} -p tcp --dport 22143
'';

View file

@ -0,0 +1,17 @@
{
util,
...
}: {
"chat.voronind.com".extraConfig = util.trimTabs ''
listen 443 ssl;
location / {
proxy_pass http://127.0.0.1:9609$request_uri;
}
ssl_certificate /etc/letsencrypt/live/voronind.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/voronind.com/privkey.pem;
include /etc/letsencrypt/conf/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/conf/ssl-dhparams.pem;
'';
}