services: serve the blog from its flake, beside the container
All checks were successful
nixos / nixos (push) Successful in 22s
All checks were successful
nixos / nixos (push) Successful in 22s
The blog's repository now exports the built site and a module serving it from an nginx virtual host. services runs it on :8081 next to the container on ops; Traefik does not route to it yet. Routes get an optional priority, so the new route can take over from the container's labels (1000) without removing them first. nginx now reloads for a changed virtual host instead of restarting. Assisted-by: Claude:opus-5-5
This commit is contained in:
parent
35bc42b01b
commit
4a6c4ac3a3
3 changed files with 66 additions and 9 deletions
|
|
@ -35,6 +35,12 @@ in
|
|||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
};
|
||||
# Above the app containers' labels (1000) while a service
|
||||
# takes over from its container
|
||||
priority = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.int;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
@ -43,7 +49,9 @@ in
|
|||
config = {
|
||||
sops.secrets."traefik/letsencrypt_email" = { };
|
||||
sops.templates."traefik.env".content = ''
|
||||
TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_EMAIL=${config.sops.placeholder."traefik/letsencrypt_email"}
|
||||
TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_EMAIL=${
|
||||
config.sops.placeholder."traefik/letsencrypt_email"
|
||||
}
|
||||
'';
|
||||
|
||||
services.traefik = {
|
||||
|
|
@ -169,13 +177,17 @@ in
|
|||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
}
|
||||
// lib.mapAttrs (name: r: {
|
||||
rule = lib.concatMapStringsSep " || " (h: "Host(`${h}`)") r.hosts;
|
||||
entryPoints = [ "websecure" ];
|
||||
service = name;
|
||||
inherit (r) middlewares;
|
||||
tls.certResolver = "letsencrypt";
|
||||
}) config.asxpio.routes;
|
||||
// lib.mapAttrs (
|
||||
name: r:
|
||||
{
|
||||
rule = lib.concatMapStringsSep " || " (h: "Host(`${h}`)") r.hosts;
|
||||
entryPoints = [ "websecure" ];
|
||||
service = name;
|
||||
inherit (r) middlewares;
|
||||
tls.certResolver = "letsencrypt";
|
||||
}
|
||||
// lib.optionalAttrs (r.priority != null) { inherit (r) priority; }
|
||||
) config.asxpio.routes;
|
||||
|
||||
services = {
|
||||
garage-web.loadBalancer.servers = [ { url = "http://127.0.0.1:3902"; } ];
|
||||
|
|
|
|||
13
nixos/hosts/asxpio-services/apps.nix
Normal file
13
nixos/hosts/asxpio-services/apps.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# The apps, built from their own repositories' flakes (inputs in
|
||||
# ../../flake.nix) and served here; Traefik on asxpio-ops routes to them
|
||||
# over the private network (asxpio.routes there). A release is a bump of
|
||||
# the app's input in flake.lock.
|
||||
{ ... }:
|
||||
{
|
||||
# A new or changed virtual host reloads nginx instead of restarting it
|
||||
services.nginx.enableReload = true;
|
||||
|
||||
services.blog.enable = true; # :8081
|
||||
|
||||
asxpio.security.ports = [ "tcp/8081/nginx" ];
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
{
|
||||
imports = [
|
||||
./acme-forward.nix
|
||||
./apps.nix
|
||||
./minecraft.nix
|
||||
./replica.nix
|
||||
./runner.nix
|
||||
|
|
|
|||
Loading…
Reference in a new issue