2020-11-27 20:56:20 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
containers.codimd = {
|
|
|
|
privateNetwork = true;
|
|
|
|
hostAddress = "192.168.100.1";
|
|
|
|
localAddress = "192.168.100.3";
|
|
|
|
autoStart = true;
|
|
|
|
config = { config, lib, pkgs, ... }: {
|
2021-01-15 22:45:34 +00:00
|
|
|
networking.firewall.enable = false;
|
2020-11-27 20:56:20 +00:00
|
|
|
services.coredns = {
|
|
|
|
enable = true;
|
|
|
|
config = ''
|
|
|
|
.:53 {
|
|
|
|
forward . 1.1.1.1
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
2021-01-02 08:49:25 +00:00
|
|
|
services.hedgedoc = {
|
2020-11-27 20:56:20 +00:00
|
|
|
enable = true;
|
|
|
|
configuration = {
|
|
|
|
allowAnonymous = true;
|
|
|
|
allowFreeURL = true;
|
|
|
|
allowGravatar = false;
|
2021-04-12 17:38:05 +00:00
|
|
|
allowOrigin = [ "localhost" "pad.hacc.space" "fff-muc.de" "pad.hacc.earth" ];
|
2020-11-27 20:56:20 +00:00
|
|
|
dbURL = "postgres://codimd:codimd@localhost:5432/codimd";
|
|
|
|
defaultPermission = "limited";
|
2021-04-12 17:38:05 +00:00
|
|
|
domain = "pad.hacc.earth";
|
2020-11-27 20:56:20 +00:00
|
|
|
host = "0.0.0.0";
|
|
|
|
protocolUseSSL = true;
|
|
|
|
hsts.preload = false;
|
|
|
|
email = false;
|
|
|
|
oauth2 = {
|
|
|
|
authorizationURL = "https://auth.infra4future.de/auth/realms/forfuture/protocol/openid-connect/auth";
|
|
|
|
tokenURL = "https://auth.infra4future.de/auth/realms/forfuture/protocol/openid-connect/token";
|
|
|
|
clientID = "codimd";
|
|
|
|
clientSecret = "1a730af1-4d6e-4c1d-8f7e-72375c9b8d62";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2021-01-02 08:49:25 +00:00
|
|
|
systemd.services.hedgedoc.environment = {
|
2020-11-27 20:56:20 +00:00
|
|
|
"CMD_OAUTH2_USER_PROFILE_URL" = "https://auth.infra4future.de/auth/realms/forfuture/protocol/openid-connect/userinfo";
|
|
|
|
"CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR" = "name";
|
|
|
|
"CMD_OAUTH2_USER_PROFILE_DISPLAY_NAME_ATTR" = "display-name";
|
|
|
|
"CMD_OAUTH2_USER_PROFILE_EMAIL_ATTR" = "email";
|
|
|
|
"CMD_OAUTH2_PROVIDERNAME" = "Infra4Future";
|
|
|
|
};
|
|
|
|
services.postgresql = {
|
|
|
|
enable = true;
|
|
|
|
ensureDatabases = [ "codimd" ];
|
|
|
|
ensureUsers = [{
|
|
|
|
name = "codimd";
|
|
|
|
ensurePermissions = {
|
|
|
|
"DATABASE codimd" = "ALL PRIVILEGES";
|
|
|
|
};
|
|
|
|
}];
|
|
|
|
};
|
2021-02-15 07:23:23 +00:00
|
|
|
services.postgresqlBackup = {
|
|
|
|
enable = true;
|
|
|
|
databases = [ "codimd" ];
|
|
|
|
startAt = "*-*-* 23:45:00";
|
|
|
|
};
|
2020-11-27 20:56:20 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-04-12 17:38:05 +00:00
|
|
|
services.nginx.virtualHosts."pad.hacc.earth" = {
|
2020-11-27 20:56:20 +00:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://192.168.100.3:3000";
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_pass_request_headers on;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_set_header X-Forwarded-Host $http_host;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection $http_connection;
|
2020-12-10 22:20:25 +00:00
|
|
|
add_header Access-Control-Allow-Origin "*";
|
2020-11-27 20:56:20 +00:00
|
|
|
proxy_buffering off;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|