Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import structlog
from fastapi import FastAPI
from prometheus_fastapi_instrumentator import Instrumentator
from redis.asyncio import Redis

from app.core.config import settings
Expand Down Expand Up @@ -40,12 +41,14 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
lifespan=lifespan,
)

Instrumentator().instrument(app).expose(app)

setup_exception_handlers(app)

app.include_router(user_router_v1, prefix='/api/v1', tags=['Users'])
app.include_router(order_router_v1, prefix='/api/v1', tags=['Orders'])
app.include_router(inventory_router_v1, prefix='/api/v1', tags=['Inventory'])
app.include_router(media_router_v1, prefix='/api/v1/media', tags=['Media'])
app.include_router(media_router_v1, prefix='/api/v1', tags=['Media'])


@app.get('/health')
Expand Down
2 changes: 1 addition & 1 deletion app/services/media/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from app.services.user.models import User
from app.shared.deps import get_current_user

router_v1 = APIRouter(prefix='/api/v1/media', tags=['Media'])
router_v1 = APIRouter(prefix='/media', tags=['Media'])


@router_v1.post('/products/{product_id}/upload_url', response_model=ImageUploadResponse)
Expand Down
23 changes: 23 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ volumes:
fairdrop-s3:
fairdrop-app:
fairdrop-gateway:
fairdrop-prometheus:
fairdrop-grafana:

services:
postgres:
Expand Down Expand Up @@ -89,3 +91,24 @@ services:
- '${GATEWAY_PORT}:80'
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro

prometheus:
image: prom/prometheus:latest
container_name: prometheus_fairdrop
ports:
- '9090:9090'
volumes:
- ./infrastructure/prometheus/prometheus.yaml:/etc/prometheus/prometheus.yml:ro
- fairdrop-prometheus:/prometheus
depends_on:
- app

grafana:
image: grafana/grafana:latest
container_name: grafana_fairdrop
ports:
- '3000:3000'
volumes:
- fairdrop-grafana:/var/lib/grafana
depends_on:
- prometheus
7 changes: 7 additions & 0 deletions infrastructure/prometheus/prometheus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
global:
scrape_interval: 5s

scrape_configs:
- job_name: 'fairdrop_fastapi_app'
static_configs:
- targets: ['app:8000']