forked from VitorCarvalho67/TSLibraryAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updade .env.example, .gitignore, and include nginx for load balancing
- Loading branch information
1 parent
ba27a25
commit e7a96da
Showing
4 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# DATABASE_URL="mysql://testuser:123pass@database:3306/biblioteca" | ||
# JWT_ACCESS_SECRET=fghjdsklgh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
# Keep environment variables out of version control | ||
.env | ||
data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
worker_processes auto; | ||
worker_rlimit_nofile 500000; | ||
|
||
events { | ||
use epoll; | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
access_log off; | ||
error_log /dev/null emerg; | ||
|
||
upstream api { | ||
server api01:3000; | ||
server api02:3001; # Alterei de localhost para o nome do serviço | ||
keepalive 200; | ||
} | ||
|
||
server { | ||
listen 9999; | ||
location / { | ||
proxy_buffering off; | ||
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; | ||
proxy_set_header Connection ""; | ||
|
||
# Simple requests | ||
if ($request_method ~* "(GET|POST)") { | ||
add_header "Access-Control-Allow-Origin" *; | ||
} | ||
|
||
# Preflighted requests | ||
if ($request_method = OPTIONS ) { | ||
add_header "Access-Control-Allow-Origin" *; | ||
add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD"; | ||
add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept"; | ||
return 200; | ||
} | ||
|
||
proxy_http_version 1.1; | ||
proxy_pass http://api; | ||
} | ||
} | ||
} |