fuuko: Add hedgedoc
This commit is contained in:
parent
966667b87f
commit
57652d8a79
|
@ -8,6 +8,7 @@
|
||||||
./services/ankisyncd.nix
|
./services/ankisyncd.nix
|
||||||
./services/dnsmasq.nix
|
./services/dnsmasq.nix
|
||||||
./services/grafana.nix
|
./services/grafana.nix
|
||||||
|
./services/hedgedoc.nix
|
||||||
./services/media.nix
|
./services/media.nix
|
||||||
./services/prometheus.nix
|
./services/prometheus.nix
|
||||||
./services/scan.nix
|
./services/scan.nix
|
||||||
|
|
62
machines/fuuko/services/hedgedoc.nix
Normal file
62
machines/fuuko/services/hedgedoc.nix
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.services.hedgedoc;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.postgresql = {
|
||||||
|
enable = true;
|
||||||
|
ensureDatabases = [ "hedgedoc" ];
|
||||||
|
ensureUsers = lib.singleton {
|
||||||
|
name = "codimd";
|
||||||
|
ensurePermissions = {
|
||||||
|
"DATABASE hedgedoc" = "ALL PRIVILEGES";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.hedgedoc = {
|
||||||
|
enable = true;
|
||||||
|
configuration = {
|
||||||
|
host = "127.0.0.1";
|
||||||
|
port = 3001;
|
||||||
|
db = {
|
||||||
|
dialect = "postgres";
|
||||||
|
host = "/run/postgresql";
|
||||||
|
#user = "hedgedoc";
|
||||||
|
database = "hedgedoc";
|
||||||
|
};
|
||||||
|
domain = "pad.sbruder.de";
|
||||||
|
protocolUseSSL = true;
|
||||||
|
csp.enable = true;
|
||||||
|
imageUploadType = "filesystem";
|
||||||
|
uploadsPath = "/data/hedgedoc/uploads";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.hedgedoc = {
|
||||||
|
preStart = toString (pkgs.writeShellScript "hedgedoc-generate-session-secret" ''
|
||||||
|
if [ ! -f ${cfg.workDir}/session_secret_env ]; then
|
||||||
|
echo "CMD_SESSION_SECRET=$(${pkgs.pwgen}/bin/pwgen -s 32 1)" > ${cfg.workDir}/session_secret_env
|
||||||
|
fi
|
||||||
|
'');
|
||||||
|
serviceConfig = {
|
||||||
|
Environment = [
|
||||||
|
"CMD_LOGLEVEL=warn"
|
||||||
|
];
|
||||||
|
EnvironmentFile = [
|
||||||
|
"-${cfg.workDir}/session_secret_env" # - ensures that it will not fail on first start
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d ${cfg.configuration.uploadsPath} 0700 codimd codimd - -"
|
||||||
|
];
|
||||||
|
|
||||||
|
services.nginx.virtualHosts."pad.sbruder.de" = {
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
|
||||||
|
locations."/".proxyPass = "http://${cfg.configuration.host}:${toString cfg.configuration.port}";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue