Skip to content

Commit

Permalink
feat: nginx adventures #1
Browse files Browse the repository at this point in the history
  • Loading branch information
akifisitan committed May 12, 2024
1 parent 5c38870 commit 12ef9fb
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 21 deletions.
1 change: 0 additions & 1 deletion ovatify-backend/microservices/api-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ COPY proxy_settings.conf /etc/nginx/conf.d/proxy_settings.conf
# Copy microservice related
COPY service_config/auth_service_routes.conf /etc/nginx/conf.d/auth_service.conf
COPY service_config/recommendation_service_routes.conf /etc/nginx/conf.d/recommendation_service.conf
COPY service_config/song_service_routes.conf /etc/nginx/conf.d/song_service.conf
COPY service_config/user_service_routes.conf /etc/nginx/conf.d/user_service.conf

# Expose port 80
Expand Down
14 changes: 3 additions & 11 deletions ovatify-backend/microservices/api-gateway/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
# nginx.conf
events {
worker_connections 1024;
worker_processes auto;
}

http {
upstream auth_service {
server host.docker.internal:6000;
server ovtf-auth-srv-clpiqqqcgq-ew.a.run.app;
}

upstream recommendation_service {
server host.docker.internal:6001;
}

upstream song_service {
server host.docker.internal:6002;
server recommendation-service-clpiqqqcgq-ew.a.run.app;
}

upstream user_service {
server host.docker.internal:6003;
server user-service-clpiqqqcgq-ew.a.run.app;
}

server {
listen 80;

set $nw_proto http;

include /etc/nginx/conf.d/auth_service.conf;
include /etc/nginx/conf.d/recommendation_service.conf;
include /etc/nginx/conf.d/song_service.conf;
include /etc/nginx/conf.d/user_service.conf;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# auth_service_routes.conf
location /users/create-user/ {
proxy_pass $nw_proto://auth_service;
proxy_pass https://auth_service;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/login/ {
proxy_pass $nw_proto://auth_service;
proxy_pass https://auth_service;
include /etc/nginx/conf.d/proxy_settings.conf;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# recommendation_service_routes.conf
location /users/recommend-you-might-like/ {
proxy_pass $nw_proto://recommendation_service;
proxy_pass https://recommendation_service;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/recommend-since-you-like/ {
proxy_pass https://recommendation_service;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/recommend-friend-mix/ {
proxy_pass https://recommendation_service;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/recommend-friend-listen/ {
proxy_pass https://recommendation_service;
include /etc/nginx/conf.d/proxy_settings.conf;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
location /users/get-recently-added-songs/ {
proxy_pass $nw_proto://user_service;
# user_service_routes.conf
location /users/get-user-profile/ {
proxy_pass https://user_service;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/edit-user-preferences/ {
proxy_pass https://user_service;
include /etc/nginx/conf.d/proxy_settings.conf;
}

location /users/delete-user/ {
proxy_pass https://user_service;
include /etc/nginx/conf.d/proxy_settings.conf;
}
1 change: 1 addition & 0 deletions ovatify-backend/microservices/user-service/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ fly.toml
.git/
*.sqlite3
.venv/
venv/
.idea
.env.*
.vscode/

0 comments on commit 12ef9fb

Please sign in to comment.