Step 1: Minimal Foundation - Console service with Docker
- Created docker-compose.yml with Console backend service - Implemented Console backend with FastAPI (port 8011) - Added health check and status endpoints - Set up Docker-only development principle - Console service successfully running as API Gateway foundation Test with: - curl http://localhost:8011/health - curl http://localhost:8011/api/status 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
21
console/backend/Dockerfile
Normal file
21
console/backend/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements first for better caching
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application code
|
||||
COPY . .
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8000
|
||||
|
||||
# Run the application
|
||||
CMD ["python", "main.py"]
|
||||
58
console/backend/main.py
Normal file
58
console/backend/main.py
Normal file
@ -0,0 +1,58 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
import uvicorn
|
||||
from datetime import datetime
|
||||
|
||||
app = FastAPI(
|
||||
title="Console API Gateway",
|
||||
description="Central orchestrator for microservices",
|
||||
version="0.1.0"
|
||||
)
|
||||
|
||||
# CORS middleware
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {
|
||||
"message": "Console API Gateway",
|
||||
"status": "running",
|
||||
"timestamp": datetime.now().isoformat()
|
||||
}
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
return {
|
||||
"status": "healthy",
|
||||
"service": "console",
|
||||
"timestamp": datetime.now().isoformat()
|
||||
}
|
||||
|
||||
@app.get("/api/status")
|
||||
async def system_status():
|
||||
return {
|
||||
"console": "online",
|
||||
"services": {
|
||||
"users": "pending",
|
||||
"oauth": "pending",
|
||||
"images": "pending",
|
||||
"applications": "pending",
|
||||
"data": "pending",
|
||||
"statistics": "pending"
|
||||
},
|
||||
"timestamp": datetime.now().isoformat()
|
||||
}
|
||||
|
||||
if __name__ == "__main__":
|
||||
uvicorn.run(
|
||||
"main:app",
|
||||
host="0.0.0.0",
|
||||
port=8000,
|
||||
reload=True
|
||||
)
|
||||
5
console/backend/requirements.txt
Normal file
5
console/backend/requirements.txt
Normal file
@ -0,0 +1,5 @@
|
||||
fastapi==0.109.0
|
||||
uvicorn[standard]==0.27.0
|
||||
python-dotenv==1.0.0
|
||||
pydantic==2.5.3
|
||||
httpx==0.26.0
|
||||
Reference in New Issue
Block a user