2024-04-19 17:11:03 +00:00
|
|
|
{ config, pkgs, lib, ...}:
|
2023-05-03 21:04:13 +00:00
|
|
|
|
2023-09-27 21:24:23 +00:00
|
|
|
{
|
2023-05-03 21:04:13 +00:00
|
|
|
sops.secrets = {
|
|
|
|
"mattermost/env" = {};
|
|
|
|
};
|
|
|
|
|
2024-04-19 17:11:03 +00:00
|
|
|
hacc.containers.mattermost = {
|
|
|
|
bindSecrets = true;
|
2021-08-06 18:54:40 +00:00
|
|
|
|
2024-04-19 17:11:03 +00:00
|
|
|
config = { config, lib, pkgs, ... }: {
|
2022-10-15 18:10:29 +00:00
|
|
|
systemd.services.mattermost.serviceConfig.EnvironmentFile =
|
2023-06-06 00:04:11 +00:00
|
|
|
lib.mkForce "/secrets/env";
|
2022-10-15 18:10:29 +00:00
|
|
|
|
|
|
|
services.mattermost = {
|
2021-08-06 18:54:40 +00:00
|
|
|
enable = true;
|
|
|
|
siteUrl = "https://mattermost.infra4future.de";
|
2021-08-11 20:31:35 +00:00
|
|
|
siteName = "Mattermost for Future";
|
2021-08-06 18:54:40 +00:00
|
|
|
listenAddress = "0.0.0.0:3000";
|
|
|
|
mutableConfig = false;
|
|
|
|
|
|
|
|
statePath = "/persist/mattermost";
|
|
|
|
|
|
|
|
extraConfig = {
|
|
|
|
ServiceSettings = {
|
|
|
|
TrustedProxyIPHeader = [ "X-Forwarded-For" "X-Real-Ip" ];
|
|
|
|
ReadTimeout = 300;
|
|
|
|
WriteTimeout = 600;
|
|
|
|
IdleTimeout = 60;
|
|
|
|
MaximumLoginAttempts = 10;
|
|
|
|
AllowCorsFrom = "*.infra4future.de/*";
|
|
|
|
WebserverMode = "gzip";
|
|
|
|
EnableCustomEmoji = true;
|
|
|
|
EnableEmojiPicker = true;
|
|
|
|
EnableGifPicker = false;
|
|
|
|
RestrictCustomEmojiCreation = "all";
|
|
|
|
RestrictPostDelete = "all";
|
|
|
|
AllowEditPost = "always";
|
|
|
|
PostEditTimeout = -1;
|
|
|
|
EnableTutorial = false;
|
|
|
|
ExperimentalChannelSidebarOrganization = "default_on";
|
|
|
|
ExperimentalChannelOrganization = true;
|
|
|
|
ExperimentalDataPrefetch = true;
|
|
|
|
EnableEmailInvitations = true;
|
|
|
|
DisableLegacyMFA = true;
|
|
|
|
EnableSVGs = true;
|
|
|
|
EnableLaTeX = true;
|
|
|
|
ThreadAutoFollow = true;
|
|
|
|
EnableSecurityFixAlert = false;
|
2021-08-11 20:31:35 +00:00
|
|
|
CollapsedThreads = "default_on";
|
2021-08-06 18:54:40 +00:00
|
|
|
};
|
|
|
|
TeamSettings = {
|
|
|
|
EnableTeamCreation = true;
|
|
|
|
EnableUserCreation = true;
|
2021-11-06 17:11:08 +00:00
|
|
|
MaxUsersPerTeam = 250;
|
2021-08-06 18:54:40 +00:00
|
|
|
EnableOpenServer = false;
|
|
|
|
EnableUserDeactivation = true;
|
|
|
|
ExperimentalViewArchivedChannels = true;
|
|
|
|
ExperimentalEnableAutomaticReplies = true;
|
|
|
|
};
|
|
|
|
LogSettings = {
|
|
|
|
EnableConsole = true;
|
2022-10-15 18:10:29 +00:00
|
|
|
# note: for some reason this doesn't work (mattermost still sets it to DEBUG);
|
|
|
|
# it's also set in secrets.env, where for some reason it does
|
2021-08-06 18:54:40 +00:00
|
|
|
ConsoleLevel = "ERROR";
|
|
|
|
EnableDiagnostics = false;
|
|
|
|
EnableWebhookDebugging = false;
|
|
|
|
};
|
|
|
|
NotificationLogSettings = {
|
|
|
|
EnableConsole = true;
|
|
|
|
ConsoleLevel = "INFO";
|
|
|
|
};
|
|
|
|
PasswordSettings = {
|
|
|
|
MinimumLength = 10;
|
|
|
|
# turn of all the bullshit requirements
|
|
|
|
Lowercase = false;
|
|
|
|
Number = false;
|
|
|
|
Uppercase = false;
|
|
|
|
Symbol = false;
|
|
|
|
};
|
|
|
|
FileSettings = {
|
|
|
|
EnableFileAttachments = true;
|
|
|
|
MaxFileSize = 52428800;
|
|
|
|
DriverName = "local";
|
|
|
|
Directory = "/persist/mattermost/upload-storage";
|
|
|
|
EnablePublicLink = true;
|
|
|
|
PublicLinkSalt = "3k7p3yxdhz6798b3b9openfr9rn3ymwu";
|
|
|
|
};
|
|
|
|
EmailSettings = {
|
|
|
|
EnableSignUpWithEmail = false;
|
|
|
|
EnableSignInWithEmail = false;
|
|
|
|
EnableSignInWithUsername = false;
|
|
|
|
SendEmailNotifications = true;
|
|
|
|
FeedbackName = "mattermost";
|
|
|
|
FeedbackEmail = "mattermost@infra4future.de";
|
|
|
|
ReplyToAddress = "mattermost@infra4future.de";
|
|
|
|
FeedbackOrganization = "∆infra4future.de";
|
|
|
|
EnableSMTPAuth = true;
|
|
|
|
SMTPUsername = "noreply@infra4future.de";
|
|
|
|
SMTPServer = "mail.hacc.space";
|
2022-10-16 12:32:04 +00:00
|
|
|
SMTPPort = "465";
|
2022-10-15 18:10:29 +00:00
|
|
|
SMTPServerTimeout = 10;
|
|
|
|
ConnectionSecurity = "TLS";
|
2021-08-06 18:54:40 +00:00
|
|
|
};
|
|
|
|
RateLimitSettings.Enable = false;
|
|
|
|
PrivacySettings = {
|
|
|
|
ShowEmailAddress = false;
|
|
|
|
ShowFullName = true;
|
|
|
|
};
|
2023-05-19 21:06:15 +00:00
|
|
|
# to disable the extra landing page advertising the app
|
|
|
|
NativeAppSettings = {
|
|
|
|
AppDownloadLink = "";
|
|
|
|
AndroidAppDownloadLink = "";
|
|
|
|
IosAppDownloadLink = "";
|
|
|
|
};
|
2021-08-06 18:54:40 +00:00
|
|
|
SupportSettings = {
|
|
|
|
TermsOfServiceLink = "https://infra4future.de/nutzungsbedingungen.html";
|
|
|
|
PrivacyPolicyLink = "https://infra4future.de/nutzungsbedingungen.html";
|
|
|
|
AboutLink = "https://infra4future.de";
|
|
|
|
SupportEmail = "info@infra4future.de";
|
|
|
|
CustomTermsOfServiceEnabled = false;
|
|
|
|
EnableAskCommunityLink = true;
|
|
|
|
};
|
|
|
|
AnnouncementSettings.EnableBanner = false;
|
|
|
|
GitLabSettings = {
|
|
|
|
Enable = true;
|
|
|
|
Id = "mattermost";
|
|
|
|
Scope = "";
|
2022-04-30 20:43:12 +00:00
|
|
|
AuthEndpoint = "https://login.infra4future.de/oauth2/authorize";
|
|
|
|
TokenEndpoint = "https://login.infra4future.de/oauth2/token";
|
|
|
|
UserApiEndpoint = "https://login.infra4future.de/oauth2/userinfo";
|
2021-08-06 18:54:40 +00:00
|
|
|
};
|
|
|
|
# for some reason, these don't appear to be working; the startup
|
|
|
|
# process complaines and sets these back to en
|
|
|
|
LocalizationSettings = {
|
|
|
|
DefaultServerLocale = "de";
|
|
|
|
DefaultClientLocale = "de";
|
|
|
|
AvailableLocales = "de,en";
|
|
|
|
};
|
|
|
|
MessageExportSettings.EnableExport = false;
|
|
|
|
# plugins appear to have trouble with the read-only filesystem; it may
|
|
|
|
# be necessary to manually change their paths etc.
|
|
|
|
PluginSettings = {
|
|
|
|
Enable = true;
|
|
|
|
EnableUploads = true;
|
|
|
|
Plugins = {
|
|
|
|
bigbluebutton = {
|
|
|
|
adminonly = false;
|
|
|
|
base_url = "https://bbb.infra4future.de/bigbluebutton/api";
|
|
|
|
salt = "zKCsNeaEniC115ynHOsZopgA4iTiJjzgeiPNoCEc";
|
|
|
|
};
|
|
|
|
"com.github.matterpoll.matterpoll" = {
|
|
|
|
experimentalui = true;
|
|
|
|
trigger = "poll";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
PluginStates = {
|
|
|
|
bigbluebutton.Enable = true;
|
|
|
|
"com.github.matterpoll.matterpoll".Enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
ComplianceSettings.Enable = false;
|
|
|
|
ClusterSettings.Enable = false;
|
|
|
|
MetricsSettings.Enable = false;
|
|
|
|
GuestAccountsSettings.Enable = false;
|
|
|
|
FeatureFlags.CollapsedThreads = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# turn of the weirder parts of this module (which insist on passwords
|
|
|
|
# in nix files, instead of just using socket-based authentication)
|
|
|
|
#
|
|
|
|
# It will still attempt to use its default password, but postgres will
|
|
|
|
# just let it in regardless of that.
|
|
|
|
localDatabaseCreate = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.mysql = {
|
|
|
|
enable = true;
|
|
|
|
ensureDatabases = [ "mattermost" ];
|
|
|
|
ensureUsers = [ {
|
|
|
|
name = "mattermost";
|
|
|
|
ensurePermissions = { "mattermost.*" = "ALL PRIVILEGES"; };
|
|
|
|
} ];
|
2023-09-27 16:24:18 +00:00
|
|
|
package = pkgs.mysql80;
|
2024-01-31 22:30:06 +00:00
|
|
|
dataDir = "/persist/mysql";
|
2021-08-06 18:54:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.postgresql = {
|
|
|
|
enable = lib.mkForce true; # mattermost sets this to false. wtf.
|
2023-11-30 16:43:48 +00:00
|
|
|
package = pkgs.postgresql_15;
|
2021-08-06 18:54:40 +00:00
|
|
|
ensureDatabases = [ "mattermost" ];
|
|
|
|
ensureUsers = [ {
|
|
|
|
name = "mattermost";
|
2023-11-30 16:43:48 +00:00
|
|
|
ensureDBOwnership = true;
|
2021-08-06 18:54:40 +00:00
|
|
|
} ];
|
|
|
|
|
|
|
|
authentication = lib.mkForce ''
|
|
|
|
# Generated file; do not edit!
|
|
|
|
local all all trust
|
|
|
|
host mattermost mattermost ::1/128 trust
|
|
|
|
'';
|
|
|
|
};
|
2024-01-28 14:48:13 +00:00
|
|
|
services.postgresqlBackup = {
|
|
|
|
enable = true;
|
|
|
|
databases = [ "mattermost" ];
|
|
|
|
startAt = "*-*-* 23:45:00";
|
|
|
|
location = "/persist/backups/postgres";
|
|
|
|
};
|
2024-04-19 17:11:03 +00:00
|
|
|
};
|
2021-08-06 18:54:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."mattermost.infra4future.de" = {
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://${config.containers.mattermost.localAddress}:3000";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
extraConfig = ''
|
|
|
|
# Mattermost CSR Patch
|
|
|
|
proxy_hide_header Content-Security-Policy;
|
|
|
|
proxy_hide_header X-Frame-Options;
|
|
|
|
proxy_redirect off;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
};
|
|
|
|
}
|