feat: один прод-compose со всеми моделями из готовых образов
This commit is contained in:
parent
c3fc1cec79
commit
a694702d8f
44 changed files with 1126 additions and 2075 deletions
|
|
@ -9,13 +9,9 @@ RUN npm run build
|
|||
|
||||
FROM nginx:1.27-alpine
|
||||
|
||||
RUN apk add --no-cache openssl
|
||||
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
|
||||
COPY nginx.tls.conf.template /etc/nginx/templates-tls/default.conf.template
|
||||
COPY docker-entrypoint.d/15-local-certificate.sh /docker-entrypoint.d/15-local-certificate.sh
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
ENV BACKEND_HOST=backend
|
||||
ENV BACKEND_PORT=8000
|
||||
EXPOSE 5173
|
||||
EXPOSE 5443
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
if [ "${TLS_BOOTSTRAP:-false}" != "true" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
certificate_dir=/etc/nginx/tls
|
||||
certificate_file="$certificate_dir/tls.crt"
|
||||
private_key_file="$certificate_dir/tls.key"
|
||||
mkdir -p "$certificate_dir"
|
||||
|
||||
if [ -s "$certificate_file" ] && [ -s "$private_key_file" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
openssl req -x509 -nodes -newkey rsa:3072 -sha256 -days 365 \
|
||||
-keyout "$private_key_file" \
|
||||
-out "$certificate_file" \
|
||||
-subj "/CN=localhost/O=LCT local training stand" \
|
||||
-addext "subjectAltName=DNS:localhost,IP:127.0.0.1" \
|
||||
-addext "keyUsage=digitalSignature,keyEncipherment" \
|
||||
-addext "extendedKeyUsage=serverAuth" 2>/dev/null
|
||||
chmod 600 "$private_key_file"
|
||||
chmod 644 "$certificate_file"
|
||||
echo "TLS: создан локальный bootstrap-сертификат $certificate_file" >&2
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
# The same session UUID must reach its owning SessionHub on every API/WS path.
|
||||
map $uri $session_route_key {
|
||||
default $uri;
|
||||
"~^/ws/(?:control|call|observe|station)/([0-9a-fA-F-]{36})$" $1;
|
||||
"~^/api/sessions/([0-9a-fA-F-]{36})(?:/|$)" $1;
|
||||
}
|
||||
|
||||
upstream backend_cluster {
|
||||
zone backend_cluster 64k;
|
||||
resolver 127.0.0.11 ipv6=off valid=2s;
|
||||
hash $session_route_key consistent;
|
||||
server backend:8000 resolve max_fails=1 fail_timeout=5s;
|
||||
server backend-b:8000 resolve max_fails=1 fail_timeout=5s;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 5173;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
gzip on;
|
||||
gzip_static on;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 6;
|
||||
gzip_min_length 1024;
|
||||
gzip_types application/javascript application/json image/svg+xml text/css text/plain;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://backend_cluster;
|
||||
proxy_http_version 1.1;
|
||||
proxy_next_upstream error timeout http_403 http_500 http_502 http_503 http_504;
|
||||
proxy_next_upstream_tries 2;
|
||||
proxy_next_upstream_timeout 5s;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /ws/ {
|
||||
proxy_pass http://backend_cluster;
|
||||
proxy_http_version 1.1;
|
||||
proxy_next_upstream error timeout http_403 http_502 http_503 http_504;
|
||||
proxy_next_upstream_tries 2;
|
||||
proxy_next_upstream_timeout 5s;
|
||||
proxy_connect_timeout 1s;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
proxy_read_timeout 75s;
|
||||
}
|
||||
|
||||
location ~* \.(?:css|js|woff2?|png|svg)$ {
|
||||
try_files $uri =404;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
add_header Cache-Control "no-cache";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
# Keep session channels pinned to the node that owns their SessionHub.
|
||||
map $uri $session_route_key {
|
||||
default $uri;
|
||||
"~^/ws/(?:control|call|observe|station)/([0-9a-fA-F-]{36})$" $1;
|
||||
"~^/api/sessions/([0-9a-fA-F-]{36})(?:/|$)" $1;
|
||||
}
|
||||
|
||||
upstream backend_cluster {
|
||||
zone backend_cluster 64k;
|
||||
resolver 127.0.0.11 ipv6=off valid=2s;
|
||||
hash $session_route_key consistent;
|
||||
server backend:8000 resolve max_fails=1 fail_timeout=5s;
|
||||
server backend-b:8000 resolve max_fails=1 fail_timeout=5s;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 5173;
|
||||
server_name _;
|
||||
return 308 https://$host:${PUBLIC_TLS_PORT}$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 5443 ssl;
|
||||
http2 on;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
ssl_certificate /etc/nginx/tls/tls.crt;
|
||||
ssl_certificate_key /etc/nginx/tls/tls.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_session_cache shared:LCT_TLS:10m;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_tickets off;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header Referrer-Policy "same-origin" always;
|
||||
|
||||
gzip on;
|
||||
gzip_static on;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 6;
|
||||
gzip_min_length 1024;
|
||||
gzip_types application/javascript application/json image/svg+xml text/css text/plain;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://backend_cluster;
|
||||
proxy_http_version 1.1;
|
||||
proxy_next_upstream error timeout http_403 http_500 http_502 http_503 http_504;
|
||||
proxy_next_upstream_tries 2;
|
||||
proxy_next_upstream_timeout 5s;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
}
|
||||
|
||||
location /ws/ {
|
||||
proxy_pass http://backend_cluster;
|
||||
proxy_http_version 1.1;
|
||||
proxy_next_upstream error timeout http_403 http_502 http_503 http_504;
|
||||
proxy_next_upstream_tries 2;
|
||||
proxy_next_upstream_timeout 5s;
|
||||
proxy_connect_timeout 1s;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_read_timeout 75s;
|
||||
}
|
||||
|
||||
location = /sip-ws {
|
||||
resolver 127.0.0.11 ipv6=off valid=10s;
|
||||
set $sip_backend sip;
|
||||
proxy_pass http://$sip_backend:8088/ws;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
}
|
||||
|
||||
location ~* \.(?:css|js|woff2?|png|svg)$ {
|
||||
try_files $uri =404;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
add_header Cache-Control "no-cache";
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,20 @@ server {
|
|||
proxy_read_timeout 75s;
|
||||
}
|
||||
|
||||
# SIP over WebSocket для встроенного WebRTC-телефона. Переменная и
|
||||
# Docker DNS позволяют фронту стартовать даже до sip-сервиса.
|
||||
location = /sip-ws {
|
||||
resolver 127.0.0.11 ipv6=off valid=10s;
|
||||
set $sip_backend sip;
|
||||
proxy_pass http://$sip_backend:8088/ws;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
}
|
||||
|
||||
location ~* \.(?:css|js|woff2?|png|svg)$ {
|
||||
try_files $uri =404;
|
||||
expires 1y;
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
server {
|
||||
listen 5173;
|
||||
server_name _;
|
||||
return 308 https://$host:${PUBLIC_TLS_PORT}$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 5443 ssl;
|
||||
http2 on;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
ssl_certificate /etc/nginx/tls/tls.crt;
|
||||
ssl_certificate_key /etc/nginx/tls/tls.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_session_cache shared:LCT_TLS:10m;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_tickets off;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header Referrer-Policy "same-origin" always;
|
||||
|
||||
gzip on;
|
||||
gzip_static on;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 6;
|
||||
gzip_min_length 1024;
|
||||
gzip_types application/javascript application/json image/svg+xml text/css text/plain;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://${BACKEND_HOST}:${BACKEND_PORT};
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
}
|
||||
|
||||
location /ws/ {
|
||||
proxy_pass http://${BACKEND_HOST}:${BACKEND_PORT};
|
||||
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-Forwarded-Host $http_host;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_read_timeout 75s;
|
||||
}
|
||||
|
||||
# SIP over WebSocket для встроенного WebRTC-телефона. Переменная и
|
||||
# Docker DNS позволяют обычному TLS-стенду стартовать даже до sip-сервиса.
|
||||
location = /sip-ws {
|
||||
resolver 127.0.0.11 ipv6=off valid=10s;
|
||||
set $sip_backend sip;
|
||||
proxy_pass http://$sip_backend:8088/ws;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
}
|
||||
|
||||
location ~* \.(?:css|js|woff2?|png|svg)$ {
|
||||
try_files $uri =404;
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
add_header Cache-Control "no-cache";
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue