Files
global_it24_landing/TRAEFIK_QUICKSTART.md

149 lines
3.3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.
# 🚀 Быстрая настройка Traefik File Provider
## ✅ Что уже готово
Приложение развернуто на этом сервере и слушает порт **3000**.
```bash
./status.sh # Проверить статус
```
---
## 📝 Что нужно сделать на сервере с Traefik
### 1⃣ Скопируйте конфигурацию
На сервере с Traefik создайте файл:
```bash
sudo nano /etc/traefik/dynamic/global-it24.yml
```
Вставьте содержимое из файла `traefik-file-provider.yml` этого репозитория.
### 2⃣ Замените IP
Найдите строку:
```yaml
- url: "http://IP_ХОСТА_СРИЛОЖЕНИЕМ:3000"
```
Замените на IP **этого сервера** (где запущено приложение):
```yaml
- url: "http://192.168.1.100:3000" # ← Ваш реальный IP
```
### 3⃣ Сохраните и проверьте
```bash
# Traefik автоматически подхватит изменения (если watch: true)
docker logs traefik --tail 20
# Должно показать:
# "Configuration loaded from file: /etc/traefik/dynamic/global-it24.yml"
```
### 4⃣ Проверьте работу
```bash
curl -I https://video.mscsrv.ru
# Должно вернуть: HTTP/2 200
```
---
## 🔒 Настройка Firewall (опционально, но рекомендуется)
На **этом сервере** (где приложение):
```bash
# Узнайте IP сервера Traefik
echo "Введите IP сервера Traefik:"
read TRAEFIK_IP
# Разрешите доступ к порту 3000 только с IP Traefik
sudo ufw allow from $TRAEFIK_IP to any port 3000 proto tcp comment 'Traefik proxy'
sudo ufw status
```
---
## 📊 Проверка
### На этом сервере:
```bash
cd /home/ubuntu/global_it24_landing
# Статус контейнеров
./status.sh
# Логи
./logs.sh
# Тест локально
curl -I http://localhost:3000
```
### С сервера Traefik:
```bash
# Проверка доступности приложения
curl -I http://IP_ЭТОГО_СЕРВЕРА:3000
# Должно вернуть: HTTP/1.1 200 OK
```
### Из интернета:
```bash
curl -I https://video.mscsrv.ru
# Должно вернуть: HTTP/2 200
```
---
## 🔧 Troubleshooting
### 502 Bad Gateway
```bash
# Проверьте что приложение запущено
./status.sh
# Должно показать:
# ✅ global-it24-landing Up (healthy)
```
### 404 Not Found
На сервере с Traefik проверьте:
```bash
cat /etc/traefik/dynamic/global-it24.yml | grep "Host("
# Должно показать: rule: "Host(`video.mscsrv.ru`)"
```
### Connection refused
Проверьте firewall:
```bash
# На этом сервере
sudo ufw status | grep 3000
# Если порт закрыт - откройте для IP Traefik
sudo ufw allow from TRAEFIK_IP to any port 3000
```
---
## 📄 Полная документация
Смотрите файл: **README.traefik.md**
---
**Готово! Приложение работает.**
Теперь настройте Traefik на другом сервере по инструкции выше. 🚀