refactor: move app.py and excluded_containers.json to app/ directory

This commit is contained in:
Сергей Антропов 2025-08-20 15:49:17 +03:00
parent c925e4920a
commit 1e6149107d
4 changed files with 10 additions and 9 deletions

View File

@ -6,7 +6,8 @@ WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY app.py /app/app.py
COPY app/app.py /app/app.py
COPY app/excluded_containers.json /app/excluded_containers.json
COPY ./app/templates /app/templates
COPY ./app/static /app/static

View File

@ -332,17 +332,17 @@ def load_excluded_containers() -> List[str]:
Сайт: https://devops.org.ru
"""
try:
with open("excluded_containers.json", "r", encoding="utf-8") as f:
with open("app/excluded_containers.json", "r", encoding="utf-8") as f:
data = json.load(f)
return data.get("excluded_containers", [])
except FileNotFoundError:
print("⚠️ Файл excluded_containers.json не найден, используем пустой список")
print("⚠️ Файл app/excluded_containers.json не найден, используем пустой список")
return []
except json.JSONDecodeError as e:
print(f"❌ Ошибка парсинга excluded_containers.json: {e}")
print(f"❌ Ошибка парсинга app/excluded_containers.json: {e}")
return []
except Exception as e:
print(f"❌ Ошибка загрузки excluded_containers.json: {e}")
print(f"❌ Ошибка загрузки app/excluded_containers.json: {e}")
return []
def save_excluded_containers(containers: List[str]) -> bool:
@ -356,11 +356,11 @@ def save_excluded_containers(containers: List[str]) -> bool:
"excluded_containers": containers,
"description": "Список контейнеров, которые генерируют слишком много логов и исключаются из отображения"
}
with open("excluded_containers.json", "w", encoding="utf-8") as f:
with open("app/excluded_containers.json", "w", encoding="utf-8") as f:
json.dump(data, f, indent=2, ensure_ascii=False)
return True
except Exception as e:
print(f"❌ Ошибка сохранения excluded_containers.json: {e}")
print(f"❌ Ошибка сохранения app/excluded_containers.json: {e}")
return False
def get_all_projects() -> List[str]:

View File

@ -20,7 +20,7 @@ if [ "$DEBUG_MODE" = "true" ]; then
echo "Swagger UI: http://0.0.0.0:$LOGBOARD_PORT/docs"
echo "ReDoc: http://0.0.0.0:$LOGBOARD_PORT/redoc"
exec uvicorn app:app \
exec uvicorn app.app:app \
--host 0.0.0.0 \
--port $LOGBOARD_PORT \
--reload \
@ -28,7 +28,7 @@ if [ "$DEBUG_MODE" = "true" ]; then
else
echo "Starting in PRODUCTION mode..."
exec uvicorn app:app \
exec uvicorn app.app:app \
--host 0.0.0.0 \
--port $LOGBOARD_PORT \
--log-level info