Skip to content

Commit

Permalink
feat: revert back to FastAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
egvimo committed Oct 21, 2023
1 parent 53128ce commit c4b15c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt \

EXPOSE 8000

CMD ["gunicorn", "app:app", "-b", "0.0.0.0"]
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--no-access-log"]
9 changes: 5 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import os
from flask import Flask, Response
from fastapi import FastAPI
from fastapi.responses import PlainTextResponse
import apt_info

root_dir = os.environ.get("APT_ROOT_DIR", "/")

app = Flask(__name__)
app = FastAPI()


@app.route("/metrics")
@app.get("/metrics", response_class=PlainTextResponse)
def metrics():
data = apt_info.generate_metrics(root_dir=root_dir)
return Response(data, mimetype='text/plain')
return data
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python-apt @ git+https://salsa.debian.org/apt-team/python-apt.git@2.5.3
prometheus_client==0.17.1
Flask==3.0.0
gunicorn==21.2.0
fastapi==0.103.2
uvicorn[standard]==0.23.2

0 comments on commit c4b15c4

Please sign in to comment.