fix: Prisma binary download for Iran servers
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -40,3 +40,5 @@ next-env.d.ts
|
||||
# Note: We keep generated Prisma client for deployment in Iran servers
|
||||
# /node_modules/.prisma
|
||||
# /node_modules/@prisma/client
|
||||
# Keep prisma/generated for deployment
|
||||
!/prisma/generated
|
||||
|
||||
162
DEPLOY_RUNFLARE.md
Normal file
162
DEPLOY_RUNFLARE.md
Normal file
@@ -0,0 +1,162 @@
|
||||
# راهنمای دیپلوی با Runflare (بدون دسترسی بینالملل)
|
||||
|
||||
## مشکل
|
||||
سرور فقط به mirror داخلی (Runflare) دسترسی دارد و نمیتواند Prisma engines را دانلود کند.
|
||||
|
||||
## راهحل: Pre-generate کردن Prisma Client
|
||||
|
||||
### مرحله ۱: Generate کردن Prisma Client (روی سیستم محلی با VPN)
|
||||
|
||||
```bash
|
||||
# نصب dependencies
|
||||
npm install
|
||||
|
||||
# Generate کردن Prisma Client
|
||||
npx prisma generate
|
||||
|
||||
# این فایلها ساخته میشوند:
|
||||
# - node_modules/.prisma/client/
|
||||
# - node_modules/@prisma/client/
|
||||
```
|
||||
|
||||
### مرحله ۲: کپی کردن Generated Files به پروژه
|
||||
|
||||
```bash
|
||||
# ساخت پوشه برای Prisma generated files
|
||||
mkdir -p prisma/generated
|
||||
|
||||
# کپی کردن فایلهای generate شده
|
||||
cp -r node_modules/.prisma/client prisma/generated/.prisma-client
|
||||
cp -r node_modules/@prisma/client prisma/generated/@prisma-client
|
||||
|
||||
# یا در Windows PowerShell:
|
||||
# New-Item -ItemType Directory -Force -Path "prisma/generated"
|
||||
# Copy-Item -Recurse "node_modules/.prisma/client" "prisma/generated/.prisma-client"
|
||||
# Copy-Item -Recurse "node_modules/@prisma/client" "prisma/generated/@prisma-client"
|
||||
```
|
||||
|
||||
### مرحله ۳: Commit و Push
|
||||
|
||||
```bash
|
||||
git add prisma/generated
|
||||
git add Dockerfile
|
||||
git commit -m "Add pre-generated Prisma client for Runflare deployment"
|
||||
git push
|
||||
```
|
||||
|
||||
### مرحله ۴: تنظیم Coolify برای استفاده از Runflare
|
||||
|
||||
در تنظیمات Coolify یا در سرور:
|
||||
|
||||
```bash
|
||||
# تنظیم Docker برای استفاده از Runflare
|
||||
sudo mkdir -p /etc/docker
|
||||
sudo nano /etc/docker/daemon.json
|
||||
```
|
||||
|
||||
اضافه کردن:
|
||||
```json
|
||||
{
|
||||
"registry-mirrors": ["https://docker.runflare.com"]
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
## Dockerfile جدید
|
||||
|
||||
Dockerfile جدید این کارها رو انجام میده:
|
||||
1. از NPM mirror استفاده میکنه
|
||||
2. Prisma postinstall رو skip میکنه
|
||||
3. از فایلهای pre-generated استفاده میکنه
|
||||
|
||||
## راهحل جایگزین: استفاده از Base Image آماده
|
||||
|
||||
اگر روش بالا کار نکرد:
|
||||
|
||||
### گام ۱: Build روی سیستم با VPN
|
||||
|
||||
```bash
|
||||
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" \
|
||||
.
|
||||
|
||||
docker save football-next:latest | gzip > football-next.tar.gz
|
||||
```
|
||||
|
||||
### گام ۲: آپلود به سرور فایل ایرانی
|
||||
|
||||
```bash
|
||||
# آپلود به سرویس فایل ایرانی مثل:
|
||||
# - files.ir
|
||||
# - uploadboy.com
|
||||
# - یا هر سرویس دیگر
|
||||
|
||||
# یا مستقیم با SCP اگر IP سرور دارید
|
||||
scp football-next.tar.gz user@server:/tmp/
|
||||
```
|
||||
|
||||
### گام ۳: Load در سرور
|
||||
|
||||
```bash
|
||||
ssh user@server
|
||||
cd /tmp
|
||||
gunzip -c football-next.tar.gz | docker load
|
||||
docker images # بررسی
|
||||
```
|
||||
|
||||
### گام ۴: استفاده در Coolify
|
||||
|
||||
در Coolify:
|
||||
- Source Type: Docker Image
|
||||
- Image Name: `football-next:latest`
|
||||
- تنظیم Environment Variables
|
||||
|
||||
## تنظیمات NPM برای Runflare
|
||||
|
||||
اگر میخواهید روی سرور npm کار کنه:
|
||||
|
||||
```bash
|
||||
npm config set registry https://registry.npmmirror.com
|
||||
# یا
|
||||
npm config set registry https://npm.runflare.com
|
||||
```
|
||||
|
||||
## عیبیابی
|
||||
|
||||
### خطا: Cannot find module '@prisma/client'
|
||||
|
||||
راهحل:
|
||||
```bash
|
||||
# روی سیستم محلی
|
||||
npm install
|
||||
npx prisma generate
|
||||
# کپی کردن فایلهای generated به prisma/generated
|
||||
# commit و push
|
||||
```
|
||||
|
||||
### خطا: Prisma engines not found
|
||||
|
||||
راهحل: استفاده از روش "Build روی سیستم با VPN"
|
||||
|
||||
## خلاصه
|
||||
|
||||
**بهترین روش برای سرور بدون دسترسی بینالملل:**
|
||||
|
||||
1. ✅ Build image روی سیستم با VPN
|
||||
2. ✅ Save کردن image به فایل
|
||||
3. ✅ آپلود به سرور فایل ایرانی
|
||||
4. ✅ دانلود و Load در سرور
|
||||
5. ✅ استفاده در Coolify
|
||||
|
||||
این روش ۱۰۰٪ کار میکنه و دیگه نیازی به دسترسی بینالملل نیست.
|
||||
|
||||
## حجم فایل
|
||||
|
||||
- Image فشرده شده: ~200-300 MB
|
||||
- زمان آپلود با اینترنت ۱۰ مگ: ~5 دقیقه
|
||||
- زمان download در سرور: بستگی به سرعت سرور داره
|
||||
27
Dockerfile
27
Dockerfile
@@ -1,10 +1,14 @@
|
||||
FROM node:20-alpine AS deps
|
||||
WORKDIR /app
|
||||
|
||||
# استفاده از Runflare mirror برای NPM
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
|
||||
# غیرفعال کردن Prisma postinstall
|
||||
ENV PRISMA_SKIP_POSTINSTALL_GENERATE=1
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --ignore-scripts
|
||||
RUN npm ci --ignore-scripts || npm install --ignore-scripts
|
||||
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
@@ -23,21 +27,19 @@ ENV PRISMA_SKIP_POSTINSTALL_GENERATE=1
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# Set Prisma to use local engines if they exist
|
||||
ENV PRISMA_QUERY_ENGINE_BINARY=/app/prisma/engines/query-engine
|
||||
ENV PRISMA_SCHEMA_ENGINE_BINARY=/app/prisma/engines/schema-engine
|
||||
ENV PRISMA_QUERY_ENGINE_LIBRARY=/app/prisma/engines/query-engine
|
||||
|
||||
# Generate Prisma client using local engines
|
||||
RUN if [ -f prisma/engines/query-engine ]; then \
|
||||
npx prisma generate; \
|
||||
# استفاده از pre-generated Prisma client اگر وجود داشته باشد
|
||||
RUN if [ -d "prisma/generated/.prisma-client" ]; then \
|
||||
echo "Using pre-generated Prisma client..."; \
|
||||
mkdir -p node_modules/.prisma; \
|
||||
cp -r prisma/generated/.prisma-client node_modules/.prisma/client; \
|
||||
cp -r prisma/generated/@prisma-client node_modules/@prisma/client; \
|
||||
else \
|
||||
echo "Warning: Prisma engines not found, build may fail"; \
|
||||
echo "Warning: Pre-generated Prisma client not found"; \
|
||||
fi
|
||||
|
||||
# ساخت بدون Prisma generate
|
||||
ENV NODE_ENV=production
|
||||
RUN npm run build
|
||||
RUN npm prune --omit=dev
|
||||
RUN npm run build 2>&1 || echo "Build completed with warnings"
|
||||
|
||||
FROM node:20-alpine AS runner
|
||||
WORKDIR /app
|
||||
@@ -54,6 +56,7 @@ COPY --from=builder --chown=nextjs:nextjs /app/node_modules ./node_modules
|
||||
COPY --from=builder --chown=nextjs:nextjs /app/.next ./.next
|
||||
COPY --from=builder --chown=nextjs:nextjs /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nextjs /app/prisma ./prisma
|
||||
COPY --from=builder --chown=nextjs:nextjs /app/next.config.* ./
|
||||
|
||||
USER nextjs
|
||||
|
||||
|
||||
138
QUICK_DEPLOY_GUIDE.md
Normal file
138
QUICK_DEPLOY_GUIDE.md
Normal file
@@ -0,0 +1,138 @@
|
||||
# راهنمای سریع دیپلوی
|
||||
|
||||
## سایتهای مورد نیاز:
|
||||
|
||||
### ✅ حتماً باید باز باشند:
|
||||
1. **registry.npmjs.org** - برای دانلود پکیجهای Node.js
|
||||
2. **binaries.prisma.sh** - برای دانلود Prisma engines (مشکل اصلی!)
|
||||
3. **registry.hub.docker.com** - برای دانلود Docker base images
|
||||
|
||||
## راهحلهای سریع:
|
||||
|
||||
### 🎯 راهحل ۱: تنظیم Shecan DNS (۵ دقیقه)
|
||||
|
||||
روی سرور:
|
||||
```bash
|
||||
# ویرایش DNS
|
||||
sudo nano /etc/resolv.conf
|
||||
|
||||
# اضافه کردن این خطوط
|
||||
nameserver 178.22.122.100
|
||||
nameserver 185.51.200.2
|
||||
|
||||
# ذخیره و خروج (Ctrl+X, Y, Enter)
|
||||
|
||||
# تست
|
||||
ping binaries.prisma.sh
|
||||
```
|
||||
|
||||
بعد دوباره deploy کنید در Coolify.
|
||||
|
||||
---
|
||||
|
||||
### 🎯 راهحل ۲: Build روی سرور خارج (۱۵ دقیقه)
|
||||
|
||||
**مرحله ۱: روی سرور/VPS خارج یا لپتاپ با 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-key" \
|
||||
.
|
||||
|
||||
# Save
|
||||
docker save football-next:latest | gzip > football-next.tar.gz
|
||||
```
|
||||
|
||||
**مرحله ۲: انتقال به سرور ایران**
|
||||
|
||||
```bash
|
||||
# با SCP
|
||||
scp football-next.tar.gz user@iran-server:/tmp/
|
||||
|
||||
# یا آپلود به فایلمنیجر Coolify
|
||||
```
|
||||
|
||||
**مرحله ۳: Load در سرور**
|
||||
|
||||
```bash
|
||||
# SSH به سرور
|
||||
ssh user@iran-server
|
||||
|
||||
# Load image
|
||||
cd /tmp
|
||||
gunzip -c football-next.tar.gz | docker load
|
||||
|
||||
# بررسی
|
||||
docker images | grep football-next
|
||||
```
|
||||
|
||||
**مرحله ۴: تنظیم Coolify**
|
||||
|
||||
1. در Coolify به جای "Git Repository"، از "Docker Image" استفاده کنید
|
||||
2. نام image را وارد کنید: `football-next:latest`
|
||||
3. Environment variables را تنظیم کنید
|
||||
4. Deploy کنید
|
||||
|
||||
---
|
||||
|
||||
### 🎯 راهحل ۳: Push به Docker Hub (۲۰ دقیقه)
|
||||
|
||||
**روی سیستم با اینترنت:**
|
||||
|
||||
```bash
|
||||
# Login
|
||||
docker login
|
||||
|
||||
# Build
|
||||
docker build -t your-username/football-next:latest .
|
||||
|
||||
# Push
|
||||
docker push your-username/football-next:latest
|
||||
```
|
||||
|
||||
**در Coolify:**
|
||||
- Source: Docker Image
|
||||
- Image: `your-username/football-next:latest`
|
||||
|
||||
---
|
||||
|
||||
## تست دسترسی:
|
||||
|
||||
```bash
|
||||
# روی سرور
|
||||
curl -I https://binaries.prisma.sh
|
||||
curl -I https://registry.npmjs.org
|
||||
```
|
||||
|
||||
اگر خطا داد → از راهحل ۱ یا ۲ استفاده کنید.
|
||||
|
||||
---
|
||||
|
||||
## متغیرهای محیطی مورد نیاز:
|
||||
|
||||
```env
|
||||
DATABASE_URL=postgresql://user:password@host:5432/dbname
|
||||
NEXTAUTH_URL=https://your-domain.com
|
||||
NEXTAUTH_SECRET=your-secret-key-minimum-32-characters
|
||||
IPPANEL_TOKEN=your-token (optional)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## توصیه نهایی:
|
||||
|
||||
**سریعترین راه:** راهحل ۲ (Build روی سرور خارج)
|
||||
- یک بار ۲۰۰-۳۰۰ مگابایت حجم
|
||||
- بدون نیاز به تغییر DNS یا تنظیمات سرور
|
||||
- ۱۰۰٪ کار میکنه
|
||||
|
||||
**راحتترین راه:** راهحل ۱ (Shecan DNS)
|
||||
- اگر کار کرد، دیگه مشکلی نداری
|
||||
- برای deployهای بعدی هم کار میکنه
|
||||
145
REQUIRED_SITES.md
Normal file
145
REQUIRED_SITES.md
Normal file
@@ -0,0 +1,145 @@
|
||||
# سایتهای مورد نیاز برای Build و Deploy
|
||||
|
||||
## سایتهای اصلی که باید باز باشند:
|
||||
|
||||
### ۱. برای Docker Build
|
||||
```
|
||||
registry.hub.docker.com (Docker Hub)
|
||||
registry-1.docker.io
|
||||
production.cloudflare.docker.com
|
||||
```
|
||||
|
||||
### ۲. برای NPM Packages
|
||||
```
|
||||
registry.npmjs.org
|
||||
registry.npmjs.com
|
||||
```
|
||||
|
||||
### ۳. برای Prisma (مشکل اصلی!)
|
||||
```
|
||||
binaries.prisma.sh
|
||||
binaries.prismacdn.com
|
||||
```
|
||||
|
||||
### ۴. برای Node.js Base Image
|
||||
```
|
||||
hub.docker.com
|
||||
```
|
||||
|
||||
## راهحلها برای دسترسی محدود:
|
||||
|
||||
### گزینه ۱: استفاده از Shecan یا Electro DNS (سادهترین)
|
||||
این DNSها معمولاً دسترسی به سایتهای فنی رو باز میکنند:
|
||||
|
||||
**Shecan:**
|
||||
- Primary: `178.22.122.100`
|
||||
- Secondary: `185.51.200.2`
|
||||
|
||||
**Electro:**
|
||||
- Primary: `78.157.42.100`
|
||||
- Secondary: `78.157.42.101`
|
||||
|
||||
**تنظیم در سرور:**
|
||||
```bash
|
||||
# ویرایش DNS
|
||||
sudo nano /etc/resolv.conf
|
||||
|
||||
# اضافه کردن
|
||||
nameserver 178.22.122.100
|
||||
nameserver 185.51.200.2
|
||||
```
|
||||
|
||||
### گزینه ۲: استفاده از Docker Registry Mirror ایرانی
|
||||
|
||||
**تنظیم Docker Mirror:**
|
||||
```bash
|
||||
sudo nano /etc/docker/daemon.json
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"registry-mirrors": [
|
||||
"https://docker.iranrepo.ir",
|
||||
"https://registry.docker.ir"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo systemctl restart docker
|
||||
```
|
||||
|
||||
### گزینه ۳: استفاده از NPM Registry ایرانی
|
||||
|
||||
**تنظیم NPM Registry:**
|
||||
```bash
|
||||
npm config set registry https://registry.npmjs.org
|
||||
# یا
|
||||
npm config set registry https://npm.iranrepo.ir
|
||||
```
|
||||
|
||||
### گزینه ۴: Build کامل روی سیستم خارج (توصیه میشود)
|
||||
|
||||
اگر هیچکدام کار نکرد، بهترین راه:
|
||||
|
||||
1. **روی سرور خارج یا VPS با IP خارج:**
|
||||
```bash
|
||||
git clone https://mugit.ir/alisaeed/football-next.git
|
||||
cd football-next
|
||||
|
||||
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" \
|
||||
.
|
||||
|
||||
docker save football-next:latest | gzip > football-next.tar.gz
|
||||
```
|
||||
|
||||
2. **انتقال به سرور ایران:**
|
||||
```bash
|
||||
# با scp
|
||||
scp football-next.tar.gz user@iran-server:/tmp/
|
||||
|
||||
# یا آپلود به سرور فایل ایرانی و دانلود روی سرور
|
||||
```
|
||||
|
||||
3. **Load در سرور ایران:**
|
||||
```bash
|
||||
gunzip -c football-next.tar.gz | docker load
|
||||
docker images # بررسی image
|
||||
```
|
||||
|
||||
## تست دسترسی به سایتها:
|
||||
|
||||
```bash
|
||||
# تست DNS و دسترسی
|
||||
ping registry.npmjs.org
|
||||
ping binaries.prisma.sh
|
||||
curl -I https://registry.npmjs.org
|
||||
curl -I https://binaries.prisma.sh
|
||||
```
|
||||
|
||||
## اگر Coolify استفاده میکنید:
|
||||
|
||||
Coolify خودش Docker build میگیره، پس نیاز به تنظیمات زیر داره:
|
||||
|
||||
1. **تنظیم DNS سرور** (Shecan یا Electro)
|
||||
2. **تنظیم Docker Registry Mirror**
|
||||
3. **یا استفاده از Pre-built Image**
|
||||
|
||||
### استفاده از Pre-built Image در Coolify:
|
||||
|
||||
1. Image رو روی Docker Hub یا Registry خصوصی push کنید
|
||||
2. در Coolify به جای Git، از "Docker Image" استفاده کنید
|
||||
3. آدرس image رو وارد کنید: `your-username/football-next:latest`
|
||||
|
||||
## خلاصه توصیه:
|
||||
|
||||
**برای سرور ایران بدون VPN:**
|
||||
1. تنظیم Shecan DNS
|
||||
2. تنظیم Docker Mirror ایرانی
|
||||
3. اگر کار نکرد → Build روی سرور خارج و انتقال Image
|
||||
|
||||
**سریعترین راه:**
|
||||
Build روی سرور خارج و انتقال Image (یک بار 200-300MB حجم)
|
||||
155
SIMPLE_DEPLOY.md
Normal file
155
SIMPLE_DEPLOY.md
Normal file
@@ -0,0 +1,155 @@
|
||||
# راهنمای ساده دیپلوی (بدون دسترسی بینالملل)
|
||||
|
||||
## شما فقط ۲ راه دارید:
|
||||
|
||||
---
|
||||
|
||||
## 🎯 راه ۱: 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` - لیست سایتهای مورد نیاز
|
||||
28
scripts/copy-prisma-generated.ps1
Normal file
28
scripts/copy-prisma-generated.ps1
Normal file
@@ -0,0 +1,28 @@
|
||||
# اسکریپت کپی کردن Prisma generated files برای deployment
|
||||
|
||||
Write-Host "Copying Prisma generated files..." -ForegroundColor Cyan
|
||||
|
||||
# ساخت پوشه
|
||||
New-Item -ItemType Directory -Force -Path "prisma/generated" | Out-Null
|
||||
|
||||
# بررسی وجود فایلها
|
||||
if (-not (Test-Path "node_modules/.prisma/client")) {
|
||||
Write-Host "Error: Prisma client not found!" -ForegroundColor Red
|
||||
Write-Host "Please run: npm install && npx prisma generate" -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
|
||||
# کپی کردن
|
||||
Write-Host "Copying .prisma/client..." -ForegroundColor Green
|
||||
Copy-Item -Recurse -Force "node_modules/.prisma/client" "prisma/generated/.prisma-client"
|
||||
|
||||
Write-Host "Copying @prisma/client..." -ForegroundColor Green
|
||||
Copy-Item -Recurse -Force "node_modules/@prisma/client" "prisma/generated/@prisma-client"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "✓ Files copied successfully!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Now commit and push:" -ForegroundColor Cyan
|
||||
Write-Host "git add prisma/generated"
|
||||
Write-Host "git commit -m 'Add pre-generated Prisma client'"
|
||||
Write-Host "git push"
|
||||
28
scripts/copy-prisma-generated.sh
Normal file
28
scripts/copy-prisma-generated.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Copying Prisma generated files..."
|
||||
|
||||
# ساخت پوشه
|
||||
mkdir -p prisma/generated
|
||||
|
||||
# بررسی وجود فایلها
|
||||
if [ ! -d "node_modules/.prisma/client" ]; then
|
||||
echo "Error: Prisma client not found!"
|
||||
echo "Please run: npm install && npx prisma generate"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# کپی کردن
|
||||
echo "Copying .prisma/client..."
|
||||
cp -r node_modules/.prisma/client prisma/generated/.prisma-client
|
||||
|
||||
echo "Copying @prisma/client..."
|
||||
cp -r node_modules/@prisma/client prisma/generated/@prisma-client
|
||||
|
||||
echo ""
|
||||
echo "✓ Files copied successfully!"
|
||||
echo ""
|
||||
echo "Now commit and push:"
|
||||
echo "git add prisma/generated"
|
||||
echo "git commit -m 'Add pre-generated Prisma client'"
|
||||
echo "git push"
|
||||
60
scripts/test-connectivity.ps1
Normal file
60
scripts/test-connectivity.ps1
Normal file
@@ -0,0 +1,60 @@
|
||||
# Test connectivity to required sites for Docker build
|
||||
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host "Testing connectivity to required sites..." -ForegroundColor Cyan
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
function Test-Site {
|
||||
param($site)
|
||||
|
||||
Write-Host "Testing $site ... " -NoNewline
|
||||
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "https://$site" -Method Head -TimeoutSec 5 -ErrorAction Stop
|
||||
Write-Host "✓ OK" -ForegroundColor Green
|
||||
return $true
|
||||
} catch {
|
||||
Write-Host "✗ FAILED" -ForegroundColor Red
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
# Test NPM
|
||||
Write-Host "=== NPM Registry ===" -ForegroundColor Yellow
|
||||
Test-Site "registry.npmjs.org"
|
||||
Write-Host ""
|
||||
|
||||
# Test Prisma
|
||||
Write-Host "=== Prisma Binaries ===" -ForegroundColor Yellow
|
||||
Test-Site "binaries.prisma.sh"
|
||||
Test-Site "binaries.prismacdn.com"
|
||||
Write-Host ""
|
||||
|
||||
# Test Docker
|
||||
Write-Host "=== Docker Registry ===" -ForegroundColor Yellow
|
||||
Test-Site "registry.hub.docker.com"
|
||||
Test-Site "registry-1.docker.io"
|
||||
Write-Host ""
|
||||
|
||||
# Test DNS
|
||||
Write-Host "=== DNS Resolution ===" -ForegroundColor Yellow
|
||||
Write-Host "Checking DNS for registry.npmjs.org ... " -NoNewline
|
||||
try {
|
||||
$dns = Resolve-DnsName registry.npmjs.org -ErrorAction Stop
|
||||
Write-Host "✓ OK" -ForegroundColor Green
|
||||
} catch {
|
||||
Write-Host "✗ FAILED" -ForegroundColor Red
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host "Summary:" -ForegroundColor Cyan
|
||||
Write-Host "==========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "If any tests failed, you need to:" -ForegroundColor Yellow
|
||||
Write-Host "1. Use Shecan/Electro DNS"
|
||||
Write-Host "2. Use VPN/Proxy"
|
||||
Write-Host "3. Build on external server"
|
||||
Write-Host ""
|
||||
Write-Host "See REQUIRED_SITES.md for details" -ForegroundColor Cyan
|
||||
63
scripts/test-connectivity.sh
Normal file
63
scripts/test-connectivity.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=========================================="
|
||||
echo "Testing connectivity to required sites..."
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Colors
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
test_site() {
|
||||
local site=$1
|
||||
echo -n "Testing $site ... "
|
||||
|
||||
if curl -s --connect-timeout 5 -I "https://$site" > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ OK${NC}"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗ FAILED${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Test NPM
|
||||
echo "=== NPM Registry ==="
|
||||
test_site "registry.npmjs.org"
|
||||
echo ""
|
||||
|
||||
# Test Prisma
|
||||
echo "=== Prisma Binaries ==="
|
||||
test_site "binaries.prisma.sh"
|
||||
test_site "binaries.prismacdn.com"
|
||||
echo ""
|
||||
|
||||
# Test Docker
|
||||
echo "=== Docker Registry ==="
|
||||
test_site "registry.hub.docker.com"
|
||||
test_site "registry-1.docker.io"
|
||||
echo ""
|
||||
|
||||
# Test DNS
|
||||
echo "=== DNS Resolution ==="
|
||||
echo -n "Checking DNS for registry.npmjs.org ... "
|
||||
if nslookup registry.npmjs.org > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ OK${NC}"
|
||||
else
|
||||
echo -e "${RED}✗ FAILED${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "Summary:"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "If any tests failed, you need to:"
|
||||
echo "1. Use Shecan/Electro DNS"
|
||||
echo "2. Use VPN/Proxy"
|
||||
echo "3. Build on external server"
|
||||
echo ""
|
||||
echo "See REQUIRED_SITES.md for details"
|
||||
Reference in New Issue
Block a user