- Создан Next.js 16 frontend приложение с TypeScript и Tailwind - Настроена Docker инфраструктура (docker-compose с 7 сервисами) - Добавлен nginx reverse proxy для маршрутизации frontend/backend - Реализован полный API client с JWT авторизацией - Интегрированы страницы: login, register, feed, employees - Переименована папка corp.front → frontend - Исправлены проблемы с trailing slash в Django APPEND_SLASH - Добавлена документация: DOCKER_ORCHESTRATION.md, INTEGRATION_GUIDE.md Архитектура: - nginx:80 → frontend:3000 (Next.js) + web:8000 (Django API) - PostgreSQL 16 + Redis 7 для backend - Celery worker + beat для фоновых задач - JWT authentication через SimpleJWT
84 lines
2.2 KiB
Nginx Configuration File
84 lines
2.2 KiB
Nginx Configuration File
upstream backend {
|
|
server web:8000;
|
|
}
|
|
|
|
upstream frontend {
|
|
server frontend:3000;
|
|
}
|
|
|
|
# WebSocket upgrade handling
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
client_max_body_size 100M;
|
|
|
|
# Frontend - Next.js application
|
|
location / {
|
|
proxy_pass http://frontend;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_cache_bypass $http_upgrade;
|
|
}
|
|
|
|
# Backend API
|
|
location /api/ {
|
|
proxy_pass http://backend;
|
|
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;
|
|
}
|
|
|
|
# Django Admin
|
|
location /admin/ {
|
|
proxy_pass http://backend;
|
|
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;
|
|
}
|
|
|
|
# WebSocket connections
|
|
location /ws/ {
|
|
proxy_pass http://backend;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
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_read_timeout 86400;
|
|
}
|
|
|
|
# Static files
|
|
location /static/ {
|
|
alias /app/staticfiles/;
|
|
expires 30d;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# Media files
|
|
location /media/ {
|
|
alias /app/media/;
|
|
expires 30d;
|
|
}
|
|
|
|
# Health check
|
|
location /health {
|
|
access_log off;
|
|
return 200 "healthy\n";
|
|
add_header Content-Type text/plain;
|
|
}
|
|
}
|