Simplify boardwise systemd config.

main
Joshua Potter 2023-12-08 17:36:33 -07:00
parent 498aa3b51e
commit ec676fbfbe
2 changed files with 15 additions and 27 deletions

View File

@ -208,7 +208,7 @@
}, },
"locked": { "locked": {
"lastModified": 1, "lastModified": 1,
"narHash": "sha256-Gze86YwZxMbiW01weBEoPXyNEdAuj+hBTtT/shr/wSo=", "narHash": "sha256-12GAm+zOFk5V1yHAV/LeBvV/kLqE9Cz9WeCSEZbimxQ=",
"path": "./phobos", "path": "./phobos",
"type": "path" "type": "path"
}, },

View File

@ -38,32 +38,20 @@
''; '';
}; };
systemd = { systemd.services.boardwise = {
services.boardwise = { enable = true;
enable = true; description = "BoardWise Server";
description = "BoardWise Server"; after = [ "postgresql.service" ];
after = [ "postgresql.service" ]; requires = [ "postgresql.service" ];
requires = [ "postgresql.service" ]; serviceConfig = {
serviceConfig = { Environment = [
Environment = [ "PORT=80"
"PORT=80" "DATABASE_URL=ecto://postgres:postgres@localhost/boardwise"
"DATABASE_URL=ecto://postgres:postgres@localhost/boardwise" ];
]; EnvironmentFile = "/run/secrets/SECRET_KEY_BASE";
EnvironmentFile = "/run/secrets/SECRET_KEY_BASE"; ExecStartPre = "${boardwise.packages.${system}.app}/bin/migrate";
ExecStartPre = "${boardwise.packages.${system}.app}/bin/migrate"; ExecStart = "${boardwise.packages.${system}.app}/bin/boardwise start";
ExecStart = "${boardwise.packages.${system}.app}/bin/boardwise start"; Restart = "on-failure";
Restart = "on-failure";
};
unitConfig = {
ConditionPathExists = "/run/secrets/SECRET_KEY_BASE";
};
};
paths.SECRET_KEY_BASE = {
enable = true;
pathConfig = {
PathExists = "/run/secrets/SECRET_KEY_BASE";
Unit = "boardwise.service";
};
}; };
}; };