From 778926b87926d9178c42a13d5a1b555ff5d6470f Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Tue, 9 May 2023 10:01:52 +0300 Subject: [PATCH] initial commit --- .gitignore | 37 +++++++++++++++++++++++++++++++++++++ configs/nginx.conf.dev | 21 +++++++++++++++++++++ configs/nginx.conf.prod | 21 +++++++++++++++++++++ package.json | 12 ++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 .gitignore create mode 100644 configs/nginx.conf.dev create mode 100644 configs/nginx.conf.prod create mode 100644 package.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b167e2d --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts +.idea diff --git a/configs/nginx.conf.dev b/configs/nginx.conf.dev new file mode 100644 index 0000000..e70eeb4 --- /dev/null +++ b/configs/nginx.conf.dev @@ -0,0 +1,21 @@ +server { + server_name localhost; + + location / { + proxy_pass http://arkids-main-frontend-development:3000; + + # Allow the use of websockets + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } + + location /api { + proxy_pass http://arkids-main-backend-development:5000; + } + + listen 80; + listen [::]:80; +} diff --git a/configs/nginx.conf.prod b/configs/nginx.conf.prod new file mode 100644 index 0000000..82d3cc7 --- /dev/null +++ b/configs/nginx.conf.prod @@ -0,0 +1,21 @@ +server { + server_name localhost; + + location / { + proxy_pass http://arkids-main-frontend-production:3000; + + # Allow the use of websockets + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } + + location /api { + proxy_pass http://arkids-main-backend-production:5000; + } + + listen 80; + listen [::]:80; +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..457b16a --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "arkids-nginx", + "version": "1.0.0", + "description": "Global nginx for arkids applications", + "main": "index.js", + "author": "Sergey Krylov ", + "license": "MIT", + "scripts": { + "start:dev": "docker run -p 80:80 --rm -v ./configs/nginx.conf.dev:/etc/nginx/conf.d/default.conf --network arkids-network --name arkids-nginx-development nginx:stable-alpine", + "start:prod": "docker run -p 80:80 --rm -d -v ./configs/nginx.conf.prod:/etc/nginx/conf.d/default.conf --network arkids-network --name arkids-nginx-production nginx:stable-alpine" + } +}