switch to cap based home configs
This commit is contained in:
parent
50ee9aac83
commit
49b6f5bde0
64 changed files with 2064 additions and 1779 deletions
|
|
@ -1,80 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
flakes,
|
||||
...
|
||||
}:
|
||||
let
|
||||
mifg-config = api-url: api-port: public-url: service-name: {
|
||||
nginx = {
|
||||
virtualHosts."${api-url}" = {
|
||||
forceSSL = true;
|
||||
http2 = true;
|
||||
enableACME = true;
|
||||
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString api-port}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
virtualHosts."${public-url}" = {
|
||||
forceSSL = true;
|
||||
http2 = true;
|
||||
enableACME = true;
|
||||
|
||||
locations."/" = {
|
||||
root = flakes.mifg.packages.${pkgs.system}.frontend.override {
|
||||
api_base_url = "https://${api-url}";
|
||||
};
|
||||
tryFiles = "$uri $uri/ /index.html";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
service = {
|
||||
description = "money is fckn gay";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
|
||||
restartIfChanged = true;
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${flakes.mifg.packages.${pkgs.system}.backend}/bin/mifg-backend";
|
||||
Restart = "always";
|
||||
# EnvironmentFile = "/run/secrets/reviewqueue";
|
||||
StateDirectory = "${service-name}";
|
||||
};
|
||||
|
||||
environment = {
|
||||
MIFG_DATABASE_LOCATION = "/var/lib/${service-name}/db.sqlite";
|
||||
MIFG_FRONTEND_ORIGIN = "https://${public-url}";
|
||||
MIFG_PORT = toString api-port;
|
||||
};
|
||||
};
|
||||
};
|
||||
real = (mifg-config "api.money.is.fckn.gay" 11009 "money.is.fckn.gay" "money");
|
||||
staging = (mifg-config "api.money-staging.donsz.nl" 11010 "money-staging.donsz.nl" "money-staging");
|
||||
lib = pkgs.lib;
|
||||
in
|
||||
{
|
||||
services.nginx = lib.mkMerge [
|
||||
real.nginx
|
||||
staging.nginx
|
||||
];
|
||||
systemd.services.money = real.service;
|
||||
systemd.services.money-staging = lib.mkMerge [
|
||||
staging.service
|
||||
{
|
||||
serviceConfig.ExecStartPre = "${(pkgs.writeShellScriptBin "setup-staging" ''
|
||||
REAL_DB_LOCATION="/var/lib/money/"
|
||||
STAGING_DB_LOCATION="/var/lib/money-staging/"
|
||||
|
||||
echo "$REAL_DB_LOCATION"
|
||||
echo "$STAGING_DB_LOCATION"
|
||||
|
||||
mkdir -p $STAGING_DB_LOCATION
|
||||
cp -r $REAL_DB_LOCATION/* $STAGING_DB_LOCATION
|
||||
'')}/bin/setup-staging";
|
||||
}
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue