Skip to content

Commit 1cc54dd

Browse files
committed
idk
1 parent f99859c commit 1cc54dd

File tree

5 files changed

+32
-12
lines changed

5 files changed

+32
-12
lines changed

.vscode/launch.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
{
2+
"version": "0.2.0",
23
"configurations": [
34
{
4-
"name": "Python Debugger: Module",
5+
"name": "Python: Attach to Docker",
56
"type": "debugpy",
6-
"request": "launch",
7-
"module": "uvicorn",
8-
"args": ["server.main:app", "--host", "0.0.0.0", "--port", "8000"],
9-
"cwd": "${workspaceFolder}/src"
7+
"request": "attach",
8+
"connect": {
9+
"host": "localhost",
10+
"port": 5678
11+
},
12+
"pathMappings": [
13+
{
14+
"localRoot": "${workspaceFolder}/src",
15+
"remoteRoot": "/app"
16+
}
17+
]
1018
}
1119
]
1220
}

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ COPY src/ ./src/
1313

1414
RUN set -eux; \
1515
pip install --no-cache-dir --upgrade pip; \
16-
pip install --no-cache-dir --timeout 1000 .[server]
16+
pip install --no-cache-dir --timeout 1000 .[server]; \
17+
pip install --no-cache-dir debugpy
1718

1819
# Stage 2: Runtime image
1920
FROM python:3.13.5-slim@sha256:4c2cf9917bd1cbacc5e9b07320025bdb7cdf2df7b0ceaccb55e9dd7e30987419

compose.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,17 @@ services:
5454
- S3_BUCKET_NAME=${S3_BUCKET_NAME:-gitingest-bucket}
5555
- S3_REGION=${S3_REGION:-us-east-1}
5656
# Public URL for S3 resources
57-
- S3_ALIAS_HOST=${S3_ALIAS_HOST:-http://127.0.0.1:9000/${S3_BUCKET_NAME:-gitingest-bucket}}
57+
- S3_ALIAS_HOST=https://d3pi02tcpwm9y3.cloudfront.net
5858
volumes:
5959
# Mount source code for live development
6060
- ./src:/app:ro
61-
# Use --reload flag for hot reloading during development
62-
command: ["python", "-m", "uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
61+
# Expose debugpy port for remote debugging
62+
ports:
63+
- "5678:5678"
64+
- "${APP_WEB_BIND:-8000}:8000"
65+
- "${GITINGEST_METRICS_HOST:-127.0.0.1}:${GITINGEST_METRICS_PORT:-9090}:9090"
66+
# Start with debugpy for remote attach
67+
command: ["python", "-m", "debugpy", "--listen", "0.0.0.0:5678", "-m", "uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
6368
depends_on:
6469
minio-setup:
6570
condition: service_completed_successfully

src/server/routers/ingest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919

2020
router = APIRouter()
2121

22+
# Configure basic logging
23+
logging.basicConfig(
24+
level=logging.INFO,
25+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
26+
datefmt="%Y-%m-%d %H:%M:%S",
27+
)
2228

2329
@router.post("/api/ingest", responses=COMMON_INGEST_RESPONSES)
2430
@limiter.limit("10/minute")
@@ -95,7 +101,6 @@ async def api_ingest_get(
95101
return response
96102

97103

98-
logger = logging.getLogger(__name__)
99104

100105
@router.get("/api/download/file/{ingest_id}", response_model=None)
101106
async def download_ingest(
@@ -122,6 +127,7 @@ async def download_ingest(
122127
- **HTTPException**: **403** - the process lacks permission to read the directory or file
123128
124129
"""
130+
logger = logging.getLogger(__name__)
125131
# Check if S3 is enabled and file exists in S3
126132
logger.info(f"Checking if S3 is enabled and file exists in S3 for ingest ID: {ingest_id}")
127133
if is_s3_enabled():
@@ -145,7 +151,7 @@ async def download_ingest(
145151
except StopIteration as exc:
146152
raise HTTPException(
147153
status_code=status.HTTP_404_NOT_FOUND,
148-
detail=f"No .txt file found for digest {ingest_id!r}",
154+
detail=f"No .txt file found for digest {ingest_id!r}, s3_enabled: {is_s3_enabled()}"
149155
) from exc
150156

151157
try:

src/server/s3_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class S3UploadError(Exception):
2525

2626
def is_s3_enabled() -> bool:
2727
"""Check if S3 is enabled via environment variables."""
28-
return os.getenv("S3_ENABLED", "false").lower() == "true"
2928

29+
return os.getenv("S3_ENABLED", "false").lower() == "true"
3030

3131
def get_s3_config() -> dict[str, str | None]:
3232
"""Get S3 configuration from environment variables."""

0 commit comments

Comments
 (0)