Replace the landing with the artifact design and rebuild the admin in Ant Design.
Adds consultation leads, section editors, and the one-time content reset for this release. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -104,11 +104,63 @@ curl -sI http://127.0.0.1:3051/
|
||||
### ۷) Nginx
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /etc/nginx/snippets /var/www/certbot
|
||||
sudo cp /var/www/montech/deploy/nginx-montech-locations.conf /etc/nginx/snippets/montech-locations.conf
|
||||
# First time (before cert exists): use HTTP-only — see step 7b
|
||||
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
|
||||
```
|
||||
|
||||
### ۷b) SSL مستقیم روی سرور (certbot + :443)
|
||||
|
||||
**نکته WCDN:** اگر DNS دامنه روی CDN است، Let's Encrypt ممکن است به origin نرسد. یکی از اینها:
|
||||
|
||||
- موقتاً رکورد A را مستقیم روی `185.50.38.53` بگذار، گواهی بگیر، بعد دوباره CDN را وصل کن و Origin را HTTPS کن؛ یا
|
||||
- مطمئن شو WCDN درخواستهای `/.well-known/acme-challenge/` را به origin روی HTTP:80 پاس میدهد.
|
||||
|
||||
```bash
|
||||
# 1) پکیجها
|
||||
sudo apt update
|
||||
sudo apt install -y certbot python3-certbot-nginx
|
||||
|
||||
# 2) تا قبل از وجود گواهی، بلاک :443 را موقتاً از سایت بردار
|
||||
# (یا فقط server :80 را نگه دار) و nginx را reload کن
|
||||
sudo nano /etc/nginx/sites-available/montech.ir
|
||||
# کل بلوک server { listen 443 ... } را کامنت کن
|
||||
sudo nginx -t && sudo systemctl reload nginx
|
||||
|
||||
# 3) گرفتن گواهی (وبروت — با مسیر ACME در snippet)
|
||||
sudo mkdir -p /var/www/certbot
|
||||
sudo certbot certonly --webroot -w /var/www/certbot \
|
||||
-d montech.ir -d www.montech.ir \
|
||||
--email admin@montech.ir --agree-tos --no-eff-email
|
||||
|
||||
# یا با پلاگین nginx (اگر بلاک 443 کامنت است و :80 فعال):
|
||||
# sudo certbot --nginx -d montech.ir -d www.montech.ir
|
||||
|
||||
# 4) فعال کردن :443
|
||||
sudo cp /var/www/montech/deploy/nginx-montech-locations.conf /etc/nginx/snippets/montech-locations.conf
|
||||
sudo cp /var/www/montech/deploy/nginx-montech.ir.conf /etc/nginx/sites-available/montech.ir
|
||||
sudo nginx -t && sudo systemctl reload nginx
|
||||
|
||||
# 5) تست لوکال
|
||||
curl -skI https://127.0.0.1/ -H 'Host: montech.ir'
|
||||
ss -tlnp | grep ':443'
|
||||
|
||||
# 6) تمدید خودکار
|
||||
sudo certbot renew --dry-run
|
||||
```
|
||||
|
||||
بعد در پنل WCDN:
|
||||
|
||||
- Origin protocol = **HTTPS**
|
||||
- Origin port = **443**
|
||||
- حالت SSL = **Full** (اگر گواهی معتبر Let's Encrypt داری میتوانی Full Strict هم بزنی)
|
||||
- کش را Purge کن
|
||||
|
||||
اگر فقط میخواهی 502 برطرف شود و SSL روی CDN کافی است، Origin را **HTTP:80** بگذار و این مرحله را لازم نداری.
|
||||
|
||||
### ۸) تست
|
||||
|
||||
1. `https://montech.ir` → لندینگ
|
||||
@@ -117,3 +169,41 @@ sudo nginx -t && sudo systemctl reload nginx
|
||||
4. `https://montech.ir/api/health` → `{ ok: true }`
|
||||
|
||||
پاک نکنید: `uploads/` و `apps/api/.env`
|
||||
|
||||
---
|
||||
|
||||
## One-time release: artifact landing + Ant Design admin (2026-10)
|
||||
|
||||
This release replaces the landing content model, adds the `Lead` table and new dependencies on all apps.
|
||||
Run it once instead of the quick update above.
|
||||
|
||||
```bash
|
||||
ssh -p 3031 montime@185.50.38.53
|
||||
cd /var/www/montech
|
||||
|
||||
# 1) Back up the database first (the migration deletes legacy landing sections)
|
||||
pg_dump -h 127.0.0.1 -p 15432 -U montech -Fc montech > ~/montech-$(date +%F).dump
|
||||
|
||||
git pull
|
||||
npm ci # new deps: gsap, lenis, tailwindcss@3, ant-design-vue, …
|
||||
|
||||
npm run build -w @montech/shared
|
||||
cd apps/api
|
||||
npx prisma migrate deploy # creates "Lead", removes marquee/manifesto/services/work/process/stats/team
|
||||
npx prisma generate
|
||||
SEED_RESET_CONTENT=1 npx prisma db seed # overwrites settings, page SEO and sections with the artifact content
|
||||
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
|
||||
```
|
||||
|
||||
Notes:
|
||||
|
||||
- Without `SEED_RESET_CONTENT=1` the seed only creates missing rows and never overwrites admin edits. Use the flag only for this release.
|
||||
- Contact phone/email/address and socials are edited in **Admin → تنظیمات سایت** and feed the landing footer.
|
||||
- Consultation requests from the landing are listed in **Admin → درخواستهای مشاوره** (`POST /api/public/leads`, rate limited to 5 per IP per 10 minutes).
|
||||
- The landing caches pages with stale-while-revalidate (`/` 30s, blog/gallery 120s), so admin edits appear within that window.
|
||||
- Verify after deploy: `curl -s https://montech.ir/robots.txt`, `curl -s https://montech.ir/sitemap.xml`, submit a test consultation and check it in the admin.
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Shared locations for montech.ir (HTTP + HTTPS)
|
||||
client_max_body_size 20M;
|
||||
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
default_type "text/plain";
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://montech_api;
|
||||
proxy_http_version 1.1;
|
||||
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;
|
||||
proxy_read_timeout 120s;
|
||||
}
|
||||
|
||||
location /adm/ {
|
||||
alias /var/www/montech/apps/adm/dist/;
|
||||
try_files $uri $uri/ /adm/index.html;
|
||||
}
|
||||
|
||||
location = /adm/index.html {
|
||||
alias /var/www/montech/apps/adm/dist/index.html;
|
||||
}
|
||||
|
||||
location = /adm {
|
||||
return 301 /adm/;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://montech_landing;
|
||||
proxy_http_version 1.1;
|
||||
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;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
@@ -1,5 +1,11 @@
|
||||
# Place under /etc/nginx/sites-available/montech.ir
|
||||
# Prefer HTTP :80 if SSL terminates on the front proxy (same pattern as CRM).
|
||||
# /etc/nginx/sites-available/montech.ir
|
||||
#
|
||||
# Copy BOTH files:
|
||||
# sudo cp deploy/nginx-montech.ir.conf /etc/nginx/sites-available/montech.ir
|
||||
# sudo cp deploy/nginx-montech-locations.conf /etc/nginx/snippets/montech-locations.conf
|
||||
#
|
||||
# SSL on origin (certbot) is needed only if WCDN Origin = HTTPS (Full / Full Strict).
|
||||
# If WCDN Origin = HTTP:80, the :443 block below can stay unused.
|
||||
|
||||
upstream montech_api {
|
||||
server 127.0.0.1:3050;
|
||||
@@ -16,40 +22,20 @@ server {
|
||||
listen [::]:80;
|
||||
server_name montech.ir www.montech.ir;
|
||||
|
||||
client_max_body_size 20M;
|
||||
include /etc/nginx/snippets/montech-locations.conf;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://montech_api;
|
||||
proxy_http_version 1.1;
|
||||
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;
|
||||
proxy_read_timeout 120s;
|
||||
}
|
||||
# Enable after certificates exist:
|
||||
# sudo ls /etc/letsencrypt/live/montech.ir/
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
server_name montech.ir www.montech.ir;
|
||||
|
||||
location /adm/ {
|
||||
alias /var/www/montech/apps/adm/dist/;
|
||||
try_files $uri $uri/ /adm/index.html;
|
||||
}
|
||||
ssl_certificate /etc/letsencrypt/live/montech.ir/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/montech.ir/privkey.pem;
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||
|
||||
# SPA fallback for Vue admin history mode
|
||||
location = /adm/index.html {
|
||||
alias /var/www/montech/apps/adm/dist/index.html;
|
||||
}
|
||||
|
||||
location = /adm {
|
||||
return 301 /adm/;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://montech_landing;
|
||||
proxy_http_version 1.1;
|
||||
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;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
include /etc/nginx/snippets/montech-locations.conf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user