1
1
Fork 0

Run inquisitor behind gunicorn

This commit is contained in:
Jaculabilis 2020-12-29 17:32:46 -08:00
parent 83deceef1b
commit 7010a2cef6
1 changed files with 12 additions and 8 deletions

View File

@ -1,16 +1,16 @@
{pkgs, ...}:
let
# Import the inquisitor package
# Import the inquisitor package and build it
inquisitorSource = pkgs.fetchFromGitHub {
owner = "Jaculabilis";
repo = "Inquisitor";
rev = "9001bd8f920cc120f38e998d63a8134969a00032";
sha256 = "0nx1dszvmn6a86jhj3c9607jqy0bmijjjz3jb3v5lsnpwwkjs5w6";
rev = "4315cfa7becead61bb3c75327b12a9bba918ddb9";
sha256 = "0dx18x79pfk5i92ksb7ih62q34lkrd436xjvhpc2rlwjgyr47zhn";
};
inquisitor = pkgs.callPackage inquisitorSource {};
# Create the inquisitor config file in the nix store
# Create the inquisitor config file in the nix store, pointing to /var/lib/
inquisitorConfig = pkgs.writeTextFile {
name = "inquisitor.conf";
text = ''
@ -22,11 +22,10 @@ let
'';
};
# Create the inquisitor run script
# TODO gunicorn
# Create a run script for the server that sets up all necessary state
inquisitorRun = pkgs.writeShellScriptBin "run.sh" ''
# Ensure inquisitor directories and inquisitor source folder
${pkgs.coreutils}/bin/mkdir -p /var/lib/inquisitor/data/inquisitor/ || exit
${pkgs.coreutils}/bin/mkdir -p /var/lib/inquisitor/data/inquisitor/
${pkgs.coreutils}/bin/mkdir -p /var/lib/inquisitor/sources/
${pkgs.coreutils}/bin/mkdir -p /var/lib/inquisitor/cache/
if [ ! -f /var/lib/inquisitor/data/inquisitor/state ]; then
@ -35,7 +34,12 @@ let
# Run inquisitor
cd /var/lib/inquisitor/
INQUISITOR_CONFIG=${inquisitorConfig} ${inquisitor}/bin/inquisitor run
${inquisitor}/bin/gunicorn \
--bind=localhost:24133 \
--workers=4 \
--env INQUISITOR_CONFIG=${inquisitorConfig} \
--log-level debug \
"inquisitor.app:wsgi()"
'';
# Create a wrapper script to let users call into inquisitor safely