bifrost: move public facing reverse proxies to bifrost

This commit is contained in:
Adithya 2024-11-16 23:08:16 +05:30
parent 940e3a811f
commit ef3d9510ce
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
21 changed files with 61 additions and 72 deletions

View file

@ -3,6 +3,7 @@ let
wireguard-peers = import ../../shared/wireguard-peers.nix;
in
{
nodeconfig.facts.wireguard-ip = "10.10.10.1";
sops.secrets = {
"wireguard/bifrost/pk" = {
mode = "400";

View file

@ -1,12 +1,10 @@
_:
let
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
domainName = "acomputer.lol";
in
{
services = {
caddy.virtualHosts."${domainName}" = {
inherit logFormat;
extraConfig = ''
handle /.well-known/matrix/server {
header Content-Type application/json

View file

@ -1,13 +1,11 @@
{ inputs, pkgs, ... }:
let
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
domainName = "adtya.xyz";
in
{
services = {
caddy.virtualHosts."${domainName}" = {
serverAliases = [ "www.${domainName}" ];
inherit logFormat;
extraConfig = ''
handle {
root * ${inputs.adtyaxyz.packages.${pkgs.system}.default}/share/web

View file

@ -0,0 +1,11 @@
_: {
imports = [
./adtya.xyz.nix
./acomputer.lol.nix
./dendrite.nix
./forgejo.nix
./ntfy.nix
./proofs.nix
./wiki.nix
];
}

View file

@ -1,12 +1,10 @@
_:
let
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
domainName = "matrix.acomputer.lol";
in
{
services = {
caddy.virtualHosts."${domainName}" = {
inherit logFormat;
extraConfig = ''
reverse_proxy 10.10.10.13:8008
'';

View file

@ -1,12 +1,10 @@
_:
let
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
domainName = "forge.acomputer.lol";
in
{
services = {
caddy.virtualHosts."${domainName}" = {
inherit logFormat;
extraConfig = ''
reverse_proxy 10.10.10.13:3000
'';

View file

@ -0,0 +1,13 @@
_:
let
domainName = "ntfy.acomputer.lol";
in
{
services = {
caddy.virtualHosts."${domainName}" = {
extraConfig = ''
reverse_proxy 10.10.10.13:8080
'';
};
};
}

View file

@ -0,0 +1,13 @@
_:
let
domainName = "proofs.adtya.xyz";
in
{
services = {
caddy.virtualHosts."${domainName}" = {
extraConfig = ''
redir https://keyoxide.org/hkp/51E4F5AB1B82BE45B4229CC243A5E25AA5A27849
'';
};
};
}

View file

@ -1,12 +1,10 @@
{ inputs, pkgs, ... }:
let
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
domainName = "wiki.adtya.xyz";
in
{
services = {
caddy.virtualHosts."${domainName}" = {
inherit logFormat;
extraConfig = ''
handle {
root * ${inputs.wiki.packages.${pkgs.system}.default}/share/web

View file

@ -1,5 +1,9 @@
_: {
imports = [
./ssh.nix
../../shared/caddy.nix
./apps
];
}

View file

@ -1,13 +1,5 @@
_: {
imports = [
./acomputer.lol.nix
./adtya.xyz.nix
./dendrite.nix
./forgejo.nix
./ntfy.nix
./proofs.nix
./wiki.nix
./dendrite.nix
../../../shared/prometheus-exporters.nix
../../../shared/promtail.nix
];

View file

@ -1,18 +0,0 @@
_:
let
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
domainName = "ntfy.acomputer.lol";
in
{
services = {
caddy.virtualHosts = {
"${domainName}" = {
inherit logFormat;
extraConfig = ''
reverse_proxy 10.10.10.13:8080
'';
};
};
};
}

View file

@ -1,17 +0,0 @@
_:
let
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
domainName = "proofs.adtya.xyz";
in
{
services = {
caddy.virtualHosts = {
"${domainName}" = {
inherit logFormat;
extraConfig = ''
redir https://keyoxide.org/hkp/51E4F5AB1B82BE45B4229CC243A5E25AA5A27849
'';
};
};
};
}

View file

@ -1,7 +0,0 @@
{
logFormat = ''
output stderr
format json
level ERROR
'';
}

View file

@ -1,8 +1,4 @@
{ config, inputs, pkgs, ... }:
let
inherit (import ./caddy-helpers.nix) logFormat;
in
{
{ config, inputs, pkgs, ... }: {
sops = {
secrets = {
"caddy/env_file" = {
@ -17,14 +13,12 @@ in
package = inputs.caddy.packages.${pkgs.system}.caddy;
email = "admin@acomputer.lol";
globalConfig = ''
admin ${config.nodeconfig.facts.wireguard-ip}:2019
acme_dns hetzner {env.HETZNER_ACCESS_TOKEN}
servers {
trusted_proxies static private_ranges 10.10.10.0/24
client_ip_headers X-Forwarded-For X-Real-IP
metrics
}
'';
inherit logFormat;
};
systemd.services.caddy.serviceConfig.EnvironmentFile = config.sops.secrets."caddy/env_file".path;
networking.firewall.allowedTCPPorts = [ 80 443 ];

View file

@ -1,5 +1,6 @@
_: {
imports = [
./facts.nix
./general.nix
./nix.nix
./pi.nix

12
modules/facts.nix Normal file
View file

@ -0,0 +1,12 @@
{ lib, ... }: {
options.nodeconfig = {
facts = {
wireguard-ip = lib.mkOption {
type = lib.types.str;
default = null;
example = "10.0.0.1";
description = "Wireguard IP of the node";
};
};
};
}