Реализовать лабораторную 2 на оценку 4
PostgreSQL как источник истины, непрозрачные сессии в Redis с TTL и AOF, миграции под advisory lock, пул и таймауты, проверки гонки/отката/отказов и отчёт с evidence.
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
# Runtime image for the lab2 API. The base tag is pinned; dependencies are
|
||||
# installed from requirements.txt, never from a mutable latest tag.
|
||||
|
||||
FROM python:3.12.7-slim-bookworm
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN groupadd --system --gid 10001 app \
|
||||
&& useradd --system --uid 10001 --gid app --home-dir /app --shell /usr/sbin/nologin app
|
||||
|
||||
COPY requirements.txt ./
|
||||
RUN python -m pip install --requirement requirements.txt
|
||||
|
||||
COPY app ./app
|
||||
COPY migrations ./migrations
|
||||
COPY student-tests ./student-tests
|
||||
|
||||
USER app
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=20s --retries=6 \
|
||||
CMD ["python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2).read()"]
|
||||
|
||||
# One process with a bounded thread pool is enough for lab2. The database
|
||||
# pool itself fixes the number of PostgreSQL connections.
|
||||
CMD ["gunicorn", "--bind=0.0.0.0:8080", "--workers=1", "--threads=8", "--timeout=30", "--graceful-timeout=10", "--access-logfile=-", "--error-logfile=-", "app.main:app"]
|
||||
Reference in New Issue
Block a user