Skip to content

Commit

Permalink
Merge pull request #357 from vaskocuturilo/dv000297_add_nginx_config
Browse files Browse the repository at this point in the history
DV-000297: Add Nginx config.
  • Loading branch information
vaskocuturilo authored Aug 12, 2024
2 parents 2a416e1 + f9e6cb9 commit 2ab38a8
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 28 deletions.
51 changes: 25 additions & 26 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -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:8080",
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"
},
};
},
},
},
});
22 changes: 20 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ services:
args:
REACT_APP_TOKEN: abc123
ports:
- "8080:8080"
- "8090:8090"

healthcheck:
Expand All @@ -55,4 +54,23 @@ services:

depends_on:
mysqldb:
condition: service_healthy
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"
37 changes: 37 additions & 0 deletions nginx_config/nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}
}

0 comments on commit 2ab38a8

Please sign in to comment.