haccfiles/hosts/hainich/services/hedgedoc_i4f.nix

77 lines
2.2 KiB
Nix
Raw Permalink Normal View History

2020-11-27 20:56:20 +00:00
{ config, lib, pkgs, ... }:
{
2021-06-02 19:08:54 +00:00
containers.pad-i4f = {
2020-11-27 20:56:20 +00:00
privateNetwork = true;
hostAddress = "192.168.100.1";
2021-06-02 19:08:54 +00:00
localAddress = "192.168.100.41";
2020-11-27 20:56:20 +00:00
autoStart = true;
config = { config, lib, pkgs, ... }: {
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-06-02 19:08:54 +00:00
allowOrigin = [ "localhost" "pad.infra4future.de" "fff-muc.de" ];
dbURL = "postgres://hedgedoc:hedgedoc@localhost:5432/hedgedoc";
defaultPermission = "freely";
domain = "pad.infra4future.de";
2020-11-27 20:56:20 +00:00
host = "0.0.0.0";
protocolUseSSL = true;
hsts.preload = false;
email = false;
};
};
services.postgresql = {
enable = true;
2021-06-02 19:08:54 +00:00
authentication = ''
local all all trust
host hedgedoc hedgedoc 127.0.0.1/32 trust
'';
ensureDatabases = [ "hedgedoc" ];
2020-11-27 20:56:20 +00:00
ensureUsers = [{
2021-06-02 19:08:54 +00:00
name = "hedgedoc";
2020-11-27 20:56:20 +00:00
ensurePermissions = {
2021-06-02 19:08:54 +00:00
"DATABASE hedgedoc" = "ALL PRIVILEGES";
2020-11-27 20:56:20 +00:00
};
}];
};
2021-02-15 07:23:23 +00:00
services.postgresqlBackup = {
enable = true;
2021-06-02 19:08:54 +00:00
databases = [ "hedgedoc" ];
2021-02-15 07:23:23 +00:00
startAt = "*-*-* 23:45:00";
};
2020-11-27 20:56:20 +00:00
};
};
2021-06-02 19:08:54 +00:00
services.nginx.virtualHosts."pad.infra4future.de" = {
2020-11-27 20:56:20 +00:00
forceSSL = true;
enableACME = true;
locations."/" = {
2021-06-02 19:08:54 +00:00
proxyPass = "http://192.168.100.41:3000";
2020-11-27 20:56:20 +00:00
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;
add_header Access-Control-Allow-Origin "*";
2020-11-27 20:56:20 +00:00
proxy_buffering off;
'';
};
};
}