From c687dd7b668e35a9df3d77e59674d091eb373f6a Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 25 Aug 2014 16:42:10 +1000 Subject: [PATCH] Correct rate limiting stuff --- samples/standalone.yml | 6 ++++++ templates/web.ratelimited.template.yml | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/samples/standalone.yml b/samples/standalone.yml index 8b461cc..4671e07 100644 --- a/samples/standalone.yml +++ b/samples/standalone.yml @@ -6,11 +6,17 @@ ## ## this is the all-in-one, standalone Discourse Docker container template + +# You may add rate limiting to by commenting out the ratelimited template. +# Out of the box it allows 12 reqs a second per ip, and 100 per minute per ip +# This is configurable by amending the params in this file + templates: - "templates/postgres.template.yml" - "templates/redis.template.yml" - "templates/web.template.yml" - "templates/sshd.template.yml" + #- "templates/web.ratelimited.template.yml" ## which TCP/IP ports should this container expose? expose: diff --git a/templates/web.ratelimited.template.yml b/templates/web.ratelimited.template.yml index fe7a5e3..8e83cf5 100644 --- a/templates/web.ratelimited.template.yml +++ b/templates/web.ratelimited.template.yml @@ -9,8 +9,8 @@ run: filename: "/etc/nginx/conf.d/discourse.conf" from: /server.+{/ to: | - limit_req_zone $binary_remote_addr zone=flood:10m rate $reqs_per_secondr/s; - limit_req_zone $binary_remote_addr zone=bot:10m rate $reqs_per_minuter/m; + limit_req_zone $binary_remote_addr zone=flood:10m rate=$reqs_per_secondr/s; + limit_req_zone $binary_remote_addr zone=bot:10m rate=$reqs_per_minuter/m; server { - replace: filename: "/etc/nginx/conf.d/discourse.conf" -- 2.25.1