Skip to content

Commit

Permalink
✨ Configured nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayush-Vish committed Oct 19, 2024
1 parent 0052028 commit a1feb77
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 90 deletions.
110 changes: 59 additions & 51 deletions api-gateway/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,54 +1,62 @@
upstream auth {
server auth:5001;
events {
worker_connections 1024;
}

upstream customer {
server customer:5002;
}

upstream shopkeeper {
server shopkeeper:5003;
}


upstream agent {
server agent:5000;
}


server {
listen 80;
server_name api-gateway;
location /auth {
proxy_pass http://auth;
}
location /customer {
proxy_pass http://customer;
}
location /shopkeeper {
proxy_pass http://shopkeeper;
}
location /agent {
proxy_pass http://agent;
}

}


server {
listen 443;
server_name api-gateway;
location /auth {
proxy_pass http://auth;
}
location /customer {
proxy_pass http://customer;
}
location /shopkeeper {
proxy_pass http://shopkeeper;
}
location /agent {
proxy_pass http://agent;
}

# Ensure everything is inside the `http` block
http {
upstream auth {
server auth:5001;
}

# upstream customer {
# server customer:5002;
# }

# upstream shopkeeper {
# server shopkeeper:5003;
# }

# upstream agent {
# server agent:5000;
# }

server {
listen 80;
server_name api-gateway;

location /auth {
proxy_pass http://auth;
}
# location /customer {
# proxy_pass http://customer;
# }
# location /shopkeeper {
# proxy_pass http://shopkeeper;
# }
# location /agent {
# proxy_pass http://agent;
# }
}

# server {
# listen 443 ssl;
# server_name api-gateway;

# # Add your SSL certificates here
# ssl_certificate /etc/nginx/ssl/nginx.crt;
# ssl_certificate_key /etc/nginx/ssl/nginx.key;

# location /auth {
# proxy_pass http://auth;
# }
# location /customer {
# proxy_pass http://customer;
# }
# location /shopkeeper {
# proxy_pass http://shopkeeper;
# }
# location /agent {
# proxy_pass http://agent;
# }
# }
}
7 changes: 7 additions & 0 deletions auth/src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import { verifyJWT } from '@org/utils';

const router = Router();

router.get('/', (req, res) => {
res.status(200).json({
message: 'Welcome to Auth API',
});
}
);

router.post('/register', register);
router.post('/login', login);
router.get('/logout', logout);
Expand Down
78 changes: 39 additions & 39 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ services:
ports:
- "80:80"
depends_on:
- agent
# - agent
- auth
- customer
- shopkeeper
# - customer
# - shopkeeper


agent:
build:
context: .
dockerfile: Dockerfile
args:
PROJECT: agent
env_file:
- .env
environment:
- NODE_ENV=production
ports:
- "5000:5000"
# agent:
# build:
# context: .
# dockerfile: Dockerfile
# args:
# PROJECT: agent
# env_file:
# - .env
# environment:
# - NODE_ENV=production
# ports:
# - "5000:5000"
auth:
build:
context: .
Expand All @@ -39,28 +39,28 @@ services:
ports:
- "5001:5001"

customer:
build:
context: .
dockerfile: Dockerfile
args:
PROJECT: customer
env_file:
- .env
environment:
- NODE_ENV=production
ports:
- "5002:5002"
shopkeeper:
build:
context: .
dockerfile: Dockerfile
args:
PROJECT: shopkeeper
env_file:
- .env
environment:
- NODE_ENV=production
ports:
- "5003:5003"
# customer:
# build:
# context: .
# dockerfile: Dockerfile
# args:
# PROJECT: customer
# env_file:
# - .env
# environment:
# - NODE_ENV=production
# ports:
# - "5002:5002"
# shopkeeper:
# build:
# context: .
# dockerfile: Dockerfile
# args:
# PROJECT: shopkeeper
# env_file:
# - .env
# environment:
# - NODE_ENV=production
# ports:
# - "5003:5003"

0 comments on commit a1feb77

Please sign in to comment.