Run inquisitor behind gunicorn
This commit is contained in:
parent
83deceef1b
commit
7010a2cef6
|
@ -1,16 +1,16 @@
|
||||||
{pkgs, ...}:
|
{pkgs, ...}:
|
||||||
|
|
||||||
let
|
let
|
||||||
# Import the inquisitor package
|
# Import the inquisitor package and build it
|
||||||
inquisitorSource = pkgs.fetchFromGitHub {
|
inquisitorSource = pkgs.fetchFromGitHub {
|
||||||
owner = "Jaculabilis";
|
owner = "Jaculabilis";
|
||||||
repo = "Inquisitor";
|
repo = "Inquisitor";
|
||||||
rev = "9001bd8f920cc120f38e998d63a8134969a00032";
|
rev = "4315cfa7becead61bb3c75327b12a9bba918ddb9";
|
||||||
sha256 = "0nx1dszvmn6a86jhj3c9607jqy0bmijjjz3jb3v5lsnpwwkjs5w6";
|
sha256 = "0dx18x79pfk5i92ksb7ih62q34lkrd436xjvhpc2rlwjgyr47zhn";
|
||||||
};
|
};
|
||||||
inquisitor = pkgs.callPackage inquisitorSource {};
|
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 {
|
inquisitorConfig = pkgs.writeTextFile {
|
||||||
name = "inquisitor.conf";
|
name = "inquisitor.conf";
|
||||||
text = ''
|
text = ''
|
||||||
|
@ -22,11 +22,10 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
# Create the inquisitor run script
|
# Create a run script for the server that sets up all necessary state
|
||||||
# TODO gunicorn
|
|
||||||
inquisitorRun = pkgs.writeShellScriptBin "run.sh" ''
|
inquisitorRun = pkgs.writeShellScriptBin "run.sh" ''
|
||||||
# Ensure inquisitor directories and inquisitor source folder
|
# 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/sources/
|
||||||
${pkgs.coreutils}/bin/mkdir -p /var/lib/inquisitor/cache/
|
${pkgs.coreutils}/bin/mkdir -p /var/lib/inquisitor/cache/
|
||||||
if [ ! -f /var/lib/inquisitor/data/inquisitor/state ]; then
|
if [ ! -f /var/lib/inquisitor/data/inquisitor/state ]; then
|
||||||
|
@ -35,7 +34,12 @@ let
|
||||||
|
|
||||||
# Run inquisitor
|
# Run inquisitor
|
||||||
cd /var/lib/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
|
# Create a wrapper script to let users call into inquisitor safely
|
||||||
|
|
Loading…
Reference in New Issue