From 523ef3188b5728e829b8d1d52201be4b8135b6f9 Mon Sep 17 00:00:00 2001 From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com> Date: Fri, 27 Jan 2023 11:45:12 -0800 Subject: [PATCH] Loadtesting updates (#587) * Updated api gateway to allow limited access without api key --- .github/workflows/deploy-test.yml | 2 +- docker/default.conf | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-test.yml b/.github/workflows/deploy-test.yml index a7da902098..5c35c27309 100644 --- a/.github/workflows/deploy-test.yml +++ b/.github/workflows/deploy-test.yml @@ -75,7 +75,7 @@ jobs: CLIENT_MEMORY: 4096 SERVER_CPU_UNITS: 2048 SERVER_MEMORY: 4096 - DB_INSTANCE_TYPE: 'db.t3.micro' + DB_INSTANCE_TYPE: 'db.t3.medium' INSTANCE_COUNT: 2 LOGGING_LEVEL: INFO diff --git a/docker/default.conf b/docker/default.conf index 73425a98cc..30b68e1fd7 100644 --- a/docker/default.conf +++ b/docker/default.conf @@ -1,5 +1,5 @@ limit_req_zone $binary_remote_addr zone=wfnewslimit:10m rate=10000r/s; - +limit_req_zone $binary_remote_addr zone=wfnewsnotoken:10m rate=50r/s; server { listen 8080; @@ -15,9 +15,17 @@ server { return 204; } + location @slowdown { + limit_req zone=wfnewsnotoken burst=50 nodelay; + + proxy_pass https://wfnews-server.{LICENSE_PLATE}-{TARGET_ENV}.nimbus.cloud.gov.bc.ca; + } + location / { limit_req zone=wfnewslimit burst=10000 nodelay; auth_request /_validate_apikey; + + error_page 403 = @slowdown; proxy_pass https://wfnews-server.{LICENSE_PLATE}-{TARGET_ENV}.nimbus.cloud.gov.bc.ca; }