Fix prod startup: add start.sh for backend, fix documents proxy base route
- backend/Dockerfile: run migrations via start.sh before uvicorn instead of launching uvicorn directly (prod was skipping Alembic) - backend/scripts/start.sh: alembic upgrade head + uvicorn exec - documents_proxy.py: add explicit "" route so GET /api/documents (no trailing slash) returns 200 instead of 307 redirect - README.md: update Containers table, volumes section, and Current State to reflect the new 4-container architecture with doc-service Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -24,9 +24,11 @@ COPY --from=builder /install /usr/local
|
||||
COPY --chown=appuser:appuser app ./app
|
||||
COPY --chown=appuser:appuser alembic ./alembic
|
||||
COPY --chown=appuser:appuser alembic.ini .
|
||||
COPY --chown=appuser:appuser scripts ./scripts
|
||||
RUN chmod +x scripts/start.sh
|
||||
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
CMD ["sh", "scripts/start.sh"]
|
||||
|
||||
@@ -46,11 +46,12 @@ def _forward_headers(request: Request, user_id: str) -> dict:
|
||||
return headers
|
||||
|
||||
|
||||
@router.api_route("", methods=["GET", "POST"])
|
||||
@router.api_route("/{path:path}", methods=["GET", "POST", "PUT", "PATCH", "DELETE"])
|
||||
async def proxy_documents(
|
||||
path: str,
|
||||
request: Request,
|
||||
current_user: User = Depends(get_current_user),
|
||||
path: str = "",
|
||||
) -> StreamingResponse:
|
||||
url = f"/documents/{path}" if path else "/documents"
|
||||
headers = _forward_headers(request, str(current_user.id))
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "[start] running migrations..."
|
||||
alembic upgrade head
|
||||
|
||||
echo "[start] starting uvicorn..."
|
||||
exec uvicorn app.main:app --host 0.0.0.0 --port 8000
|
||||
Reference in New Issue
Block a user