Try out uvicorn

volumes
Inex Code 2022-07-27 16:13:42 +03:00
parent 1418ac7c55
commit db53915fc8
1 changed files with 11 additions and 1 deletions

View File

@ -31,6 +31,12 @@ in
B2 bucket B2 bucket
''; '';
}; };
package = mkOption {
type = types.package;
default = pkgs.selfprivacy-graphql-api;
defaultText = literalExpression "pkgs.selfprivacy-graphql-api";
description = "The SelfPrivacy package to use.";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -62,9 +68,13 @@ in
wantedBy = [ "network-online.target" ]; wantedBy = [ "network-online.target" ];
serviceConfig = { serviceConfig = {
User = "root"; User = "root";
ExecStart = "${pkgs.selfprivacy-api}/bin/app.py"; ExecStart = "${pkgs.python39Packages.uvicorn}/bin/uvicorn \
selfprivacy_api.app:app --host 0.0.0.0 --port 5050 --proxy-headers";
Restart = "always"; Restart = "always";
RestartSec = "5"; RestartSec = "5";
environment = {
PYTHONPATH = cfg.package.pythonPath + ":${cfg.package.out}/python3.9/site-packages/";
}
}; };
}; };
# One shot systemd service to rebuild NixOS using nixos-rebuild # One shot systemd service to rebuild NixOS using nixos-rebuild