v0.4.0 - merge from claude/dev-015sto5mf2MpPCE57TbNKtaF #1
@@ -13,7 +13,7 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 8000
|
EXPOSE 8001
|
||||||
|
|
||||||
# Run the application
|
# Run the application using the new backend structure
|
||||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8001"]
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
container_name: seismo-fleet-manager
|
container_name: seismo-fleet-manager
|
||||||
ports:
|
ports:
|
||||||
- "8001:8000"
|
- "8001:8001"
|
||||||
volumes:
|
volumes:
|
||||||
# Persist SQLite database
|
# Persist SQLite database and photos
|
||||||
- ./data:/app/data
|
- ./data:/app/data
|
||||||
environment:
|
environment:
|
||||||
- PYTHONUNBUFFERED=1
|
- PYTHONUNBUFFERED=1
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8000/"]
|
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
|||||||
41
main.py
41
main.py
@@ -1,41 +0,0 @@
|
|||||||
from fastapi import FastAPI
|
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
|
||||||
|
|
||||||
from database import engine, Base
|
|
||||||
from routes import router
|
|
||||||
|
|
||||||
# Create database tables
|
|
||||||
Base.metadata.create_all(bind=engine)
|
|
||||||
|
|
||||||
# Initialize FastAPI app
|
|
||||||
app = FastAPI(
|
|
||||||
title="Seismo Fleet Manager",
|
|
||||||
description="Backend API for managing seismograph fleet status",
|
|
||||||
version="0.1.0"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Configure CORS (adjust origins as needed for your deployment)
|
|
||||||
app.add_middleware(
|
|
||||||
CORSMiddleware,
|
|
||||||
allow_origins=["*"], # In production, specify exact origins
|
|
||||||
allow_credentials=True,
|
|
||||||
allow_methods=["*"],
|
|
||||||
allow_headers=["*"],
|
|
||||||
)
|
|
||||||
|
|
||||||
# Include API routes
|
|
||||||
app.include_router(router)
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
|
||||||
def root():
|
|
||||||
"""Root endpoint - health check"""
|
|
||||||
return {
|
|
||||||
"message": "Seismo Fleet Manager API v0.1",
|
|
||||||
"status": "running"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
import uvicorn
|
|
||||||
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
||||||
Reference in New Issue
Block a user