refactor: move app.py and excluded_containers.json to app/ directory
This commit is contained in:
parent
c925e4920a
commit
1e6149107d
@ -6,7 +6,8 @@ WORKDIR /app
|
|||||||
COPY requirements.txt /app/requirements.txt
|
COPY requirements.txt /app/requirements.txt
|
||||||
RUN pip install --no-cache-dir -r 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/templates /app/templates
|
||||||
COPY ./app/static /app/static
|
COPY ./app/static /app/static
|
||||||
|
|
||||||
|
@ -332,17 +332,17 @@ def load_excluded_containers() -> List[str]:
|
|||||||
Сайт: https://devops.org.ru
|
Сайт: https://devops.org.ru
|
||||||
"""
|
"""
|
||||||
try:
|
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)
|
data = json.load(f)
|
||||||
return data.get("excluded_containers", [])
|
return data.get("excluded_containers", [])
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print("⚠️ Файл excluded_containers.json не найден, используем пустой список")
|
print("⚠️ Файл app/excluded_containers.json не найден, используем пустой список")
|
||||||
return []
|
return []
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
print(f"❌ Ошибка парсинга excluded_containers.json: {e}")
|
print(f"❌ Ошибка парсинга app/excluded_containers.json: {e}")
|
||||||
return []
|
return []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"❌ Ошибка загрузки excluded_containers.json: {e}")
|
print(f"❌ Ошибка загрузки app/excluded_containers.json: {e}")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def save_excluded_containers(containers: List[str]) -> bool:
|
def save_excluded_containers(containers: List[str]) -> bool:
|
||||||
@ -356,11 +356,11 @@ def save_excluded_containers(containers: List[str]) -> bool:
|
|||||||
"excluded_containers": containers,
|
"excluded_containers": containers,
|
||||||
"description": "Список контейнеров, которые генерируют слишком много логов и исключаются из отображения"
|
"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)
|
json.dump(data, f, indent=2, ensure_ascii=False)
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"❌ Ошибка сохранения excluded_containers.json: {e}")
|
print(f"❌ Ошибка сохранения app/excluded_containers.json: {e}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_all_projects() -> List[str]:
|
def get_all_projects() -> List[str]:
|
4
start.sh
4
start.sh
@ -20,7 +20,7 @@ if [ "$DEBUG_MODE" = "true" ]; then
|
|||||||
echo "Swagger UI: http://0.0.0.0:$LOGBOARD_PORT/docs"
|
echo "Swagger UI: http://0.0.0.0:$LOGBOARD_PORT/docs"
|
||||||
echo "ReDoc: http://0.0.0.0:$LOGBOARD_PORT/redoc"
|
echo "ReDoc: http://0.0.0.0:$LOGBOARD_PORT/redoc"
|
||||||
|
|
||||||
exec uvicorn app:app \
|
exec uvicorn app.app:app \
|
||||||
--host 0.0.0.0 \
|
--host 0.0.0.0 \
|
||||||
--port $LOGBOARD_PORT \
|
--port $LOGBOARD_PORT \
|
||||||
--reload \
|
--reload \
|
||||||
@ -28,7 +28,7 @@ if [ "$DEBUG_MODE" = "true" ]; then
|
|||||||
else
|
else
|
||||||
echo "Starting in PRODUCTION mode..."
|
echo "Starting in PRODUCTION mode..."
|
||||||
|
|
||||||
exec uvicorn app:app \
|
exec uvicorn app.app:app \
|
||||||
--host 0.0.0.0 \
|
--host 0.0.0.0 \
|
||||||
--port $LOGBOARD_PORT \
|
--port $LOGBOARD_PORT \
|
||||||
--log-level info
|
--log-level info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user