initial commit
This commit is contained in:
21
docker-compose.dev.yml
Normal file
21
docker-compose.dev.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
services:
|
||||
admin-dev:
|
||||
build:
|
||||
context: ../admin
|
||||
dockerfile: Dockerfile.dev
|
||||
container_name: cemetery_admin_dev
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
volumes:
|
||||
# Горячая перезагрузка из репозитория на сервере
|
||||
- ../admin:/app
|
||||
- /app/node_modules # исключаем node_modules из volume
|
||||
networks:
|
||||
- web
|
||||
ports:
|
||||
- "5173:5173"
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
web:
|
||||
driver: bridge
|
||||
81
docker-compose.yml
Normal file
81
docker-compose.yml
Normal file
@@ -0,0 +1,81 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:15
|
||||
container_name: cemetery_db
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_DB: cemeterymap
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- web
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: ../backend
|
||||
image: ${BACKEND_IMAGE:-cemetery/backend:latest}
|
||||
container_name: cemetery_backend
|
||||
depends_on:
|
||||
- db
|
||||
environment:
|
||||
ENVIRONMENT: production
|
||||
DATABASE_URL: postgresql+psycopg2://postgres:${POSTGRES_PASSWORD:-postgres}@db:5432/cemeterymap
|
||||
JWT_SECRET_KEY: ${JWT_SECRET_KEY:-change-me}
|
||||
ADMIN_ORIGIN: ${ADMIN_ORIGIN:-https://cemeterymap.ru}
|
||||
MOBILE_ORIGIN: ${MOBILE_ORIGIN:-http://localhost}
|
||||
UPLOADS_GRAVES_DIR: /data/uploads/graves
|
||||
UPLOADS_TEMP_DIR: /data/uploads/tmp
|
||||
FCM_SERVER_KEY: ${FCM_SERVER_KEY:-}
|
||||
volumes:
|
||||
- uploads:/data/uploads
|
||||
networks:
|
||||
- web
|
||||
ports:
|
||||
- "127.0.0.1:8000:8000"
|
||||
|
||||
admin:
|
||||
build:
|
||||
context: ../admin
|
||||
image: ${ADMIN_IMAGE:-cemetery/admin:latest}
|
||||
container_name: cemetery_admin
|
||||
networks:
|
||||
- web
|
||||
ports:
|
||||
- "127.0.0.1:8081:80"
|
||||
|
||||
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:v2.54.1
|
||||
container_name: cemetery_prometheus
|
||||
volumes:
|
||||
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
ports:
|
||||
- "9090:9090"
|
||||
networks:
|
||||
- web
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:10.4.5
|
||||
container_name: cemetery_grafana
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_USER=${GRAFANA_USER:-admin}
|
||||
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}
|
||||
ports:
|
||||
- "3001:3000"
|
||||
networks:
|
||||
- web
|
||||
depends_on:
|
||||
- prometheus
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
uploads:
|
||||
|
||||
networks:
|
||||
web:
|
||||
driver: bridge
|
||||
|
||||
|
||||
9
monitoring/prometheus.yml
Normal file
9
monitoring/prometheus.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'nginx'
|
||||
static_configs:
|
||||
- targets: ['nginx:80']
|
||||
|
||||
|
||||
73
nginx.conf
Normal file
73
nginx.conf
Normal file
@@ -0,0 +1,73 @@
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
events { worker_connections 1024; }
|
||||
|
||||
# map $http_upgrade $connection_upgrade {
|
||||
# default upgrade;
|
||||
# '' close;
|
||||
# }
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
upstream backend_upstream {
|
||||
server backend:8000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
# API proxy
|
||||
location /api/ {
|
||||
proxy_pass http://backend_upstream/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;
|
||||
}
|
||||
|
||||
# Static graves photos
|
||||
location /static/graves/ {
|
||||
alias /data/uploads/graves/;
|
||||
autoindex off;
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
}
|
||||
|
||||
# Admin SPA
|
||||
location /admin/ {
|
||||
proxy_pass http://admin/;
|
||||
sub_filter '/api' '/api';
|
||||
sub_filter_once off;
|
||||
}
|
||||
|
||||
# Root can serve a simple health page
|
||||
location = /health {
|
||||
return 200 'OK';
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
server_name dev.cemeterymap.ru;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:5173;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
# Важные заголовки для Vite HMR
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user