[terakoda.com] Adds page
This commit is contained in:
@@ -1,12 +1,34 @@
|
||||
# Define a very simple webserver to act as a default homepage.
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
virtualisation.oci-containers.containers = {
|
||||
public-homepage = {
|
||||
# Static websites
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (import ./lib.nix config) terakoda;
|
||||
mkStaticSite = domain: let
|
||||
cleanDomain = lib.strings.stringAsChars (c: if c == "." then "-" else c) domain;
|
||||
in {
|
||||
"${cleanDomain}-static" = {
|
||||
image = "nginx:alpine";
|
||||
autoStart = true;
|
||||
volumes = [
|
||||
"/tank/web/static:/usr/share/nginx/html:ro"
|
||||
"/tank/web/${domain}/public:/usr/share/nginx/html:ro"
|
||||
];
|
||||
labels = {
|
||||
"traefik.enable" = "true";
|
||||
"traefik.http.routers.${cleanDomain}.rule" = "Host(`${domain}`) || Host(`www.${domain}`)";
|
||||
"traefik.http.routers.${cleanDomain}.middlewares" = "${cleanDomain}-add-www@docker";
|
||||
"traefik.http.services.${cleanDomain}.loadbalancer.server.port" = "80";
|
||||
"traefik.http.middlewares.${cleanDomain}-add-www.redirectregex.regex" = "^https://${domain}/(.*)";
|
||||
"traefik.http.middlewares.${cleanDomain}-add-www.redirectregex.replacement" = "https://www.${domain}/\${1}";
|
||||
"traefik.http.middlewares.${cleanDomain}-add-www.redirectregex.permanent" = "true";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
virtualisation.oci-containers.containers = {
|
||||
havenisms-homepage = {
|
||||
image = "nginx:alpine";
|
||||
autoStart = true;
|
||||
volumes = [
|
||||
"/tank/web/havenisms.com/public:/usr/share/nginx/html:ro"
|
||||
];
|
||||
extraOptions = [
|
||||
"-l=traefik.enable=true"
|
||||
@@ -14,5 +36,5 @@
|
||||
"-l=traefik.http.services.public.loadbalancer.server.port=80"
|
||||
];
|
||||
};
|
||||
};
|
||||
} // mkStaticSite terakoda;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user