diff --git a/frontend/package.json b/frontend/package.json index b451fcc..2cf888b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev -p 3000", + "dev": "next dev -p 3001", "build": "next build", "start": "next start -p 3000", "lint": "next lint" diff --git a/infrastructure/docker-compose.yml b/infrastructure/docker-compose.yml index 60c04b6..adf9977 100644 --- a/infrastructure/docker-compose.yml +++ b/infrastructure/docker-compose.yml @@ -34,7 +34,7 @@ services: - ../backend/.env environment: - DATABASE_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-dyolink_dev_change_me}@postgres:5432/${POSTGRES_DB:-dyolink_db} - - FRONTEND_URL=http://frontend:3000 + - FRONTEND_URL=http://localhost:4000 - PORT=3000 ports: - "4001:3000" @@ -56,9 +56,8 @@ services: environment: - NEXT_PUBLIC_API_URL=http://localhost:4001/api - NEXT_PUBLIC_APP_URL=http://localhost:4000 - - PORT=3000 ports: - - "4000:3000" + - "4000:3001" volumes: - ../frontend:/app:rw - /app/node_modules @@ -77,6 +76,7 @@ services: ports: - "8080:80" volumes: + - ./nginx/http-only.dev.conf:/etc/nginx/conf.d/default.conf:ro - ./logs/nginx:/var/log/nginx networks: - dyolink_network diff --git a/infrastructure/nginx/http-only.dev.conf b/infrastructure/nginx/http-only.dev.conf new file mode 100644 index 0000000..6c6197d --- /dev/null +++ b/infrastructure/nginx/http-only.dev.conf @@ -0,0 +1,54 @@ +# Dev docker-compose only: local `npm run dev` uses port 3001 (see frontend package.json). +# Staging / registry stacks use http-only.conf (frontend:3000). + +upstream dyolink_backend { + server backend:3000; + keepalive 32; +} + +upstream dyolink_frontend { + server frontend:3001; + keepalive 32; +} + +server { + listen 80; + listen [::]:80; + server_name _; + + client_max_body_size 50M; + + location / { + proxy_pass http://dyolink_frontend; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header 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; + proxy_read_timeout 300; + proxy_connect_timeout 300; + } + + location /api { + proxy_pass http://dyolink_backend; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header 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; + proxy_read_timeout 300; + proxy_connect_timeout 300; + } + + location /health { + access_log off; + return 200 "healthy\n"; + add_header Content-Type text/plain; + } +}