Wynne: setup forgejo

This commit is contained in:
Adithya 2024-09-23 20:48:06 +05:30
parent 405abcfed3
commit 7c04f41412
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
3 changed files with 65 additions and 1 deletions

View file

@ -2,6 +2,7 @@ _: {
imports = [
./dendrite
./acomputer.lol.nix
./forgejo.nix
./ntfy.nix
./postgresql.nix
../../../shared/prometheus-exporters.nix

View file

@ -0,0 +1,59 @@
{ config, lib, ... }:
let
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
domainName = "forge.acomputer.lol";
cfg = config.services.forgejo;
in
{
services = {
caddy.virtualHosts."${domainName}" = {
logFormat = logFormat domainName;
extraConfig = ''
reverse_proxy ${cfg.settings.server.HTTP_ADDR}:${toString cfg.settings.server.HTTP_PORT}
'';
};
frp.settings.proxies = [
{
name = "http.${domainName}";
type = "http";
customDomains = [ "${domainName}" ];
localPort = 80;
transport.useCompression = true;
}
{
name = "https.${domainName}";
type = "https";
customDomains = [ "${domainName}" ];
localPort = 443;
transport.useCompression = true;
}
];
forgejo = {
enable = true;
stateDir = "/mnt/data/Forgejo";
settings = {
database = {
DB_TYPE = lib.mkForce "postgres";
HOST = "127.0.0.1:5432";
USER = cfg.database.user;
NAME = cfg.database.name;
};
server = {
ROOT_URL = "https://${domainName}";
PROTOCOL = "http";
SSH_PORT = 42069;
HTTP_ADDR = "127.0.0.1";
HTTP_PORT = 3000;
DOMAIN = domainName;
};
session = {
COOKIE_SECURE = true;
};
service = {
DISABLE_REGISTRATION = true;
};
};
database.createDatabase = true;
};
};
}

View file

@ -16,12 +16,16 @@
host all all 10.10.10.0/24 trust
host all all fd7c:585c:c4ae::0/64 trust
'';
ensureDatabases = [ "dendrite" ];
ensureDatabases = [ "dendrite" "forgejo" ];
ensureUsers = [
{
name = "dendrite";
ensureDBOwnership = true;
}
{
name = "forgejo";
ensureDBOwnership = true;
}
];
};
};