Compare commits
2 Commits
9acaae9277
...
6601377ece
| Author | SHA1 | Date | |
|---|---|---|---|
| 6601377ece | |||
| d432ef8014 |
@@ -7,7 +7,10 @@ let
|
|||||||
blazestar
|
blazestar
|
||||||
;
|
;
|
||||||
mkStaticSite =
|
mkStaticSite =
|
||||||
host:
|
{
|
||||||
|
host,
|
||||||
|
dir ? "public",
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
cleanHost = lib.strings.stringAsChars (c: if c == "." then "-" else c) host;
|
cleanHost = lib.strings.stringAsChars (c: if c == "." then "-" else c) host;
|
||||||
in
|
in
|
||||||
@@ -16,7 +19,7 @@ let
|
|||||||
image = "nginx:alpine";
|
image = "nginx:alpine";
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
volumes = [
|
volumes = [
|
||||||
"/tank/web/${host}/public:/usr/share/nginx/html:ro"
|
"/tank/web/${host}/${dir}:/usr/share/nginx/html:ro"
|
||||||
];
|
];
|
||||||
labels = {
|
labels = {
|
||||||
"traefik.enable" = "true";
|
"traefik.enable" = "true";
|
||||||
@@ -33,27 +36,10 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
virtualisation.oci-containers.containers =
|
virtualisation.oci-containers.containers =
|
||||||
mkStaticSite terakoda
|
mkStaticSite {
|
||||||
// mkStaticSite havenisms
|
host = terakoda;
|
||||||
// mkStaticSite blazestar
|
dir = "dist";
|
||||||
// (
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
);
|
// mkStaticSite { host = havenisms; }
|
||||||
|
// mkStaticSite { host = blazestar; };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,6 @@ let
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# [ ] Make sure the hook can operate on that directory
|
|
||||||
# [ ] Run the build command
|
|
||||||
|
|
||||||
sops.secrets = {
|
sops.secrets = {
|
||||||
"deploy-key/terakoda.com" = {
|
"deploy-key/terakoda.com" = {
|
||||||
restartUnits = [ "webhook.service" ];
|
restartUnits = [ "webhook.service" ];
|
||||||
@@ -54,22 +51,40 @@ in
|
|||||||
port = 9000;
|
port = 9000;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
hooks = {
|
hooks = {
|
||||||
"deploy-www2-terakoda-com" = {
|
"deploy-terakoda-com" = {
|
||||||
id = "deploy-www2-terakoda-com";
|
id = "deploy-terakoda-com";
|
||||||
http-methods = [ "POST" ];
|
http-methods = [ "POST" ];
|
||||||
command-working-directory = "/tank/web/www2.terakoda.com";
|
command-working-directory = "/tank/web/terakoda.com";
|
||||||
include-command-output-in-response = true;
|
|
||||||
include-command-output-in-response-on-error = true;
|
include-command-output-in-response-on-error = true;
|
||||||
execute-command = "${testHook}/bin/deploy-astro-app";
|
execute-command = "${testHook}/bin/deploy-astro-app";
|
||||||
|
trigger-rule-mismatch-http-response-code = 400;
|
||||||
trigger-rule = {
|
trigger-rule = {
|
||||||
|
or = [
|
||||||
|
# There were some issues getting the payload signature validation to work.
|
||||||
|
# Switching to only accepting requests from internal IPs.
|
||||||
|
# {
|
||||||
|
# match = {
|
||||||
|
# type = "payload-hmac-sha1";
|
||||||
|
# secret = "mysecret";
|
||||||
|
# parameter = {
|
||||||
|
# source = "header";
|
||||||
|
# name = "X-Hub-Signature";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# }
|
||||||
|
{
|
||||||
match = {
|
match = {
|
||||||
type = "payload-mac-sha256";
|
type = "ip-whitelist";
|
||||||
secret = "test123";
|
ip-range = "192.168.0.0/16";
|
||||||
parameter = {
|
|
||||||
source = "header";
|
|
||||||
name = "X-Hub-Signature-256";
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
match = {
|
||||||
|
type = "ip-whitelist";
|
||||||
|
ip-range = "10.88.0.0/16";
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user