2024-04-12 17:13:15 +00:00
|
|
|
{ system, pkgs, lib, ... }:
|
|
|
|
let
|
2024-04-12 18:25:35 +00:00
|
|
|
reconn = (
|
2024-05-16 19:09:50 +00:00
|
|
|
builtins.getFlake "git+ssh://forgejo@git.jrpotter.com/r/reconn?rev=efeb24bde94b1a1f3c0d8a8c96bb6d32eb944d05"
|
2024-04-12 18:25:35 +00:00
|
|
|
).packages.${system}.app;
|
2024-04-12 17:13:15 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
services = {
|
2024-04-12 20:10:56 +00:00
|
|
|
nginx = {
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
|
|
|
|
virtualHosts."www.hideandseek.live" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
serverAliases = [ "hideandseek.live" ];
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:4000";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
2024-04-12 17:13:15 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
postgresql = {
|
|
|
|
package = (pkgs.postgresql_15.withPackages (pkgs: [ pkgs.postgis ]));
|
|
|
|
ensureDatabases = [ "reconn" ];
|
|
|
|
authentication = lib.mkOverride 10 ''
|
|
|
|
# TYPE DATABASE USER ADDRESS METHOD
|
|
|
|
local all all trust
|
|
|
|
host all all 127.0.0.1/32 trust
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.reconn = {
|
|
|
|
enable = true;
|
|
|
|
description = "Reconn Server";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "network.target" "postgresql.service" ];
|
|
|
|
requires = [ "network-online.target" "postgresql.service" ];
|
|
|
|
environment = {
|
2024-04-12 20:50:17 +00:00
|
|
|
PHX_HOST = "hideandseek.live";
|
2024-04-12 17:13:15 +00:00
|
|
|
DATABASE_URL = "ecto://postgres:postgres@localhost/reconn";
|
|
|
|
};
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "exec";
|
|
|
|
EnvironmentFile = "/run/secrets/RECONN_SECRET_KEY_BASE";
|
|
|
|
ExecStartPre = "${reconn}/bin/migrate";
|
2024-04-12 19:30:06 +00:00
|
|
|
ExecStart = "${reconn}/bin/server start";
|
|
|
|
ExecStop = "${reconn}/bin/server stop";
|
|
|
|
ExecReload = "${reconn}/bin/server restart";
|
2024-04-12 17:13:15 +00:00
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
sops = {
|
|
|
|
secrets.RECONN_SECRET_KEY_BASE = {
|
|
|
|
sopsFile = ./secrets.yaml;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|