Skip to content

Commit 9bc5682

Browse files
authored
Merge pull request #500 from DefangLabs/eric/make-implicit-env-explicit
2 parents aa26cee + 7561c56 commit 9bc5682

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

samples/managed-llm-provider/app/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ EXPOSE 8000
1919
ENV PORT=8000
2020

2121
# Run the app with the correct module path using shell form to interpolate environment variable
22-
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port $PORT"]
22+
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port $PORT --no-access-log"]

samples/managed-llm-provider/app/app.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ def get_api_key():
3232
async def home():
3333
return FileResponse("static/index.html", media_type="text/html")
3434

35+
# Health check endpoint
36+
@app.get("/health")
37+
async def health():
38+
return {"status": "healthy"}
39+
3540
# Handle form submission
3641
@app.post("/ask", response_class=JSONResponse)
3742
async def ask(prompt: str = Form(...)):

samples/managed-llm-provider/compose.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ services:
99
environment:
1010
- LLM_URL=http://llm/api/v1/
1111
- LLM_MODEL=default
12+
- OPENAI_API_KEY=FAKE_TOKEN
1213
# For other models, see https://docs.defang.io/docs/concepts/managed-llms/openai-access-gateway#model-mapping
1314
healthcheck:
14-
test: ["CMD", "python3", "-c", "import sys, urllib.request; urllib.request.urlopen(sys.argv[1]).read()", "http://localhost:8000/"]
15+
test: ["CMD", "python3", "-c", "import sys, urllib.request; urllib.request.urlopen(sys.argv[1]).read()", "http://localhost:8000/health"]
1516
interval: 30s
1617
timeout: 5s
1718
retries: 3
@@ -32,6 +33,8 @@ services:
3233
options:
3334
model: ai/smollm2
3435
x-defang-llm: true
36+
environment:
37+
- OPENAI_API_KEY=FAKE_TOKEN
3538
deploy:
3639
resources:
3740
reservations:

0 commit comments

Comments
 (0)