diff --git a/.env b/.env index b3025b5..8f5e5b3 100644 --- a/.env +++ b/.env @@ -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 diff --git a/config/include/location.conf b/config/include/location.conf deleted file mode 100644 index e69de29..0000000 diff --git a/config/include/upstream.conf b/config/include/upstream.conf deleted file mode 100644 index e69de29..0000000 diff --git a/config/nginx.conf b/config/nginx.conf index 233df95..633b032 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -1,86 +1,35 @@ -upstream web { - server auth_web:3000; +upstream auth_web { + server auth_web:3000; } -upstream api { - server auth_api:3001; +upstream auth_api { + server auth_api:3001; } -upstream app { - server $APPLICATION; -} - - include /etc/nginx/include/upstream.conf; - server { - listen 80; - include /etc/nginx/mime.types; + listen 80; + include /etc/nginx/mime.types; - gzip on; - gzip_min_length 1000; - gzip_proxied any; - gzip_comp_level 1; - gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml; - gzip_vary on; - 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; - } + gzip on; + gzip_min_length 1000; + gzip_proxied any; + gzip_comp_level 1; + gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml; + gzip_vary on; + gzip_disable "msie6"; 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_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; + 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; } diff --git a/docker-compose.yml b/docker-compose.yml index 136feb4..8ef93f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/package.json b/package.json index ecaa51e..b8eb32a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "evo-gateway", + "name": "evo-auth", "version": "0.0.0", "private": true, "workspaces": [