mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 12:43:12 +03:00
Добавлен revers proxy (nginx). Теперь ChartService не запустится, пока postgres не будет готов принимать запросы
This commit is contained in:
parent
a1727c4ef6
commit
bc4dddd4c5
2 changed files with 80 additions and 5 deletions
|
@ -1,13 +1,23 @@
|
||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx:latest
|
||||||
|
ports:
|
||||||
|
- '80:80'
|
||||||
|
- '443:443'
|
||||||
|
volumes:
|
||||||
|
- ./nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
- ./CertSSL:/etc/nginx/ssl
|
||||||
|
depends_on:
|
||||||
|
- server
|
||||||
|
- chart
|
||||||
|
|
||||||
server:
|
server:
|
||||||
build:
|
build:
|
||||||
context: ./
|
context: ./
|
||||||
dockerfile: Dockerfile-server
|
dockerfile: Dockerfile-server
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- '0.0.0.0:3000:3000'
|
- '3000:3000'
|
||||||
volumes:
|
volumes:
|
||||||
- './CertSSL:/CertSSL'
|
- './CertSSL:/CertSSL'
|
||||||
- './config.yaml:/config.yaml'
|
- './config.yaml:/config.yaml'
|
||||||
|
@ -19,12 +29,13 @@ services:
|
||||||
context: ./chart
|
context: ./chart
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- '0.0.0.0:3030:3030'
|
- '3030:3030'
|
||||||
volumes:
|
volumes:
|
||||||
- './CertSSL:/CertSSL'
|
- './CertSSL:/CertSSL'
|
||||||
- './config.yaml:/config.yaml'
|
- './config.yaml:/config.yaml'
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
collect-currency:
|
collect-currency:
|
||||||
build:
|
build:
|
||||||
|
@ -40,8 +51,15 @@ services:
|
||||||
image: postgres:latest
|
image: postgres:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: .env
|
env_file: .env
|
||||||
|
ports:
|
||||||
|
- '5432:5432'
|
||||||
volumes:
|
volumes:
|
||||||
- ./postgres-data:/var/lib/postgresql/data
|
- ./postgres-data:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
server:
|
server:
|
||||||
|
|
57
nginx.conf
Normal file
57
nginx.conf
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
events { }
|
||||||
|
|
||||||
|
http {
|
||||||
|
upstream server_backend {
|
||||||
|
server server:3000;
|
||||||
|
}
|
||||||
|
|
||||||
|
upstream chart_backend {
|
||||||
|
server chart:3030;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost; # Your domain
|
||||||
|
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://server_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/getChart {
|
||||||
|
proxy_pass http://chart_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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://server_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/getChart {
|
||||||
|
proxy_pass http://chart_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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue