Compare commits

...

2 commits

Author SHA1 Message Date
45c53ec150
Revert "switch subprocess output to logger"
This reverts commit d4860c8aed.
2025-04-12 14:36:25 +02:00
60093212d7
Revert "Reapply "log to file""
This reverts commit 1983508fb1.
2025-04-12 14:36:21 +02:00
5 changed files with 3 additions and 24 deletions

1
.gitignore vendored
View file

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

View file

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

View file

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

View file

@ -176,9 +176,6 @@ COMPRESS_PRECOMPILERS = [
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
logging_dir = env["LOGGING_DIR"]
os.makedirs(logging_dir, mode=0o700, exist_ok=True)
LOGGING = { LOGGING = {
"version": 1, "version": 1,
"disable_existing_loggers": False, "disable_existing_loggers": False,
@ -217,24 +214,15 @@ LOGGING = {
"filters": ["require_debug_false"], "filters": ["require_debug_false"],
"class": "django.utils.log.AdminEmailHandler", "class": "django.utils.log.AdminEmailHandler",
}, },
"file": {
"level": "INFO",
"class": "logging.FileHandler",
"filename": f"{logging_dir}/info.log",
},
}, },
"loggers": { "loggers": {
"": { "": {
"handlers": ["console", "file"], "handlers": ["console"],
"level": "DEBUG" if DEBUG else "INFO", "level": "DEBUG" if DEBUG else "INFO",
}, },
}, },
} }
SECONDS_PER_MINUTE = 60
DEPLOY_TIMEOUT_MINUTES = 25
DEPLOY_TIMEOUT_SECONDS = DEPLOY_TIMEOUT_MINUTES * SECONDS_PER_MINUTE
# Customization via user settings # Customization via user settings
# This must be at the end, as it must be able to override the above # This must be at the end, as it must be able to override the above
# TODO(@fricklerhandwerk): # TODO(@fricklerhandwerk):

View file

@ -1,7 +1,6 @@
from enum import Enum from enum import Enum
import json import json
from os.path import expanduser from os.path import expanduser
from subprocess import Popen, PIPE, STDOUT
import subprocess import subprocess
import logging import logging
import os import os
@ -161,11 +160,6 @@ class DeploymentStatus(ConfigurationForm):
"--auto-approve", "--auto-approve",
"-lock=false", "-lock=false",
] ]
popen = Popen(cmd, cwd=cwd, env=env, stdout=PIPE, stderr=STDOUT) deployment_result = subprocess.run(cmd, cwd=cwd, env=env)
with popen.stdout: logging.info(deployment_result)
for line in iter(popen.stdout.readline, b''):
logger.info(line.decode('utf-8').strip())
# FIXME catch subprocess.TimeoutExpired
deployment_result = popen.wait(timeout=settings.DEPLOY_TIMEOUT_SECONDS)
logger.info(f"deployment_result: {deployment_result}")
return deployment_result, deployment_params return deployment_result, deployment_params