-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add caching * feat: fix docker-compose * fix command * fix shit * fix * image fix
- Loading branch information
1 parent
e7ed717
commit b946587
Showing
6 changed files
with
191 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules/ | |
.idea/ | ||
precompiled-templates.js | ||
/images/ | ||
/nginx/ssl/ | ||
/nginx/ssl/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
services: | ||
frontend: | ||
image: node:20 | ||
working_dir: /app | ||
volumes: | ||
- ./:/app | ||
- /app/node_modules | ||
ports: | ||
- '5173:5173' # For local development! | ||
command: > | ||
sh -c "npm i && npm run start" | ||
nginx: | ||
image: nginx:latest | ||
volumes: | ||
- ./nginx/:/etc/nginx/ | ||
ports: | ||
- '80:80' | ||
- '443:443' | ||
depends_on: | ||
- frontend | ||
extra_hosts: | ||
- 'host.docker.internal:host-gateway' | ||
command: > | ||
sh -c "chmod +x /etc/nginx/generate-certs.sh && sh /etc/nginx/generate-certs.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
services: | ||
frontend: | ||
image: node:20 | ||
working_dir: /app | ||
volumes: | ||
- ./:/app | ||
- /app/node_modules | ||
ports: | ||
- '5173:5173' # For local development! | ||
command: > | ||
sh -c "npm i && npm run start" | ||
nginx: | ||
image: nginx:latest | ||
volumes: | ||
- ./nginx/:/etc/nginx/ | ||
ports: | ||
- '80:80' | ||
- '443:443' | ||
depends_on: | ||
- frontend | ||
extra_hosts: | ||
- 'host.docker.internal:host-gateway' | ||
command: > | ||
sh -c "chmod +x /etc/nginx/generate-certs.sh && sh /etc/nginx/generate-certs.sh" | ||
version: '3.8' | ||
|
||
services: | ||
frontend: | ||
image: node:20 | ||
working_dir: /app | ||
volumes: | ||
- .:/app | ||
- /app/node_modules | ||
command: > | ||
sh -c "npm i && npm run start" | ||
nginx: | ||
image: nginx:latest | ||
volumes: | ||
- ./nginx/:/etc/nginx/ | ||
# - ./app:/app/ # изменено на правильный путь | ||
ports: | ||
- '80:80' | ||
- '443:443' | ||
depends_on: | ||
- frontend | ||
extra_hosts: | ||
- 'host.docker.internal:host-gateway' | ||
command: > | ||
sh /etc/nginx/generate-certs.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
events { } | ||
|
||
http { | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
# Перенаправление всех HTTP-запросов на HTTPS | ||
return 301 http://$host$request_uri; | ||
} | ||
|
||
server { | ||
listen 443 ssl http2; | ||
server_name localhost; | ||
|
||
ssl_certificate /etc/nginx/ssl/pootnick.crt; | ||
ssl_certificate_key /etc/nginx/ssl/pootnick.key; | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
|
||
location /api/ { | ||
proxy_pass http://host.docker.internal:8008/api/; | ||
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; | ||
} | ||
|
||
location /websocket/ { | ||
proxy_pass https://host.docker.internal:8008/api/messages/setconn; | ||
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_buffering off; | ||
proxy_read_timeout 86400; | ||
} | ||
|
||
location /images/default.png { | ||
proxy_pass http://frontend:5173/default.png; | ||
} | ||
|
||
location /images/ { | ||
proxy_pass http://host.docker.internal:9000; # Minio | ||
proxy_set_header Host $host; | ||
} | ||
|
||
location /cities/ { | ||
proxy_pass http://host.docker.internal:9000; # Minio | ||
proxy_set_header Host $host; | ||
} | ||
|
||
location / { | ||
proxy_pass http://frontend:5173; # Vite | ||
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,67 @@ | ||
events { } | ||
|
||
http { | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
# Перенаправление всех HTTP-запросов на HTTPS | ||
return 301 http://$host$request_uri; | ||
} | ||
|
||
server { | ||
listen 443 ssl http2; | ||
server_name localhost; | ||
|
||
ssl_certificate /etc/nginx/ssl/pootnick.crt; | ||
ssl_certificate_key /etc/nginx/ssl/pootnick.key; | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
|
||
location /api/ { | ||
proxy_pass http://host.docker.internal:8008/api/; | ||
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; | ||
} | ||
|
||
location /websocket/ { | ||
proxy_pass https://host.docker.internal:8008/api/messages/setconn; | ||
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_buffering off; | ||
proxy_read_timeout 86400; | ||
} | ||
|
||
location /images/default.png { | ||
proxy_pass http://frontend:5173/default.png; | ||
} | ||
|
||
location /images/ { | ||
proxy_pass http://host.docker.internal:9000; # Minio | ||
proxy_set_header Host $host; | ||
} | ||
|
||
location /cities/ { | ||
proxy_pass http://host.docker.internal:9000; # Minio | ||
proxy_set_header Host $host; | ||
} | ||
|
||
location / { | ||
proxy_pass http://frontend:5173; # Vite | ||
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; | ||
} | ||
} | ||
} | ||
events { } | ||
|
||
http { | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
# Перенаправление всех HTTP-запросов на HTTPS | ||
return 301 http://$host$request_uri; | ||
} | ||
|
||
server { | ||
listen 443 ssl http2; | ||
server_name localhost; | ||
|
||
ssl_certificate /etc/nginx/ssl/pootnick.crt; | ||
ssl_certificate_key /etc/nginx/ssl/pootnick.key; | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
|
||
location /api/ { | ||
proxy_pass http://host.docker.internal:8008/api/; | ||
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; | ||
} | ||
|
||
location /websocket/ { | ||
proxy_pass https://host.docker.internal:8008/api/messages/setconn; | ||
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_buffering off; | ||
proxy_read_timeout 86400; | ||
} | ||
|
||
location /images/ { | ||
proxy_pass http://host.docker.internal:9000; # Minio | ||
expires 30d; | ||
add_header Cache-Control "public"; # public = browsers + CDN | ||
proxy_set_header Host $host; | ||
} | ||
|
||
location /cities/ { | ||
proxy_pass http://host.docker.internal:9000; # Minio | ||
proxy_set_header Host $host; | ||
} | ||
|
||
# location ~* \.(css|jpg|png|jpeg)$ { | ||
# root /app/dist/; | ||
# expires 30d; | ||
# proxy_pass http://frontend:5173; # Vite | ||
# add_header Cache-Control "public"; # public = browsers + CDN | ||
# } | ||
|
||
location / { | ||
proxy_pass http://frontend:5173; # Vite | ||
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; | ||
} | ||
} | ||
} |