Add gunicorn_pushgateway_workers

This commit is contained in:
2023-04-03 10:45:39 +02:00
parent add1897813
commit 3639cf49e9
4 changed files with 31 additions and 2 deletions

View File

@@ -20,6 +20,11 @@ class EnvConfig(BaseSettings):
MEILI_HOST: str MEILI_HOST: str
MEILI_MASTER_KEY: str MEILI_MASTER_KEY: str
PUSH_GETAWAY_ENABLED: bool = True
PUSH_GETAWAY_HOST: str = ""
PUSH_GETAWAY_JOB: str = "library_server"
PUSH_GETAWAY_INTERVAL: int = 15
SENTRY_SDN: str SENTRY_SDN: str
class Config: class Config:

25
poetry.lock generated
View File

@@ -369,6 +369,29 @@ gevent = ["gevent (>=1.4.0)"]
setproctitle = ["setproctitle"] setproctitle = ["setproctitle"]
tornado = ["tornado (>=0.2)"] tornado = ["tornado (>=0.2)"]
[[package]]
name = "gunicorn-pushgateway-workers"
version = "0.1.2"
description = ""
category = "main"
optional = false
python-versions = "^3.9"
files = []
develop = false
[package.dependencies]
prometheus-client = "^0.15.0"
pydantic = "^1.10.2"
[package.extras]
uvicorn = ["uvicorn (>=0.20.0,<0.21.0)"]
[package.source]
type = "git"
url = "https://github.com/speechki-book/gunicorn-pushgateway-workers.git"
reference = "v0.1.3"
resolved_reference = "b8618605cda9dab6a8bf7751e48b370f691cc981"
[[package]] [[package]]
name = "h11" name = "h11"
version = "0.14.0" version = "0.14.0"
@@ -1516,4 +1539,4 @@ files = [
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.11" python-versions = "^3.11"
content-hash = "371a35581599b7e1969d893044905186a1e3d7412fa0035b11b275b7e8a07ea6" content-hash = "4a27ab4bd99df188c2de8f245d3500ad67ed2a3009e2a07b713d8f941ce6b22d"

View File

@@ -20,6 +20,7 @@ uvloop = "^0.17.0"
gunicorn = "^20.1.0" gunicorn = "^20.1.0"
sentry-sdk = "^1.17.0" sentry-sdk = "^1.17.0"
redis = {extras = ["hiredis"], version = "^4.5.3"} redis = {extras = ["hiredis"], version = "^4.5.3"}
gunicorn-pushgateway-workers = {git = "https://github.com/speechki-book/gunicorn-pushgateway-workers.git", rev = "v0.1.3"}
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pre-commit = "^2.21.0" pre-commit = "^2.21.0"

View File

@@ -4,4 +4,4 @@ rm -rf prometheus
mkdir prometheus mkdir prometheus
alembic -c ./app/alembic.ini upgrade head alembic -c ./app/alembic.ini upgrade head
gunicorn -k uvicorn.workers.UvicornWorker main:app --bind 0.0.0.0:8080 --timeout 600 gunicorn -k gunicorn_pushgateway_workers.workers.uvicorn.UvicornWorker main:app --bind 0.0.0.0:8080 --timeout 600