From 4950bf8f98be5bbf8b42eeaf40c3da467893a5a8 Mon Sep 17 00:00:00 2001 From: asm Date: Mon, 12 Aug 2024 20:24:17 +0200 Subject: [PATCH 1/3] DV-000297: Add Nginx config. --- docker-compose.yml | 21 ++++++++++++++++++++- nginx_config/nginx.conf | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 nginx_config/nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml index 326494e1..7735a486 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,4 +55,23 @@ services: depends_on: mysqldb: - condition: service_healthy \ No newline at end of file + condition: service_healthy + + nginx: + hostname: nginx-regions + container_name: nginx-regions + image: nginx:alpine + restart: always + ports: + - "80:80" + volumes: + - ./nginx_config/nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + server: + condition: service_healthy + logging: + # limit logs to 200MB (4 rotations of 50M each) + driver: "json-file" + options: + max-size: "50m" + max-file: "4" \ No newline at end of file diff --git a/nginx_config/nginx.conf b/nginx_config/nginx.conf new file mode 100644 index 00000000..12de890e --- /dev/null +++ b/nginx_config/nginx.conf @@ -0,0 +1,37 @@ +worker_processes auto; +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # Rate limiting to prevent brute force attacks + limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; + + server { + listen 80; + server_name localhost; + + # Rate limiting + limit_req zone=one burst=20 nodelay; + limit_req_status 429; + + location / { + proxy_pass http://server-regions:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /backend { + proxy_pass http://server-regions:8090; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + } +} \ No newline at end of file From dec3a855fba1f640db5074693b6cdcd69375bf7e Mon Sep 17 00:00:00 2001 From: asm Date: Mon, 12 Aug 2024 20:55:57 +0200 Subject: [PATCH 2/3] DV-000297: Add Nginx config. --- cypress.config.js | 2 +- docker-compose.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cypress.config.js b/cypress.config.js index c5ba7ea9..12ca3620 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -22,7 +22,7 @@ module.exports = defineConfig({ }; } else return { - baseUrl: "http://localhost:8080", + baseUrl: "http://localhost", env: { env: "qa" }, diff --git a/docker-compose.yml b/docker-compose.yml index 7735a486..6583dcc4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,7 +43,6 @@ services: args: REACT_APP_TOKEN: abc123 ports: - - "8080:8080" - "8090:8090" healthcheck: From f9e6cb926e62d2e19315f6fd01b4eb4bdf1da1a8 Mon Sep 17 00:00:00 2001 From: asm Date: Mon, 12 Aug 2024 20:56:17 +0200 Subject: [PATCH 3/3] DV-000297: Add Nginx config. --- cypress.config.js | 51 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/cypress.config.js b/cypress.config.js index 12ca3620..009f5fc9 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -1,32 +1,31 @@ -const { defineConfig } = require("cypress"); -const allureWriter = require('@shelex/cypress-allure-plugin/writer'); +const {defineConfig} = require("cypress"); module.exports = defineConfig({ - viewportHeight: 1080, - viewportWidth: 1920, - "video": false, - "retries": { - "runMode": 2, - "openMode": 0 - }, + viewportHeight: 1080, + viewportWidth: 1920, + "video": false, + "retries": { + "runMode": 2, + "openMode": 0 + }, - e2e: { - setupNodeEvents(on, config) { - if (config.env.master) { - return { - baseUrl: "http://regions-service.us-east-2.elasticbeanstalk.com/", - env: { - env: "master" - }, - }; - } else - return { - baseUrl: "http://localhost", - env: { - env: "qa" - }, - }; + e2e: { + setupNodeEvents(on, config) { + if (config.env.master) { + return { + baseUrl: "http://regions-service.us-east-2.elasticbeanstalk.com/", + env: { + env: "master" + }, + }; + } else + return { + baseUrl: "http://localhost", + env: { + env: "qa" + }, + }; + }, }, - }, });