Compare commits
No commits in common. "48cb3982a24e7ecbe6b518e51939df31d83d2982" and "7284eed463176446618c3c3c658174873d5242dd" have entirely different histories.
48cb3982a2
...
7284eed463
3 changed files with 2 additions and 91 deletions
|
|
@ -1,77 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
frontendConfig = config.services.rabbi-gerzi.frontend;
|
|
||||||
backendConfig = config.services.rabbi-gerzi.backend;
|
|
||||||
frontendVirtualHost = config.services.nginx.virtualHosts.${frontendConfig.hostName};
|
|
||||||
backendVirtualHost = config.services.nginx.virtualHosts.${backendConfig.hostName};
|
|
||||||
redirectVirtualHost = lib.attrByPath [
|
|
||||||
"www.rabbigerzi.com"
|
|
||||||
] { } config.services.nginx.virtualHosts;
|
|
||||||
|
|
||||||
assertions = [
|
|
||||||
{
|
|
||||||
assertion = frontendConfig.hostName == "rabbigerzi.com";
|
|
||||||
message = "Rabbi Gerzi frontend does not use the production domain";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = frontendConfig.apiBaseUrl == "https://api.rabbigerzi.com";
|
|
||||||
message = "Rabbi Gerzi frontend does not use the production API";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = frontendConfig.redirectHostNames == [ "www.rabbigerzi.com" ];
|
|
||||||
message = "Rabbi Gerzi frontend redirect hosts are not configured";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = backendConfig.hostName == "api.rabbigerzi.com";
|
|
||||||
message = "Rabbi Gerzi backend does not use the production API domain";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion =
|
|
||||||
backendConfig.corsAllowedOrigins == [
|
|
||||||
"https://rabbigerzi.com"
|
|
||||||
"https://rabbigerzi.yisroelbaum.com"
|
|
||||||
];
|
|
||||||
message = "Rabbi Gerzi CORS origins do not cover production and staging";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = builtins.elem "rabbigerzi.yisroelbaum.com" frontendVirtualHost.serverAliases;
|
|
||||||
message = "Rabbi Gerzi frontend staging alias is missing";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = builtins.elem "rabbigerziapi.yisroelbaum.com" backendVirtualHost.serverAliases;
|
|
||||||
message = "Rabbi Gerzi backend staging alias is missing";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = redirectVirtualHost.globalRedirect or null == "rabbigerzi.com";
|
|
||||||
message = "Rabbi Gerzi www host does not redirect to the apex";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = redirectVirtualHost.forceSSL or false;
|
|
||||||
message = "Rabbi Gerzi www redirect does not force HTTPS";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
assertion = redirectVirtualHost.enableACME or false;
|
|
||||||
message = "Rabbi Gerzi www redirect does not enable ACME";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
failedAssertions = lib.filter (assertion: !assertion.assertion) assertions;
|
|
||||||
in
|
|
||||||
pkgs.runCommand "rabbi-gerzi-production-domains"
|
|
||||||
{
|
|
||||||
failures = lib.concatMapStringsSep "\n" (assertion: assertion.message) failedAssertions;
|
|
||||||
preferLocalBuild = true;
|
|
||||||
}
|
|
||||||
''
|
|
||||||
if [ -n "$failures" ]; then
|
|
||||||
printf '%s\n' "$failures" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
touch $out
|
|
||||||
''
|
|
||||||
|
|
@ -59,11 +59,6 @@
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
checks."${system}".rabbi-gerzi-domains = import ./checks/rabbi-gerzi-domains.nix {
|
|
||||||
config = self.nixosConfigurations.nixos.config;
|
|
||||||
inherit (nixpkgs) lib;
|
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
|
||||||
};
|
|
||||||
devShells."${system}".default =
|
devShells."${system}".default =
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
|
|
||||||
|
|
@ -10,25 +10,18 @@
|
||||||
borgPrivateKey = config.sops.secrets."borg-private-key".path;
|
borgPrivateKey = config.sops.secrets."borg-private-key".path;
|
||||||
};
|
};
|
||||||
frontend = {
|
frontend = {
|
||||||
hostName = "rabbigerzi.com";
|
hostName = "rabbigerzi.yisroelbaum.com";
|
||||||
redirectHostNames = [ "www.rabbigerzi.com" ];
|
|
||||||
nginx = {
|
nginx = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
serverAliases = [ "rabbigerzi.yisroelbaum.com" ];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
backend = {
|
backend = {
|
||||||
hostName = "api.rabbigerzi.com";
|
hostName = "rabbigerziapi.yisroelbaum.com";
|
||||||
environmentFile = config.sops.secrets."rabbi-gerzi-env".path;
|
environmentFile = config.sops.secrets."rabbi-gerzi-env".path;
|
||||||
corsAllowedOrigins = [
|
|
||||||
"https://rabbigerzi.com"
|
|
||||||
"https://rabbigerzi.yisroelbaum.com"
|
|
||||||
];
|
|
||||||
nginx = {
|
nginx = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
serverAliases = [ "rabbigerziapi.yisroelbaum.com" ];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue