Compare commits

...

13 Commits

Author SHA1 Message Date
cal
6972cbe610 Merge pull request 'feat: expose running CalVer version via API (#126)' (#127) from issue/126-feat-expose-running-calver-version-via-api into main
Reviewed-on: #127
2026-04-10 15:54:13 +00:00
Cal Corum
4acf7b2afa feat: expose running CalVer version via API (#126)
Closes #126

- Dockerfile: ARG BUILD_VERSION=dev baked into ENV APP_VERSION + OCI label
- CI: passes BUILD_VERSION build-arg from git tag to docker build
- main.py: adds GET /health returning {"status": "ok", "version": "..."}
- Dockerfile: updates HEALTHCHECK to use /health (no SQL, lightweight)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 15:53:55 +00:00
cal
1b10933ca1 Merge pull request 'chore: remove vestigial env vars from docker-compose (#121)' (#123) from issue/121-chore-remove-vestigial-env-vars-from-docker-compos into main
Reviewed-on: #123
2026-04-10 15:53:32 +00:00
Cal Corum
99fbb3848b chore: remove vestigial env vars from docker-compose (#121)
Closes #121

WORKERS_PER_CORE, TIMEOUT, and GRACEFUL_TIMEOUT were consumed by the
old tiangolo/uvicorn-gunicorn-fastapi base image and are silently
ignored since switching to python:3.12-slim with an explicit uvicorn CMD.

Also applied the same removal to dev (ssh sba-db) and prod (ssh akamai)
docker-compose files directly. Added WEB_WORKERS=4 to prod to override
the Dockerfile default of 2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 15:53:21 +00:00
cal
18d7a8a758 Merge pull request 'chore: drop libpq-dev from Dockerfile (#118)' (#124) from issue/118-chore-drop-libpq-dev-from-dockerfile into main
Reviewed-on: #124
2026-04-10 15:52:48 +00:00
Cal Corum
c22e6072a2 chore: drop libpq-dev from Dockerfile (#118)
psycopg2-binary bundles its own libpq and does not need libpq-dev at
build time. curl is kept for the HEALTHCHECK.

Closes #118

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 13:31:34 -05:00
cal
29f9875718 Merge pull request 'fix: drop :latest tag from CI, make worker count configurable' (#116) from fix/ci-tags-and-workers into main
All checks were successful
Build Docker Image / build (push) Successful in 1m18s
2026-04-09 16:32:52 +00:00
Cal Corum
6efba473a0 fix: use exec form CMD so uvicorn receives SIGTERM as PID 1
Shell form CMD makes /bin/sh PID 1 — SIGTERM from docker stop goes to
the shell, not uvicorn, causing SIGKILL after the stop timeout instead
of graceful shutdown. Using CMD ["sh", "-c", "exec uvicorn ..."] lets
the shell expand $WEB_WORKERS then exec-replaces itself with uvicorn,
restoring correct signal delivery.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 09:01:18 -05:00
Cal Corum
0095d2a792 fix: drop :latest tag from CI, make worker count configurable
Remove :latest Docker tag to match Paper Dynasty convention — only
:version and :environment tags are pushed. Add WEB_WORKERS env var
to Dockerfile (default 2) so prod can override via docker-compose.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 08:41:47 -05:00
cal
1df1abbd7c Merge pull request 'fix: replace removed tiangolo base image with python:3.13-slim' (#115) from fix/dockerfile-base-image into main
All checks were successful
Build Docker Image / build (push) Successful in 3m36s
Reviewed-on: #115
2026-04-09 12:51:57 +00:00
Cal Corum
1187c2c99b fix: use python:3.12-slim to match pinned numpy==1.26.4 compatibility
numpy==1.26.4 has no Python 3.13 wheel and slim images have no build
toolchain, so the build would fail. python:3.12-slim matches the Python
version from the removed tiangolo base image.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 07:31:18 -05:00
Cal Corum
4bcc798082 fix: replace removed tiangolo base image with python:3.13-slim
The tiangolo/uvicorn-gunicorn-fastapi:python3.12 image was removed from
Docker Hub, breaking CI builds. Switches to official python:3.13-slim
with explicit uvicorn CMD. Fixes COPY path to match WORKDIR and adds
2 workers to replace the multi-worker gunicorn setup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 06:49:46 -05:00
cal
d8a020fe55 Merge pull request 'ci: add dev tag trigger and environment-based image tagging' (#114) from ci/dev-tag-support into main
Some checks failed
Build Docker Image / build (push) Failing after 1m25s
2026-04-09 04:47:41 +00:00
4 changed files with 21 additions and 10 deletions

View File

@ -58,7 +58,8 @@ jobs:
tags: |
manticorum67/major-domo-database:${{ steps.version.outputs.version }}
manticorum67/major-domo-database:${{ steps.version.outputs.environment }}
manticorum67/major-domo-database:latest
build-args: |
BUILD_VERSION=${{ steps.version.outputs.version }}
cache-from: type=registry,ref=manticorum67/major-domo-database:buildcache
cache-to: type=registry,ref=manticorum67/major-domo-database:buildcache,mode=max
@ -71,7 +72,6 @@ jobs:
echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY
echo "- \`manticorum67/major-domo-database:${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`manticorum67/major-domo-database:${{ steps.version.outputs.environment }}\`" >> $GITHUB_STEP_SUMMARY
echo "- \`manticorum67/major-domo-database:latest\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Build Details:**" >> $GITHUB_STEP_SUMMARY
echo "- Commit: \`${{ steps.version.outputs.sha_short }}\`" >> $GITHUB_STEP_SUMMARY

View File

@ -1,16 +1,21 @@
# Use specific version for reproducible builds
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.12
# Use official Python slim image
FROM python:3.12-slim
# Build-time version arg — passed by CI from the git tag
ARG BUILD_VERSION=dev
LABEL org.opencontainers.image.version=$BUILD_VERSION
# Set Python optimizations
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PIP_NO_CACHE_DIR=1
# Bake the CalVer version into the image so it's readable at runtime
ENV APP_VERSION=$BUILD_VERSION
WORKDIR /usr/src/app
# Install system dependencies (PostgreSQL client libraries)
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
@ -20,11 +25,15 @@ RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY ./app /app/app
COPY ./app /usr/src/app/app
# Create directories for volumes
RUN mkdir -p /usr/src/app/storage
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD curl -f http://localhost:80/api/v3/current || exit 1
CMD curl -f http://localhost:80/health || exit 1
# Start uvicorn
ENV WEB_WORKERS=2
CMD ["sh", "-c", "exec uvicorn app.main:app --host 0.0.0.0 --port 80 --workers $WEB_WORKERS"]

View File

@ -139,6 +139,11 @@ app.include_router(views.router)
logger.info(f"Loaded all routers.")
@app.get("/health")
async def health():
return {"status": "ok", "version": os.environ.get("APP_VERSION", "dev")}
@app.get("/api/docs", include_in_schema=False)
async def get_docs(req: Request):
logger.debug(req.scope)

View File

@ -23,9 +23,6 @@ services:
- LOG_LEVEL=${LOG_LEVEL}
- API_TOKEN=${API_TOKEN}
- TZ=${TZ}
- WORKERS_PER_CORE=1.5
- TIMEOUT=120
- GRACEFUL_TIMEOUT=120
- DATABASE_TYPE=postgresql
- POSTGRES_HOST=sba_postgres
- POSTGRES_DB=${SBA_DATABASE}