wip: working vm
This commit is contained in:
parent
d683e6795b
commit
af3c949181
|
@ -30,9 +30,9 @@
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
run-erpnext = pkgs.run-erpnext;
|
run-erpnext = pkgs.run-erpnext;
|
||||||
pip2nix = import "${pip2nix}/default.nix" { inherit pkgs; pythonPackages = "python310Packages"; };
|
pip2nix = import "${pip2nix}/default.nix" { inherit pkgs; pythonPackages = "python310Packages"; };
|
||||||
erpnext = pkgs.python3.pkgs.erpnext;
|
erpnext = pkgs.python3-erpnext.pkgs.erpnext;
|
||||||
bench = pkgs.python3.pkgs.bench;
|
bench = pkgs.python3-erpnext.pkgs.bench;
|
||||||
pythonPkgs = pkgs.python3.pkgs;
|
pythonPkgs = pkgs.python3-erpnext.pkgs;
|
||||||
});
|
});
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
test-vm = nixpkgs.lib.nixosSystem {
|
test-vm = nixpkgs.lib.nixosSystem {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# From https://github.com/frappe/frappe_docker/blob/main/resources/nginx-template.conf
|
# From https://github.com/frappe/frappe_docker/blob/main/resources/nginx-template.conf
|
||||||
{ writeText
|
{ writeText
|
||||||
, nginx
|
, nginx
|
||||||
|
, frappe-erpnext-assets
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
backend = "127.0.0.1:9090";
|
backend = "127.0.0.1:9090";
|
||||||
|
@ -13,11 +14,6 @@ let
|
||||||
proxy_read_timeout = "120";
|
proxy_read_timeout = "120";
|
||||||
in
|
in
|
||||||
writeText "erpnext.conf" ''
|
writeText "erpnext.conf" ''
|
||||||
events {
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
upstream backend-server {
|
upstream backend-server {
|
||||||
server ${backend} fail_timeout=0;
|
server ${backend} fail_timeout=0;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +31,7 @@ http {
|
||||||
server {
|
server {
|
||||||
listen 8081;
|
listen 8081;
|
||||||
server_name ${frappe_site_name_header};
|
server_name ${frappe_site_name_header};
|
||||||
root /tmp/erpnext/sites;
|
root ${frappe-erpnext-assets}/share/sites;
|
||||||
|
|
||||||
proxy_buffer_size 128k;
|
proxy_buffer_size 128k;
|
||||||
proxy_buffers 4 256k;
|
proxy_buffers 4 256k;
|
||||||
|
@ -133,5 +129,4 @@ http {
|
||||||
text/x-component;
|
text/x-component;
|
||||||
# text/html is always compressed by HttpGzipModule
|
# text/html is always compressed by HttpGzipModule
|
||||||
}
|
}
|
||||||
}
|
|
||||||
''
|
''
|
||||||
|
|
|
@ -110,10 +110,9 @@
|
||||||
wantedBy = [ "erpnext.service" ];
|
wantedBy = [ "erpnext.service" ];
|
||||||
partOf = [ "erpnext.service" ];
|
partOf = [ "erpnext.service" ];
|
||||||
script = ''
|
script = ''
|
||||||
cd /var/lib/erpnext
|
for subdir in apps sites config/pids logs; do
|
||||||
mkdir bench
|
mkdir -p /var/lib/erpnext/bench/$subdir
|
||||||
cd bench
|
done
|
||||||
mkdir -p apps sites config/pids logs
|
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
|
@ -124,7 +123,7 @@
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = builtins.readFile "${pkgs.erpnext-nginx-conf}";
|
appendHttpConfig = builtins.readFile "${pkgs.erpnext-nginx-conf}";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.erpnext =
|
systemd.services.erpnext =
|
||||||
|
@ -173,7 +172,7 @@
|
||||||
# Upstream initializes the DB with this command
|
# Upstream initializes the DB with this command
|
||||||
# TODO: Make this idempotent
|
# TODO: Make this idempotent
|
||||||
cd /var/lib/erpnext/bench/sites
|
cd /var/lib/erpnext/bench/sites
|
||||||
bench new-site localhost --mariadb-root-password password --admin-password admin
|
bench new-site localhost --mariadb-root-password password --admin-password admin || true
|
||||||
bench --site localhost install-app erpnext
|
bench --site localhost install-app erpnext
|
||||||
|
|
||||||
# TODO: Run these as systemd units
|
# TODO: Run these as systemd units
|
||||||
|
@ -186,7 +185,9 @@
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
BindReadOnlyPaths = [
|
BindReadOnlyPaths = [
|
||||||
"/etc/hosts:/etc/hosts"
|
"/etc/hosts:/etc/hosts"
|
||||||
|
"${pkgs.frappe-app}:${pkgs.frappe-app}"
|
||||||
"${pkgs.frappe-app}/share/apps/frappe:/var/lib/erpnext/bench/apps/frappe"
|
"${pkgs.frappe-app}/share/apps/frappe:/var/lib/erpnext/bench/apps/frappe"
|
||||||
|
"${pkgs.erpnext-app}:${pkgs.erpnext-app}"
|
||||||
"${pkgs.erpnext-app}/share/apps/erpnext:/var/lib/erpnext/bench/apps/erpnext"
|
"${pkgs.erpnext-app}/share/apps/erpnext:/var/lib/erpnext/bench/apps/erpnext"
|
||||||
"${pkgs.frappe-erpnext-assets}/share/sites/assets:/var/lib/erpnext/bench/sites/assets"
|
"${pkgs.frappe-erpnext-assets}/share/sites/assets:/var/lib/erpnext/bench/sites/assets"
|
||||||
"${appsFile}:/var/lib/erpnext/bench/sites/apps.txt"
|
"${appsFile}:/var/lib/erpnext/bench/sites/apps.txt"
|
||||||
|
|
Loading…
Reference in a new issue