itcloud/DEPLOYMENT.md

96 lines
2.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Инструкция по развертыванию
## Текущая конфигурация (разработка)
Сейчас проект настроен для локальной сети на IP `192.168.1.8`:
- Frontend: http://192.168.1.8:8095
- Backend: http://192.168.1.8:8094
- MinIO Console: http://192.168.1.8:9091
## Переход на домен (production)
Когда будете ставить на домен, просто отредактируйте файл `.env`:
### Вариант 1: Домен без поддомена
```bash
# .env
SERVER_IP=yourdomain.com
CORS_ORIGINS=https://yourdomain.com,https://www.yourdomain.com
VITE_API_URL=https://yourdomain.com:8094
# Рекомендуется сменить порты на стандартные через nginx:
# FRONTEND_PORT=80 (или 443 для HTTPS)
# BACKEND_PORT=8080 (скрыть за nginx reverse proxy)
```
### Вариант 2: С поддоменом для API (рекомендуется)
```bash
# .env
SERVER_IP=yourdomain.com
CORS_ORIGINS=https://yourdomain.com,https://www.yourdomain.com,https://api.yourdomain.com
VITE_API_URL=https://api.yourdomain.com
# Настроить nginx reverse proxy:
# yourdomain.com -> frontend:8095
# api.yourdomain.com -> backend:8094
```
### Обязательно измените в production:
```bash
JWT_SECRET=ваш-очень-длинный-случайный-секретный-ключ
MINIO_ROOT_USER=ваш-логин
MINIO_ROOT_PASSWORD=ваш-сильный-пароль
```
## Настройка HTTPS (nginx + Let's Encrypt)
Создайте `nginx.conf`:
```nginx
# Frontend
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
location / {
proxy_pass http://localhost:8095;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
# Backend API
server {
listen 80;
server_name api.yourdomain.com;
location / {
proxy_pass http://localhost:8094;
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;
}
}
```
Затем установите SSL сертификаты:
```bash
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com -d api.yourdomain.com
```
## Быстрая смена конфигурации
1. Отредактируйте `.env`
2. Перезапустите контейнеры:
```bash
docker-compose down
docker-compose up -d
```
Готово! 🚀