Compare commits

..

No commits in common. "b0942bd174d5874a1fef7417587cf3c5637c6f21" and "265d79aeef256094e2be277a8e3c0ce6bfcf967d" have entirely different histories.

6 changed files with 20 additions and 5 deletions

1
.gitignore vendored
View file

@ -12,3 +12,4 @@ result*
*screenshot.png
output
todo
log/

View file

@ -1,5 +1,6 @@
{
config,
lib,
...
}:
let
@ -55,6 +56,11 @@ in
COMPRESS_OFFLINE = true;
LIBSASS_OUTPUT_STYLE = "compressed";
};
environment = {
TF_VARS = lib.strings.toJSON {
ssh_private_key_file = config.age.secrets.panel-ssh-key.path;
};
};
secrets = {
SECRET_KEY = config.age.secrets.panel-secret-key.path;
};

View file

@ -31,6 +31,7 @@ in
DATABASE_URL = "sqlite:///${toString ./src}/db.sqlite3";
# locally: use a fixed relative reference, so we can use our newest files without copying to the store
REPO_DIR = toString ../.;
LOGGING_DIR = "../log";
};
shellHook = ''
ln -sf ${sources.htmx}/dist/htmx.js src/panel/static/htmx.min.js

View file

@ -13,5 +13,5 @@
pkgs.gnugrep # used in terraform-nixos
(import ../launch/tf.nix { inherit lib pkgs; })
];
SSH_PRIVATE_KEY_FILE = "";
TF_VARS = lib.strings.toJSON { };
}

View file

@ -30,7 +30,7 @@ let
(builtins.toFile "extra-settings.py" cfg.extra-settings)
];
REPO_DIR = import ../../launch/tf-env.nix { inherit lib pkgs; };
SSH_PRIVATE_KEY_FILE = config.age.secrets.panel-ssh-key.path;
LOGGING_DIR = "/var/log/${name}";
};
python-environment = pkgs.python3.withPackages (

View file

@ -176,6 +176,9 @@ COMPRESS_PRECOMPILERS = [
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
logging_dir = env["LOGGING_DIR"]
os.makedirs(logging_dir, mode=0o700, exist_ok=True)
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
@ -210,10 +213,15 @@ LOGGING = {
"filters": ["require_debug_false"],
"class": "django.utils.log.AdminEmailHandler",
},
"file": {
"level": "INFO",
"class": "logging.FileHandler",
"filename": f"{logging_dir}/info.log",
},
},
"loggers": {
"django": {
"handlers": ["console", "mail_admins"],
"handlers": ["console", "mail_admins", "file"],
"level": "INFO",
},
"django.server": {
@ -251,6 +259,5 @@ bin_path=env['BIN_PATH']
# to deploy this should be specified, for dev just use a relative path.
repo_dir = env["REPO_DIR"]
ENV_VARS = {
"ssh_private_key_file": env["SSH_PRIVATE_KEY_FILE"],
ENV_VARS = json.loads(env["TF_VARS"]) | {
}