Files
football-next/SIMPLE_DEPLOY.md

156 lines
3.7 KiB
Markdown
Raw 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.
# راهنمای ساده دیپلوی (بدون دسترسی بین‌الملل)
## شما فقط ۲ راه دارید:
---
## 🎯 راه ۱: Build روی سیستم دیگه (توصیه می‌شه)
### نیاز: یک سیستم/لپ‌تاپ با VPN یا دسترسی آزاد
**گام ۱: Build کردن Image**
روی سیستم با VPN:
```bash
# Clone
git clone https://mugit.ir/alisaeed/football-next.git
cd football-next
# Build
docker build -t football-next:latest \
--build-arg DATABASE_URL="postgresql://user:pass@host:5432/db" \
--build-arg NEXTAUTH_URL="https://yourdomain.com" \
--build-arg NEXTAUTH_SECRET="your-secret-min-32-chars" \
.
# Save
docker save football-next:latest | gzip > football-next.tar.gz
```
**گام ۲: انتقال به سرور**
```bash
# با SCP (اگر IP سرور دارید)
scp football-next.tar.gz user@server-ip:/tmp/
# یا آپلود به سایت فایل ایرانی و لینک دانلود بگیرید
```
**گام ۳: Load در سرور**
```bash
# SSH به سرور
ssh user@server-ip
# Load
cd /tmp
gunzip -c football-next.tar.gz | docker load
# بررسی
docker images | grep football-next
```
**گام ۴: استفاده در Coolify**
1. در Coolify → New Resource → Docker Image
2. Image Name: `football-next:latest`
3. تنظیم Environment Variables:
- `DATABASE_URL`
- `NEXTAUTH_URL`
- `NEXTAUTH_SECRET`
4. Deploy
**تمام!**
---
## 🎯 راه ۲: Pre-generate کردن Prisma (پیچیده‌تر)
### نیاز: یک بار روی سیستم با VPN
**گام ۱: Generate کردن Prisma**
روی سیستم با VPN:
```bash
git clone https://mugit.ir/alisaeed/football-next.git
cd football-next
npm install
npx prisma generate
# کپی کردن فایل‌ها
mkdir -p prisma/generated
cp -r node_modules/.prisma/client prisma/generated/.prisma-client
cp -r node_modules/@prisma/client prisma/generated/@prisma-client
```
**گام ۲: Commit و Push**
```bash
git add prisma/generated Dockerfile
git commit -m "Add pre-generated Prisma client"
git push
```
**گام ۳: Deploy در Coolify**
Coolify خودش build می‌گیره و deploy می‌کنه.
⚠️ **مشکل:** ممکنه باز هم به دلیل Docker base image مشکل داشته باشید.
---
## 💡 توصیه نهایی
**استفاده از راه ۱** چون:
- ✅ ۱۰۰٪ کار می‌کنه
- ✅ ساده‌تره
- ✅ سریع‌تره (یک بار ۲۰۰-۳۰۰ مگ)
- ✅ دیگه نیازی به build روی سرور نیست
---
## حجم و زمان
- حجم فایل: ~250 MB (فشرده شده)
- زمان آپلود با اینترنت ۱۰ مگ: ~4 دقیقه
- زمان download در سرور: ~2 دقیقه
---
## سوالات متداول
**س: آیا هر بار باید دوباره build بگیرم؟**
ج: بله، هر بار که کد تغییر کرد.
**س: آیا می‌تونم از Docker Hub استفاده کنم؟**
ج: اگر سرور به Docker Hub دسترسی داره، بله:
```bash
docker push your-username/football-next:latest
# در سرور:
docker pull your-username/football-next:latest
```
**س: آیا می‌تونم از GitHub Actions استفاده کنم؟**
ج: بله! می‌تونید یک workflow بسازید که خودکار build بگیره و push کنه.
---
## Environment Variables مورد نیاز
```env
DATABASE_URL=postgresql://username:password@host:5432/database_name
NEXTAUTH_URL=https://your-domain.com
NEXTAUTH_SECRET=your-secret-key-minimum-32-characters-long
IPPANEL_TOKEN=your-token-if-you-have (optional)
```
---
## کمک بیشتر
- `DEPLOY_RUNFLARE.md` - جزئیات بیشتر
- `REQUIRED_SITES.md` - لیست سایت‌های مورد نیاز