improve hedhedoc
This commit is contained in:
parent
0b041cc949
commit
7cbd49fe42
5 changed files with 88 additions and 90 deletions
|
|
@ -4,7 +4,7 @@
|
|||
imports = [
|
||||
../common.nix
|
||||
../../services/openssh.nix
|
||||
../../services/hedgedoc.nix
|
||||
./hedgedoc.nix
|
||||
];
|
||||
|
||||
networking = {
|
||||
|
|
|
|||
24
hosts/md/hedgedoc.nix
Normal file
24
hosts/md/hedgedoc.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
db = {
|
||||
host = "sql.berlin.ccc.de";
|
||||
port = 5432;
|
||||
username = "hedgedoc";
|
||||
database = "hedgedoc";
|
||||
};
|
||||
in
|
||||
{
|
||||
services.hedgedoc = {
|
||||
enable = true;
|
||||
settings = {
|
||||
domain = "${config.networking.hostName}.${config.networking.domain}";
|
||||
dbURL = "postgres://${db.username}:\${DB_PASSWORD}@${db.host}:${toString db.port}/${db.name}";
|
||||
# sync with config.age.secrets.postgres-hedgedoc.path
|
||||
environmentFile = config.age.secrets.hedgedoc-env.path;
|
||||
protocolUseSSL = true;
|
||||
enableStatsApi = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
44
hosts/md/nginx.nix
Normal file
44
hosts/md/nginx.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.hedgedoc.settings;
|
||||
in
|
||||
{
|
||||
services.nginx.virtualHosts."${config.networking.hostName}.${config.networking.domain}" = {
|
||||
default = true;
|
||||
quic = true;
|
||||
kTLS = true;
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations = {
|
||||
"/" = {
|
||||
recommendedProxySettings = true;
|
||||
proxyPass = "http://${cfg.host}:${toString cfg.port}";
|
||||
};
|
||||
"/socket.io/" = {
|
||||
recommendedProxySettings = true;
|
||||
proxyWebsockets = true;
|
||||
proxyPass = "http://${cfg.host}:${toString cfg.port}";
|
||||
};
|
||||
"/metrics" = {
|
||||
recommendedProxySettings = true;
|
||||
proxyPass = "http://${cfg.host}:${toString cfg.port}";
|
||||
extraConfig = ''
|
||||
allow 195.160.173.14;
|
||||
allow 2001:678:760:cccb::14;
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
"/status" = {
|
||||
recommendedProxySettings = true;
|
||||
proxyPass = "http://${cfg.host}:${toString cfg.port}";
|
||||
extraConfig = ''
|
||||
allow 195.160.173.14;
|
||||
allow 2001:678:760:cccb::14;
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue