Evo.Auth as single service: pt.1
This commit is contained in:
parent
d63a6ed199
commit
dc40b71faa
2
.env
2
.env
@ -1,10 +1,8 @@
|
|||||||
COMPOSE_PROJECT_NAME=
|
COMPOSE_PROJECT_NAME=
|
||||||
NETWORK_NAME=
|
|
||||||
TRAEFIK_APP_NAME=
|
TRAEFIK_APP_NAME=
|
||||||
TRAEFIK_ENTRYPOINTS=web-secure
|
TRAEFIK_ENTRYPOINTS=web-secure
|
||||||
# TRAEFIK_ENTRYPOINTS=web-secure-ext
|
# TRAEFIK_ENTRYPOINTS=web-secure-ext
|
||||||
WEB_HOST=
|
WEB_HOST=
|
||||||
APPLICATION=
|
|
||||||
|
|
||||||
# WEB
|
# WEB
|
||||||
APP_BASE_PATH=/login
|
APP_BASE_PATH=/login
|
||||||
|
|||||||
@ -1,17 +1,11 @@
|
|||||||
upstream web {
|
upstream auth_web {
|
||||||
server auth_web:3000;
|
server auth_web:3000;
|
||||||
}
|
}
|
||||||
|
|
||||||
upstream api {
|
upstream auth_api {
|
||||||
server auth_api:3001;
|
server auth_api:3001;
|
||||||
}
|
}
|
||||||
|
|
||||||
upstream app {
|
|
||||||
server $APPLICATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
include /etc/nginx/include/upstream.conf;
|
|
||||||
|
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
@ -26,61 +20,16 @@ server {
|
|||||||
gzip_disable "msie6";
|
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 / {
|
location / {
|
||||||
proxy_pass http://app;
|
proxy_pass http://auth_api;
|
||||||
|
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection 'upgrade';
|
proxy_set_header Connection 'upgrade';
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_cache_bypass $http_upgrade;
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
proxy_set_header X-Original-URI $request_uri;
|
||||||
auth_request /auth;
|
proxy_set_header X-Original-Remote-Addr $remote_addr;
|
||||||
auth_request_set $auth_cookie $upstream_http_set_cookie;
|
proxy_set_header X-Original-Host $host;
|
||||||
add_header Set-Cookie $auth_cookie;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /health {
|
|
||||||
access_log off;
|
|
||||||
add_header 'Content-Type' 'application/json';
|
|
||||||
return 200 'UP';
|
|
||||||
}
|
|
||||||
|
|
||||||
include /etc/nginx/include/location.conf;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,6 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- auth_network
|
- auth_network
|
||||||
- app_network
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:7-alpine
|
image: redis:7-alpine
|
||||||
@ -41,24 +40,16 @@ services:
|
|||||||
file: docker-compose.traefik.yml
|
file: docker-compose.traefik.yml
|
||||||
service: server
|
service: server
|
||||||
image: nginx:alpine
|
image: nginx:alpine
|
||||||
environment:
|
|
||||||
- APPLICATION=${APPLICATION}
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/nginx.conf:/etc/nginx/templates/default.conf.template
|
- ./config/nginx.conf:/etc/nginx/templates/default.conf.template
|
||||||
- ./config/include:/etc/nginx/include
|
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- auth_web
|
|
||||||
- auth_api
|
- auth_api
|
||||||
- redis
|
- redis
|
||||||
networks:
|
networks:
|
||||||
- auth_network
|
- auth_network
|
||||||
- app_network
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
auth_network:
|
auth_network:
|
||||||
app_network:
|
|
||||||
external: true
|
|
||||||
name: ${NETWORK_NAME}
|
|
||||||
web:
|
web:
|
||||||
external: true
|
external: true
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "evo-gateway",
|
"name": "evo-auth",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user