LeomordKaly commited on
Commit
17d9fad
·
verified ·
1 Parent(s): 9122e54

smoke: hello-world FastAPI on port 7860

Browse files
Files changed (3) hide show
  1. Dockerfile +11 -0
  2. README.md +20 -5
  3. main.py +42 -0
Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ RUN pip install --no-cache-dir fastapi==0.115.0 uvicorn[standard]==0.32.0
6
+
7
+ COPY main.py .
8
+
9
+ EXPOSE 7860
10
+
11
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -1,10 +1,25 @@
1
  ---
2
- title: Secureagentrag Api
3
- emoji: 💻
4
- colorFrom: pink
5
- colorTo: gray
6
  sdk: docker
 
7
  pinned: false
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: SecureAgentRAG API (smoke)
3
+ emoji: 🛡️
4
+ colorFrom: blue
5
+ colorTo: indigo
6
  sdk: docker
7
+ app_port: 7860
8
  pinned: false
9
+ short_description: Phase 1 smoke test for the SecureAgentRAG production launch
10
  ---
11
 
12
+ # SecureAgentRAG API Phase 1 Smoke
13
+
14
+ Hello-world FastAPI proving HF Docker SDK build + CPU Basic free tier + port 7860 reachability from Egypt.
15
+
16
+ Real backend lands in Phase 2 — see [launch plan](https://github.com/moazmo/secureagentrag/blob/deploy/prod-launch/launch-plan/03-backend-byok.md).
17
+
18
+ ## Endpoints
19
+
20
+ - `GET /` — service info + uptime
21
+ - `GET /health` — health probe (used by the GitHub Actions keepalive cron)
22
+
23
+ ## Source
24
+
25
+ [github.com/moazmo/secureagentrag](https://github.com/moazmo/secureagentrag) — branch `deploy/prod-launch`.
main.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Hello-world FastAPI for SecureAgentRAG HF Space smoke test.
2
+
3
+ Verifies:
4
+ - HF Docker SDK builds a custom image
5
+ - Free CPU Basic (2 vCPU / 16 GB) accepts our deps
6
+ - Port 7860 reachable from public internet (Egypt origin)
7
+
8
+ This is a smoke test only. Real backend lands in Phase 2 (see
9
+ launch-plan/03-backend-byok.md).
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import os
15
+ import time
16
+
17
+ from fastapi import FastAPI
18
+
19
+ app = FastAPI(title="SecureAgentRAG API — smoke", version="0.0.1-smoke")
20
+
21
+ _BOOT_TIME = time.monotonic()
22
+
23
+
24
+ @app.get("/")
25
+ def root() -> dict[str, object]:
26
+ return {
27
+ "service": "secureagentrag-api",
28
+ "phase": "1-smoke",
29
+ "ok": True,
30
+ "uptime_seconds": round(time.monotonic() - _BOOT_TIME, 2),
31
+ }
32
+
33
+
34
+ @app.get("/health")
35
+ def health() -> dict[str, object]:
36
+ return {
37
+ "status": "ok",
38
+ "service": "secureagentrag-api",
39
+ "phase": "1-smoke",
40
+ "python": os.environ.get("PYTHON_VERSION", "unknown"),
41
+ "uptime_seconds": round(time.monotonic() - _BOOT_TIME, 2),
42
+ }