Перенесены секреты из .env в SM

This commit is contained in:
mi
2026-07-30 19:22:48 +03:00
parent 049c45db5c
commit e24ed9d8ef
58 changed files with 3350 additions and 1054 deletions
@@ -6,7 +6,9 @@ COPY app ./app
COPY alembic ./alembic
COPY alembic.ini pyproject.toml ./
RUN pip install --no-cache-dir .
COPY --chmod=0555 container-entrypoint.sh /usr/local/bin/han-container-entrypoint
USER app
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/live', timeout=2)"
ENTRYPOINT ["/usr/local/bin/han-container-entrypoint"]
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
@@ -766,7 +766,7 @@ def create_app(settings: Settings | None = None) -> FastAPI:
timeout=cfg.bitrix_http_timeout_sec,
)
except Exception as exc:
logger.exception(
logger.error(
"outbound delivery failed",
extra={
"request_id": request.state.request_id,
@@ -1153,8 +1153,11 @@ async def worker_loop(app: FastAPI, kind: str) -> None:
await process_outbound(app)
else:
await process_setup(app)
except Exception:
logger.exception("worker iteration failed", extra={"worker_kind": kind})
except Exception as exc:
logger.error(
"worker iteration failed",
extra={"worker_kind": kind, "error_type": type(exc).__name__},
)
try:
await asyncio.wait_for(app.state.stop.wait(), app.state.settings.bitrix_worker_poll_sec)
except TimeoutError:
@@ -1197,7 +1200,7 @@ async def process_inbox(app: FastAPI) -> None:
)
await session.commit()
except Exception as exc:
logger.exception(
logger.error(
"inbound forward failed",
extra={
"inbox_id": str(row.id),
@@ -1275,7 +1278,7 @@ async def process_outbound(app: FastAPI) -> None:
timeout=app.state.settings.bitrix_http_timeout_sec,
)
except Exception as exc:
logger.exception(
logger.error(
"outbound retry failed",
extra={
"outbound_id": str(row.id),
@@ -0,0 +1,23 @@
#!/bin/sh
set -eu
for name in ${HAN_SECRET_VARS:-}; do
case "$name" in
""|[0-9]*|*[!A-Z0-9_]*)
echo "container secrets: invalid variable name" >&2
exit 64
;;
*) ;;
esac
eval "file=\${${name}_FILE:-}"
if [ -z "$file" ] || [ ! -r "$file" ]; then
echo "container secrets: missing file for $name" >&2
exit 66
fi
value=$(cat "$file")
export "$name=$value"
unset "${name}_FILE"
done
unset HAN_SECRET_VARS
exec "$@"