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
1 change: 1 addition & 0 deletions .github/workflows/first_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
--health-timeout 5s
--health-retries 5

if: github.ref == 'refs/heads/dev'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import redis.asyncio as asyncredis
import uvicorn
from fastapi import FastAPI
from prometheus_fastapi_instrumentator import Instrumentator
from slowapi import _rate_limit_exceeded_handler
from slowapi.errors import RateLimitExceeded

Expand All @@ -22,6 +23,8 @@ async def lifespan(app: FastAPI):

app = FastAPI(lifespan=lifespan)

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

app.include_router(router)

app.state.limiter = limiter
Expand Down
19 changes: 18 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ services:
- certbot_conf:/etc/letsencrypt
- certbot_www:/var/www/certbot

prometheus:
image: prom/prometheus
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus

grafana:
image: grafana/grafana
ports:
- "3000:3000"
volumes:
- grafana_data:/var/lib/grafana

certbot:
image: certbot/certbot:latest
volumes:
Expand All @@ -59,4 +74,6 @@ services:
volumes:
postgres_data:
certbot_conf:
certbot_www:
certbot_www:
grafana_data:
prometheus_data:
21 changes: 21 additions & 0 deletions prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 15s
scrape_configs:
- job_name: prometheus
honor_timestamps: true
scrape_interval: 15s
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
follow_redirects: true
static_configs:
- targets:
- localhost:9090
- job_name: 'fastapi'
scrape_interval: 10s
metrics_path: /metrics
static_configs:
- targets: ['web:8000']

Binary file modified requirements.txt
Binary file not shown.