Setup boardwise systemd correctly.

main
Joshua Potter 2024-04-12 12:25:35 -06:00
parent 5c6e336e39
commit dea5c06682
2 changed files with 18 additions and 11 deletions

View File

@ -1,7 +1,9 @@
{ system, pkgs, lib, ... }: { system, pkgs, lib, ... }:
let let
boardwise = builtins.getFlake boardwise = (
"github:boardwise-gg/website/0d5a66c604ba8c553d391c7461ff012d8b9c5393"; builtins.getFlake "github:boardwise-gg/website/0d5a66c604ba8c553d391c7461ff012d8b9c5393"
).packages.${system}.app;
coach-scraper = builtins.getFlake coach-scraper = builtins.getFlake
"github:boardwise-gg/coach-scraper/58815d3ae5a69cac12436a01e77019a5ac5d16a7"; "github:boardwise-gg/coach-scraper/58815d3ae5a69cac12436a01e77019a5ac5d16a7";
in in
@ -30,15 +32,19 @@ in
systemd.services.boardwise = { systemd.services.boardwise = {
enable = true; enable = true;
description = "BoardWise Server"; description = "BoardWise Server";
after = [ "postgresql.service" ]; wantedBy = [ "multi-user.target" ];
requires = [ "postgresql.service" ]; after = [ "network.target" "postgresql.service" ];
requires = [ "network-online.target" "postgresql.service" ];
environment = {
DATABASE_URL = "ecto://postgres:postgres@localhost/boardwise";
};
serviceConfig = { serviceConfig = {
Environment = [ Type = "exec";
"DATABASE_URL=ecto://postgres:postgres@localhost/boardwise"
];
EnvironmentFile = "/run/secrets/BOARDWISE_SECRET_KEY_BASE"; EnvironmentFile = "/run/secrets/BOARDWISE_SECRET_KEY_BASE";
ExecStartPre = "${boardwise.packages.${system}.app}/bin/migrate"; ExecStartPre = "${boardwise}/bin/migrate";
ExecStart = "${boardwise.packages.${system}.app}/bin/boardwise start"; ExecStart = "${boardwise}/bin/boardwise start";
ExecStop = "${boardwise}/bin/reconn stop";
ExecReload = "${boardwise}/bin/reconn restart";
Restart = "on-failure"; Restart = "on-failure";
}; };
}; };

View File

@ -1,7 +1,8 @@
{ system, pkgs, lib, ... }: { system, pkgs, lib, ... }:
let let
reconn-url = "git+https://git.jrpotter.com/r/reconn?rev=fa031b2507c625c54abca36fd3f86fc8338e8777"; reconn = (
reconn = (builtins.getFlake reconn-url).packages.${system}.app; builtins.getFlake "git+https://git.jrpotter.com/r/reconn?rev=fa031b2507c625c54abca36fd3f86fc8338e8777"
).packages.${system}.app;
in in
{ {
services = { services = {