fix balancer

This commit is contained in:
ddadmin 2024-05-24 20:08:06 +03:00
parent 1af8160473
commit 8788e1cfe4
6 changed files with 184 additions and 0 deletions

1
.env
View File

@ -3,6 +3,7 @@ NETWORK=prod
FRONT_TAG=master
DOTDOT_TAG=master
LMS_TAG=master
HELP_TAG=master
PHP_SOCKET_PORT=8080

13
configs/lms/.env Normal file
View File

@ -0,0 +1,13 @@
NUXT_HOST=0.0.0.0
NUXT_PORT=3000
NUXT_ENV_DEVALUE_LOG_LEVEL=silent
WS_PROTOCOL=wss
BASE_URL=https://lms.dot-dot.ru/
API_URL=https://lms.dot-dot.ru/
DOMAIN=lms.dot-dot.ru
APP_HOST=lms.dot-dot.ru
APP_SCHEME=https
APP_ENVIRONMENT=development
DADATA_API_TOKEN=c9aa5fdc338a746e23ce91ceb6fdb9e635749833
YANDEX_METRIKA_ID=50156956

View File

@ -0,0 +1,25 @@
server {
listen 80;
server_name demolms.dot-dot.ru;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name demolms.dot-dot.ru;
ssl_certificate /etc/nginx/ssl/dot2023.crt;
ssl_certificate_key /etc/nginx/ssl/dot2023.key;
location ~ /.* {
proxy_pass http://demolms-nginx;
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;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
}

View File

@ -0,0 +1,125 @@
server {
listen 80;
server_name lms.dot-dot.ru;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name lms.dot-dot.ru;
ssl_certificate /etc/nginx/ssl/dot2023.crt;
ssl_certificate_key /etc/nginx/ssl/dot2023.key;
root /application/public;
location / {
proxy_pass http://lms:3000;
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;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
location /socket.io/auctionreload {
access_log /var/log/nginx/ws_access.log json;
error_log /var/log/nginx/ws_error.log;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_pass http://php:8080/;
}
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
# location /storybook {
# alias /application/nuxt/storybook-static;
# }
location /logout {
try_files $uri @rewriteapp;
}
location /help {
proxy_pass http://help-platform;
}
location /api {
rewrite ^(.*)$ /index.php/$1 last;
}
location /clockwork {
rewrite ^(.*)$ /index.php/$1 last;
}
location /__clockwork {
rewrite ^(.*)$ /index.php/$1 last;
}
location /pdf {
rewrite ^(.*)$ /index.php/$1 last;
}
location /1c {
rewrite ^(.*)$ /index.php/$1 last;
}
location /socket {
try_files $uri @rewriteapp;
}
location /admin {
try_files $uri @rewriteapp;
}
location ~* \/admin\/.*(js|jpg|png|css|woff|woff2)$ {
proxy_pass http://static;
}
location /media {
try_files $uri @rewriteapp;
}
location /img {
proxy_pass http://static;
# alias /application/public/img;
# try_files $uri /index.php$request_uri;
# expires 6M;
}
location /robots.txt {
proxy_pass http://static;
}
location ~ ^/index\.php(/|$) {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' $http_origin;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Expeditor-Domain,Authorization';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
#add_header 'Access-Control-Allow-Origin' $http_origin;
add_header 'Access-Control-Allow-Origin' *;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Expeditor-Domain,Authorization';
fastcgi_pass php:9001;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

View File

@ -166,3 +166,9 @@ SMARTCAPTCHA_SERVER_KEY=ysc2_GLQZ8QPaFh0eXqZ5KaRMuRRZOX7qNNMy7P9Mq82V6c4e7b81
ML_REGULAR_DIRECTION_RELEVANCE_CARRIERS_URL=https://ml.dot-dot.ru/v1/schedule/carrier/scoring
ML_UNCERTAIN_DIRECTIONS_URL=https://ml.dot-dot.ru/v1/classification/direction/uncertain
###> sentry/sentry-symfony ###
SENTRY_DSN="https://eedc2e8b1310ec9b04c2b0da8490dc01@sentry.dot-dot.ru/3"
SENTRY_SERVER_NAME=prod
SENTRY_SERVER_USER_NAME=admin
###< sentry/sentry-symfony ###

View File

@ -14,6 +14,8 @@ volumes:
networks:
dd:
name: ${NETWORK}
ingress:
external: true
services:
db:
@ -57,6 +59,17 @@ services:
networks:
- dd
lms:
image: registry.dot-dot.ru/lms:${LMS_TAG}
restart: unless-stopped
command: npm run start
volumes:
- ./configs/lms/.env:/app/.env
env_file:
- ./configs/lms/.env
networks:
- dd
static:
image: registry.dot-dot.ru/dot-dot-static:${DOTDOT_TAG}
restart: unless-stopped
@ -104,6 +117,7 @@ services:
- static
networks:
- dd
- ingress
node-exporter:
image: prom/node-exporter:v1.7.0