Files
Montech_Landing/deploy/DEPLOY.md
T
MahdiandCursor 7e8e1b1f1b Initial Montech monorepo: Nuxt landing, Vue admin, Nest API.
Scaffold SSR site with CMS/blog/gallery/SEO admin and deploy configs for montech.ir.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 18:42:28 +03:30

120 lines
2.9 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.
# استقرار Montech — `montech.ir`
> پکیج‌منیجر = **npm**. به پروسه‌های CRM دست نزنید.
## آپدیت سریع (بعد از `git push`)
```bash
ssh -p 3031 montime@185.50.38.53
cd /var/www/montech
git pull
npm run build -w @montech/shared
cd apps/api && npx prisma migrate deploy && npx prisma generate && cd ../..
npm run build -w @montech/api
npm run build -w @montech/adm
npm run build -w @montech/landing
pm2 restart montech-api montech-landing
```
---
هاست مشترک مونتایم: `185.50.38.53` (SSH پورت `3031`، کاربر `montime`)
دامنه: `https://montech.ir`
مسیر کد: `/var/www/montech`
پورت داخلی API: `3050`
پورت داخلی Nuxt SSR: `3051`
PM2: `montech-api`, `montech-landing`
کد از Gitea: `http://get.feep.ir/Mahdi/Montech_Landing.git`
پورت‌های اشغال‌شده (دست نزنید): ۳۰۰۰ مونتایم · ۳۰۰۱ فوری‌سند · ۳۰۱۰ سوپرادمین · ۳۰۲۰ کاتالوگ · ۳۰۳۰ CRM · ۳۰۴۰ STT
---
## کارهایی که باید انجام شود
1. **DNS:** رکورد `A` برای `montech.ir` روی همان IP سرور.
2. **Postgres:** دیتابیس و کاربر جدا (`montech`) روی `127.0.0.1:15432`.
3. **دسترسی Gitea** برای clone/pull.
---
## روی سرور
```bash
ssh -p 3031 montime@185.50.38.53
```
### ۱) کلون
```bash
sudo mkdir -p /var/www/montech
sudo chown montime:montime /var/www/montech
git clone http://get.feep.ir/Mahdi/Montech_Landing.git /var/www/montech
```
### ۲) پورت آزاد
```bash
ss -tlnp | grep -E '3050|3051' || true
```
### ۳) `.env` API
```bash
cd /var/www/montech
cp deploy/.env.production.example apps/api/.env
nano apps/api/.env
```
### ۴) نصب وابستگی‌ها
```bash
cd /var/www/montech
npm ci
# اگر symlink workspace خراب بود:
# rm -rf node_modules/@montech/shared && ln -s ../../packages/shared node_modules/@montech/shared
```
### ۵) migrate و بیلد
```bash
cd /var/www/montech
npm run build -w @montech/shared
cd apps/api
npx prisma migrate deploy
npx prisma generate
npx prisma db seed
cd ../..
npm run build -w @montech/api
npm run build -w @montech/adm
npm run build -w @montech/landing
mkdir -p uploads
```
### ۶) PM2
```bash
pm2 start /var/www/montech/deploy/ecosystem.config.cjs
pm2 save
curl -sI http://127.0.0.1:3050/api/health
curl -sI http://127.0.0.1:3051/
```
### ۷) Nginx
```bash
sudo cp /var/www/montech/deploy/nginx-montech.ir.conf /etc/nginx/sites-available/montech.ir
sudo ln -sf /etc/nginx/sites-available/montech.ir /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
```
### ۸) تست
1. `https://montech.ir` → لندینگ
2. `https://montech.ir/adm/` → پنل ادمین (موبایل/رمز از seed)
3. `https://montech.ir/blog` → بلاگ
4. `https://montech.ir/api/health` → `{ ok: true }`
پاک نکنید: `uploads/` و `apps/api/.env`