[webhook] Adds webhook for redeploying npm projects
This commit is contained in:
@@ -1,30 +1,59 @@
|
||||
# Static websites
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (import ./lib.nix config) terakoda havenisms blazestar;
|
||||
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/${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";
|
||||
inherit (import ./lib.nix config)
|
||||
terakoda
|
||||
havenisms
|
||||
blazestar
|
||||
;
|
||||
mkStaticSite =
|
||||
host:
|
||||
let
|
||||
cleanHost = lib.strings.stringAsChars (c: if c == "." then "-" else c) host;
|
||||
in
|
||||
{
|
||||
"${cleanHost}-static" = {
|
||||
image = "nginx:alpine";
|
||||
autoStart = true;
|
||||
volumes = [
|
||||
"/tank/web/${host}/public:/usr/share/nginx/html:ro"
|
||||
];
|
||||
labels = {
|
||||
"traefik.enable" = "true";
|
||||
"traefik.http.routers.${cleanHost}.rule" = "Host(`${host}`) || Host(`www.${host}`)";
|
||||
"traefik.http.routers.${cleanHost}.middlewares" = "${cleanHost}-add-www@docker";
|
||||
"traefik.http.services.${cleanHost}.loadbalancer.server.port" = "80";
|
||||
"traefik.http.middlewares.${cleanHost}-add-www.redirectregex.regex" = "^https://${host}/(.*)";
|
||||
"traefik.http.middlewares.${cleanHost}-add-www.redirectregex.replacement" =
|
||||
"https://www.${host}/\${1}";
|
||||
"traefik.http.middlewares.${cleanHost}-add-www.redirectregex.permanent" = "true";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
virtualisation.oci-containers.containers =
|
||||
mkStaticSite terakoda //
|
||||
mkStaticSite havenisms //
|
||||
mkStaticSite blazestar;
|
||||
in
|
||||
{
|
||||
virtualisation.oci-containers.containers =
|
||||
mkStaticSite terakoda
|
||||
// mkStaticSite havenisms
|
||||
// mkStaticSite blazestar
|
||||
// (
|
||||
let
|
||||
host = "www2.terakoda.com";
|
||||
cleanHost = lib.strings.stringAsChars (c: if c == "." then "-" else c) host;
|
||||
in
|
||||
{
|
||||
"${cleanHost}-static" = {
|
||||
image = "nginx:alpine";
|
||||
autoStart = true;
|
||||
volumes = [
|
||||
"/tank/web/www2.terakoda.com/dist:/usr/share/nginx/html:ro"
|
||||
];
|
||||
labels = {
|
||||
"traefik.enable" = "true";
|
||||
"traefik.http.routers.${cleanHost}.rule" = "Host(`${host}`)";
|
||||
"traefik.http.services.${cleanHost}.loadbalancer.server.port" = "80";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user