Evo.Auth as single service: pt.1

This commit is contained in:
vchikalkin 2023-10-30 12:50:16 +03:00
parent d63a6ed199
commit dc40b71faa
6 changed files with 23 additions and 85 deletions

2
.env
View File

@ -1,10 +1,8 @@
COMPOSE_PROJECT_NAME=
NETWORK_NAME=
TRAEFIK_APP_NAME=
TRAEFIK_ENTRYPOINTS=web-secure
# TRAEFIK_ENTRYPOINTS=web-secure-ext
WEB_HOST=
APPLICATION=
# WEB
APP_BASE_PATH=/login

View File

@ -1,17 +1,11 @@
upstream web {
upstream auth_web {
server auth_web:3000;
}
upstream api {
upstream auth_api {
server auth_api:3001;
}
upstream app {
server $APPLICATION;
}
include /etc/nginx/include/upstream.conf;
server {
listen 80;
@ -26,61 +20,16 @@ server {
gzip_disable "msie6";
error_page 401 /login;
location = /auth {
internal;
proxy_pass http://api;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Remote-Addr $remote_addr;
proxy_set_header X-Original-Host $host;
proxy_intercept_errors on;
}
location ~ ^/(signin|logout|get-user) {
proxy_pass http://api;
proxy_redirect off;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Remote-Addr $remote_addr;
proxy_set_header X-Original-Host $host;
}
location ~ ^/login {
proxy_pass http://web;
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 / {
proxy_pass http://app;
proxy_pass http://auth_api;
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;
auth_request /auth;
auth_request_set $auth_cookie $upstream_http_set_cookie;
add_header Set-Cookie $auth_cookie;
proxy_set_header X-Original-URI $request_uri;
proxy_set_header X-Original-Remote-Addr $remote_addr;
proxy_set_header X-Original-Host $host;
}
location = /health {
access_log off;
add_header 'Content-Type' 'application/json';
return 200 'UP';
}
include /etc/nginx/include/location.conf;
}

View File

@ -27,7 +27,6 @@ services:
restart: always
networks:
- auth_network
- app_network
redis:
image: redis:7-alpine
@ -41,24 +40,16 @@ services:
file: docker-compose.traefik.yml
service: server
image: nginx:alpine
environment:
- APPLICATION=${APPLICATION}
volumes:
- ./config/nginx.conf:/etc/nginx/templates/default.conf.template
- ./config/include:/etc/nginx/include
restart: always
depends_on:
- auth_web
- auth_api
- redis
networks:
- auth_network
- app_network
networks:
auth_network:
app_network:
external: true
name: ${NETWORK_NAME}
web:
external: true

View File

@ -1,5 +1,5 @@
{
"name": "evo-gateway",
"name": "evo-auth",
"version": "0.0.0",
"private": true,
"workspaces": [