all: reformat caddy logs
This commit is contained in:
parent
4bb172fa9e
commit
29555fda8b
5 changed files with 59 additions and 24 deletions
|
@ -1,13 +1,19 @@
|
|||
_: {
|
||||
_:
|
||||
let
|
||||
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
|
||||
in
|
||||
{
|
||||
services = {
|
||||
caddy = {
|
||||
virtualHosts = {
|
||||
"jellyfin.local.adtya.xyz" = {
|
||||
logFormat = logFormat "jellyfin.local.adtya.xyz";
|
||||
extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:8096
|
||||
'';
|
||||
};
|
||||
"jellyfin.labs.adtya.xyz" = {
|
||||
logFormat = logFormat "jellyfin.labs.adtya.xyz";
|
||||
extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:8096
|
||||
'';
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
{ pkgs, ... }: {
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
|
||||
in
|
||||
{
|
||||
services = {
|
||||
caddy = {
|
||||
virtualHosts."transmission.labs.adtya.xyz" = {
|
||||
logFormat = logFormat "transmission.labs.adtya.xyz";
|
||||
extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:9091
|
||||
'';
|
||||
|
|
11
hosts/shared/caddy-helpers.nix
Normal file
11
hosts/shared/caddy-helpers.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
logFormat = fileName: ''
|
||||
output file /var/log/caddy/${fileName}.log {
|
||||
roll_size 100MiB
|
||||
roll_keep 5
|
||||
roll_keep_for 100d
|
||||
}
|
||||
format json
|
||||
level INFO
|
||||
'';
|
||||
}
|
|
@ -1,4 +1,8 @@
|
|||
{ config, inputs, pkgs, ... }: {
|
||||
{ config, inputs, pkgs, ... }:
|
||||
let
|
||||
inherit (import ./caddy-helpers.nix) logFormat;
|
||||
in
|
||||
{
|
||||
sops = {
|
||||
secrets = {
|
||||
"caddy/env_file" = {
|
||||
|
@ -15,7 +19,7 @@
|
|||
globalConfig = ''
|
||||
acme_dns digitalocean {env.DO_API_TOKEN}
|
||||
'';
|
||||
logFormat = "level INFO";
|
||||
logFormat = logFormat "caddy_main";
|
||||
};
|
||||
systemd.services.caddy.serviceConfig.EnvironmentFile = config.sops.secrets."caddy/env_file".path;
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
{ lib, config, ... }: {
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (import ./caddy-helpers.nix) logFormat;
|
||||
in
|
||||
{
|
||||
services = {
|
||||
caddy = {
|
||||
virtualHosts."${config.networking.hostName}.labs.adtya.xyz" = {
|
||||
caddy =
|
||||
let
|
||||
vHost = "${config.networking.hostName}.labs.adtya.xyz";
|
||||
in
|
||||
{
|
||||
virtualHosts."${vHost}" = {
|
||||
logFormat = logFormat vHost;
|
||||
extraConfig = ''
|
||||
metrics /caddy-metrics
|
||||
handle /metrics {
|
||||
|
|
Loading…
Reference in a new issue