1
0
Fork 0

minimum setup i got working for deployment

This commit is contained in:
kiara Grouwstra 2025-02-27 09:07:13 +01:00
parent 1d4004ccf4
commit f828afd5d5
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
2 changed files with 19 additions and 4 deletions
infra/machines/fedi201
panel/nix

View file

@ -29,7 +29,7 @@ in
secrets = { secrets = {
SECRET_KEY = config.age.secrets.panel-secret-key.path; SECRET_KEY = config.age.secrets.panel-secret-key.path;
}; };
port = 80; port = 8000;
settings = { settings = {
DATABASE_URL = "sqlite:///var/lib/${name}/db.sqlite3"; DATABASE_URL = "sqlite:///var/lib/${name}/db.sqlite3";
CREDENTIALS_DIRECTORY = "/var/lib/${name}/.credentials"; CREDENTIALS_DIRECTORY = "/var/lib/${name}/.credentials";

View file

@ -26,10 +26,19 @@ let
database-url = "sqlite:////var/lib/${name}/db.sqlite3"; database-url = "sqlite:////var/lib/${name}/db.sqlite3";
python-environment = pkgs.python3.withPackages ( python-environment = pkgs.python3.withPackages (
ps: with ps; [ ps:
cfg.package with ps;
[
uvicorn uvicorn
cfg.package
dj-database-url
django-compressor
django-debug-toolbar
django-libsass
django_4
setuptools
] ]
++ cfg.package.propagatedBuildInputs
); );
configFile = pkgs.concatText "configuration.py" [ configFile = pkgs.concatText "configuration.py" [
@ -180,7 +189,8 @@ in
fi fi
''; '';
script = '' script = ''
uvicorn ${name}.asgi:application --host ${cfg.host} --port ${toString cfg.port} export PYTHONPATH=$PYTHONPATH:${cfg.package}/lib/python3.12/site-packages
${python-environment}/bin/python -m uvicorn ${name}.asgi:application --host ${cfg.host} --port ${toString cfg.port}
''; '';
serviceConfig = { serviceConfig = {
Restart = "always"; Restart = "always";
@ -195,5 +205,10 @@ in
DATABASE_URL = database-url; DATABASE_URL = database-url;
}; };
}; };
networking.firewall.allowedTCPPorts = [
80
443
];
}; };
} }