Add fieldseeker webserver

This commit is contained in:
Eli Ribble 2025-08-20 23:58:18 +00:00
parent 1f0173ab1a
commit 3f509cc124
2 changed files with 26 additions and 4 deletions

View file

@ -2,5 +2,6 @@
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
myModules.caddy.enable = true;
myModules.fieldseeker-sync.enable = true; myModules.fieldseeker-sync.enable = true;
} }

View file

@ -14,6 +14,9 @@ in {
environment.systemPackages = [ environment.systemPackages = [
src src
]; ];
services.caddy.virtualHosts."deltamvcd.nidus.cloud".extraConfig = ''
reverse_proxy http://127.0.0.1:3000
'';
services.postgresql = { services.postgresql = {
enable = true; enable = true;
ensureDatabases = [ "fieldseeker-sync" ]; ensureDatabases = [ "fieldseeker-sync" ];
@ -31,10 +34,12 @@ in {
restartUnits = ["fieldseeker-sync.service"]; restartUnits = ["fieldseeker-sync.service"];
sopsFile = ../../secrets/fieldseeker-sync.env; sopsFile = ../../secrets/fieldseeker-sync.env;
}; };
systemd.services.fieldseeker-sync = { systemd.services.fieldseeker-sync-export = {
after=["network.target" "network-online.target"]; after=["network.target" "network-online.target"];
description="FieldSeeker sync"; description="FieldSeeker sync periodic sync tool";
requires=["network-online.target"]; requires=["network-online.target"];
restartIfChanged = false;
stopIfChanged = false;
serviceConfig = { serviceConfig = {
EnvironmentFile="/var/run/secrets/fieldseeker-sync-env"; EnvironmentFile="/var/run/secrets/fieldseeker-sync-env";
Type = "oneshot"; Type = "oneshot";
@ -47,12 +52,28 @@ in {
}; };
wantedBy = ["multi-user.target"]; wantedBy = ["multi-user.target"];
}; };
systemd.timers.fieldseeker-sync = { systemd.services.fieldseeker-sync-webserver = {
after=["network.target" "network-online.target"];
description="FieldSeeker sync";
requires=["network-online.target"];
serviceConfig = {
EnvironmentFile="/var/run/secrets/fieldseeker-sync-env";
Type = "simple";
User = "fieldseeker-sync";
Group = "fieldseeker-sync";
ExecStart = "${src}/bin/webserver";
TimeoutStopSec = "5s";
PrivateTmp = true;
WorkingDirectory = "/tmp";
};
wantedBy = ["multi-user.target"];
};
systemd.timers.fieldseeker-sync-export = {
wantedBy = ["timers.target"]; wantedBy = ["timers.target"];
timerConfig = { timerConfig = {
OnBootSec = "15m"; OnBootSec = "15m";
OnUnitActiveSec = "15m"; OnUnitActiveSec = "15m";
Unit = "fieldseeker-sync.service"; Unit = "fieldseeker-sync-export.service";
}; };
}; };
users.groups.fieldseeker-sync = {}; users.groups.fieldseeker-sync = {};