launch adjustments
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 2m6s
Run linting on the backend code / Build (pull_request) Failing after 27s
Run testing on the backend code / Build (pull_request) Failing after 1m25s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 17s

This commit is contained in:
Remy Moll 2024-12-29 14:51:28 +01:00
parent 4e07c10969
commit 33ce291b09
2 changed files with 4 additions and 2 deletions

View File

@ -16,4 +16,4 @@ ENV OSM_CACHE_DIR=/cache
ENV MEMCACHED_HOST_PATH=none
ENV LOKI_URL=none
CMD ["fastapi", "src/main.py", "--port", "8000", "--workers", "$NUM_WORKERS"]
CMD ["fastapi", "run", "src/main.py", "--port", "8000", "--workers", "$NUM_WORKERS"]

View File

@ -15,7 +15,7 @@ def configure_logging():
is_kubernetes = os.getenv('KUBERNETES_SERVICE_HOST') is not None
if not is_kubernetes:
if is_kubernetes:
# in that case we want to log to stdout and also to loki
from loki_logger_handler.loki_logger_handler import LokiLoggerHandler
loki_url = os.getenv('LOKI_URL')
@ -31,6 +31,8 @@ def configure_logging():
logger.info(f"Logging to Loki at {loki_url} with {loki_handler.labels} and {is_debug=}")
logging_handlers = [loki_handler, logging.StreamHandler()]
logging_level = logging.DEBUG if is_debug else logging.INFO
# silence the chatty logs loki generates itself
logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
# no need for time since it's added by loki or can be shown in kube logs
logging_format = '%(name)s - %(levelname)s - %(message)s'