wip: backend works. frontend still has some issues

This commit is contained in:
teutat3s 2023-05-23 02:05:33 +02:00
parent f8346df08f
commit aacdc913a2
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1
3 changed files with 35 additions and 10 deletions

View file

@ -31,6 +31,8 @@
penv = py.buildEnv.override {
extraLibs = [ py.pkgs.frappe py.pkgs.erpnext ];
};
erpnextSrc = pkgs.callPackage ./srcs/erpnext.nix {};
frappeModules = pkgs.callPackage ./node/frappe-modules.nix {};
runErpNext = pkgs.writeShellScriptBin "runErpNext" ''
export PYTHON_PATH=${penv}/${py.sitePackages}
# The upstream installer bench CLI wants mysql in its PATH
@ -39,7 +41,7 @@
hostname=localhost
tmp=/tmp/erpnext
mkdir -p $tmp/apps $tmp/sites $tmp/config/pids $tmp/logs $tmp/env/bin
mkdir -p $tmp/apps $tmp/sites $tmp/config/pids $tmp/logs/nginx $tmp/env/bin
for f in ${assets}/share/sites/*; do
ln -s "$f" "$tmp/sites/$(basename $f)"
@ -51,26 +53,28 @@
"db_port": 3306,
"db_name": "erpnext" ,
"db_password": "erpnext" ,
"redis_cache": "redis://localhost",
"redis_queue": "redis://localhost",
"redis_socketio": "redis://localhost",
"socketio_port": 6379
"redis_cache": "redis://localhost:6379?db=0",
"redis_queue": "redis://localhost:6379?db=1",
"redis_socketio": "redis://localhost:6379?db=2",
"socketio_port": 3000
}
EOF
# The upstream bench CLI installer expects this file
echo -e "erpnext\nfrappe\n" > $tmp/sites/apps.txt
cd $tmp
ln -s ${py.pkgs.erpnext}/lib/python3.10/site-packages apps/erpnext
ln -s ${py.pkgs.frappe}/lib/python3.10/site-packages apps/frappe
ln -s ${erpnextSrc} $tmp/apps/erpnext
ln -s ${frappeModules}/libexec/frappe-framework/deps/frappe-framework $tmp/apps/frappe
ln -s ${penv} $tmp/env
ln -sf ${nginx-conf} $tmp/nginx-erpnext.conf
cd $tmp
# Upstream initializes the DB with this command
${py.pkgs.bench}/bin/bench new-site localhost --mariadb-root-password password --admin-password admin
echo "Workdir: $tmp"
${pkgs.nodejs}/bin/node $tmp/apps/frappe/socketio.js &
${penv}/bin/gunicorn --chdir="$tmp/sites" --bind=0.0.0.0:9090 --threads=4 --workers=2 --worker-class=gthread --worker-tmp-dir=/dev/shm --timeout=120 --preload frappe.app:application
'';
in rec {

View file

@ -1,7 +1,7 @@
{ pkgs }:
let
backend = "localhost:9090";
socketio = "0.0.0.0:9000";
backend = "127.0.0.1:9090";
socketio = "127.0.0.1:3000";
frappe_site_name_header = "localhost";
upstream_real_ip_address = "127.0.0.1";
upstream_real_ip_header = "X-Forwarded-For";

21
node/frappe-modules.nix Normal file
View file

@ -0,0 +1,21 @@
{ mkYarnPackage
, fetchFromGitHub
, fetchYarnDeps
}:
mkYarnPackage {
pname = "frappe-modules";
version = "14.36.1";
src = import ../srcs/frappe.nix {inherit fetchFromGitHub; };
packageJSON = ../frappe-package.json;
yarnFlags = [ "--production" ];
offlineCache = fetchYarnDeps {
yarnLock = "$src/yarn.lock";
hash = "sha256-PBdMUz9gJIoQaqQYbdk+xnd8CyZPmdeyz/9WznCb4Ss=";
};
# Do not attempt generating a tarball
doDist = false;
}