fix limiter

This commit is contained in:
flynn
2022-02-03 20:53:55 -05:00
parent fb98bcaa01
commit 70a10f9941
6 changed files with 8 additions and 8 deletions

View File

@@ -7,7 +7,7 @@ fi
if [[ "$1" = "web" ]] if [[ "$1" = "web" ]]
then then
exec poetry run gunicorn -b 0.0.0.0:5000 -w 2 --access-logfile - --error-log - --access-logformat "%({x-forwarded-for}i)s %(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"" pypistats.run:app exec poetry run gunicorn -b 0.0.0.0:5000 -w 2 --access-logfile - --error-log - --access-logformat "%({x-forwarded-for}i)s %(l)s %(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"" pypistats.run:app
fi fi
if [[ "$1" = "celery" ]] if [[ "$1" = "celery" ]]

View File

@@ -20,7 +20,7 @@ spec:
spec: spec:
containers: containers:
- name: pypistats-flower - name: pypistats-flower
image: us.gcr.io/pypistats-org/pypistats:10 image: us.gcr.io/pypistats-org/pypistats:11
imagePullPolicy: Always imagePullPolicy: Always
args: ["flower"] args: ["flower"]
envFrom: envFrom:

View File

@@ -20,14 +20,14 @@ spec:
spec: spec:
containers: containers:
- name: beat - name: beat
image: us.gcr.io/pypistats-org/pypistats:10 image: us.gcr.io/pypistats-org/pypistats:11
imagePullPolicy: Always imagePullPolicy: Always
args: ["beat"] args: ["beat"]
envFrom: envFrom:
- secretRef: - secretRef:
name: pypistats-secrets name: pypistats-secrets
- name: celery - name: celery
image: us.gcr.io/pypistats-org/pypistats:10 image: us.gcr.io/pypistats-org/pypistats:11
imagePullPolicy: Always imagePullPolicy: Always
args: ["celery"] args: ["celery"]
envFrom: envFrom:

View File

@@ -20,7 +20,7 @@ spec:
spec: spec:
initContainers: initContainers:
- name: migrate - name: migrate
image: us.gcr.io/pypistats-org/pypistats:10 image: us.gcr.io/pypistats-org/pypistats:11
imagePullPolicy: Always imagePullPolicy: Always
envFrom: envFrom:
- secretRef: - secretRef:
@@ -28,7 +28,7 @@ spec:
args: ["migrate"] args: ["migrate"]
containers: containers:
- name: web - name: web
image: us.gcr.io/pypistats-org/pypistats:10 image: us.gcr.io/pypistats-org/pypistats:11
imagePullPolicy: Always imagePullPolicy: Always
envFrom: envFrom:
- secretRef: - secretRef:

View File

@@ -19,7 +19,7 @@ env = os.environ.get("ENV", "development")
app = create_app(configs[env]) app = create_app(configs[env])
# Rate limiting per IP/worker # Rate limiting per IP/worker
app.wsgi_app = ProxyFix(app.wsgi_app) app.wsgi_app = ProxyFix(app.wsgi_app, x_for=2)
limiter = Limiter(app, key_func=get_remote_address, application_limits=["5 per second", "30 per minute"]) limiter = Limiter(app, key_func=get_remote_address, application_limits=["5 per second", "30 per minute"])
app.logger.info(f"Environment: {env}") app.logger.info(f"Environment: {env}")

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "pypistatsorg" name = "pypistatsorg"
version = "10" version = "11"
description = "Download counts dashboard for python packages" description = "Download counts dashboard for python packages"
authors = ["Flynn <crf204@gmail.com>"] authors = ["Flynn <crf204@gmail.com>"]