PozoApp/DEPLOYMENT-GUIDE.md

451 lines
11 KiB
Markdown

# 🚀 POZO - Complete Deployment Guide with Dynamic SEO
## ⚠️ IMPORTANT: Follow EXACTLY in this order. Don't skip any step!
---
## 📋 Prerequisites Check
Before starting, make sure you have:
- ✅ Node.js installed (check: `node --version`)
- ✅ npm installed (check: `npm --version`)
- ✅ Access to your IIS server
- ✅ iisnode installed on IIS server
- ✅ URL Rewrite module installed on IIS server
---
## 🔨 PART 1: Build the Project Locally
### Step 1: Stop any running servers
```powershell
# Kill all node processes
Get-Process -Name node -ErrorAction SilentlyContinue | Stop-Process -Force
```
### Step 2: Clean previous build (Optional but recommended)
```powershell
# Remove old dist folder
Remove-Item -Path "dist" -Recurse -Force -ErrorAction SilentlyContinue
```
### Step 3: Install dependencies
```powershell
# Make sure all packages are installed
npm install
```
### Step 4: Build the project with SEO generation
```powershell
# This runs Vite build + React Snap + SEO generation
npm run convert-jsx-to-html
```
**Expected Output:**
- ✅ Vite build completes
- ✅ React Snap attempts to prerender (may show warnings - ignore them)
- ✅ SEO files generated for all pages
-`dist/` folder created with all files
-`dist/server.js` created
-`dist/server/seo-middleware.js` created
-`dist/web.config` created
### Step 5: Verify build output
```powershell
# Check if critical files exist
Test-Path "dist/server.js"
Test-Path "dist/server/seo-middleware.js"
Test-Path "dist/web.config"
Test-Path "dist/home/pricing-pozoapp/index.html"
Test-Path "dist/home/blog/index.html"
```
**All should return:** `True`
---
## 🧪 PART 2: Test Locally (MANDATORY!)
### Step 6: Start local server
```powershell
# Navigate to dist folder and start server
cd dist
node server.js
```
**Expected Output:**
```
Server running on port 3000
Dynamic SEO enabled!
```
### Step 7: Test in browser
Open these URLs in your browser:
1. **Home:** http://localhost:3000/home/
2. **Pricing:** http://localhost:3000/home/pricing-pozoapp
3. **Blog:** http://localhost:3000/home/blog
4. **Contact:** http://localhost:3000/home/contact-us
5. **Sign In:** http://localhost:3000/home/signin
### Step 8: Verify SEO for each page
For EACH page above:
1. Open the URL in browser
2. Press `Ctrl + U` to view page source
3. Check `<head>` section contains:
-`<title>` tag with correct page title
-`<meta name="description"` with correct description
-`<meta property="og:title"` - Open Graph title
-`<meta property="og:description"` - OG description
-`<meta property="og:image"` - OG image URL
-`<meta property="og:url"` - Page URL
-`<meta property="twitter:card"` - Twitter card
-`<link rel="canonical"` - Canonical URL
**IMPORTANT:** If ANY page shows wrong SEO or missing tags, **STOP** and fix before deploying!
### Step 9: Stop local server
```powershell
# Press Ctrl+C in the terminal where server is running
# OR run this in new terminal:
Get-Process -Name node -ErrorAction SilentlyContinue | Stop-Process -Force
```
---
## 📦 PART 3: Prepare Files for Deployment
### Step 10: Check dist folder contents
Your `dist/` folder should have:
```
dist/
├── assets/ (all JS, CSS, images)
├── home/
│ ├── index.html
│ ├── blog/
│ │ └── index.html
│ ├── pricing-pozoapp/
│ │ └── index.html
│ ├── contact-us/
│ │ └── index.html
│ └── signin/
│ └── index.html
├── og/ (Open Graph images)
├── server/
│ └── seo-middleware.js
├── index.html
├── server.js (CRITICAL!)
├── web.config (CRITICAL!)
├── robots.txt
├── sitemap.xml
└── ... (other files)
```
### Step 11: Create deployment package
```powershell
# Go back to project root
cd ..
# Create a zip file of dist folder (optional, makes upload easier)
Compress-Archive -Path "dist\*" -DestinationPath "pozo-deployment.zip" -Force
```
---
## 🌐 PART 4: Deploy to IIS Server
### Step 12: Upload files to server
**Option A: If you have FTP/SFTP access:**
1. Connect to your server via FTP/SFTP
2. Navigate to your website root folder (e.g., `C:\inetpub\wwwroot\pozo.dev\`)
3. **BACKUP existing files first!**
4. Delete old files in the folder
5. Upload ALL files from `dist/` folder
**Option B: If you have RDP access:**
1. Connect via Remote Desktop
2. Copy `dist/` folder or `pozo-deployment.zip` to server
3. Extract/move files to website root (e.g., `C:\inetpub\wwwroot\pozo.dev\`)
### Step 13: Install Node.js dependencies on server
**On your IIS server (via RDP or SSH):**
```powershell
# Navigate to your website root
cd C:\inetpub\wwwroot\pozo.dev
# Install dependencies
npm install express axios
```
### Step 14: Verify critical files on server
**On server, check these files exist:**
```powershell
Test-Path "server.js"
Test-Path "server\seo-middleware.js"
Test-Path "web.config"
Test-Path "node_modules\express"
Test-Path "node_modules\axios"
```
**All should return:** `True`
---
## ⚙️ PART 5: Configure IIS
### Step 15: Verify iisnode is installed
1. Open IIS Manager
2. Select your site
3. Check if "iisnode" icon is visible in Features View
4. If NOT visible, install iisnode from: https://github.com/Azure/iisnode/releases
### Step 16: Verify URL Rewrite module
1. In IIS Manager, select your site
2. Check if "URL Rewrite" icon is visible
3. If NOT visible, install from: https://www.iis.net/downloads/microsoft/url-rewrite
### Step 17: Check web.config
Your `web.config` should look like this:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" resourceType="File" />
</handlers>
<rewrite>
<rules>
<!-- Route all requests to Node.js server -->
<rule name="pozo.dev" stopProcessing="true">
<match url="/*" />
<action type="Rewrite" url="server.js" />
</rule>
</rules>
</rewrite>
<iisnode node_env="production" />
</system.webServer>
</configuration>
```
**If different, replace with above content.**
### Step 18: Set proper permissions
**On server:**
1. Right-click on website folder → Properties → Security
2. Add `IIS_IUSRS` with Read & Execute permissions
3. Add `IUSR` with Read & Execute permissions
### Step 19: Configure Application Pool
1. Open IIS Manager
2. Go to Application Pools
3. Find your site's app pool
4. Right-click → Advanced Settings
5. Set:
- `.NET CLR Version`: No Managed Code
- `Enable 32-Bit Applications`: False
- `Pipeline Mode`: Integrated
### Step 20: Restart Application Pool
1. In IIS Manager → Application Pools
2. Right-click your app pool → Stop
3. Wait 5 seconds
4. Right-click → Start
### Step 21: Restart IIS (optional but recommended)
**On server:**
```powershell
iisreset
```
---
## ✅ PART 6: Test Production Site
### Step 22: Test your live site
Open these URLs (replace `pozo.dev` with your domain):
1. **Home:** https://www.pozo.dev/home/
2. **Pricing:** https://www.pozo.dev/home/pricing-pozoapp
3. **Blog:** https://www.pozo.dev/home/blog
4. **Contact:** https://www.pozo.dev/home/contact-us
5. **Sign In:** https://www.pozo.dev/home/signin
### Step 23: Verify SEO on production
For EACH page:
1. Open URL
2. Press `Ctrl + U` (View Source)
3. Verify ALL SEO tags are present:
- ✅ Title tag
- ✅ Meta description
- ✅ OG tags
- ✅ Twitter tags
- ✅ Canonical URL
### Step 24: Test with SEO tools
1. **Google Rich Results Test:**
- Go to: https://search.google.com/test/rich-results
- Enter your page URL
- Check for errors
2. **Meta Tags Preview:**
- Go to: https://metatags.io/
- Enter your page URL
- See how it looks on social media
3. **PageSpeed Insights:**
- Go to: https://pagespeed.web.dev/
- Enter your page URL
- Check performance and SEO score
---
## 🐛 TROUBLESHOOTING
### Issue 1: Site shows blank page or 404
**Solution:**
```powershell
# On server, check iisnode logs
type C:\inetpub\wwwroot\pozo.dev\iisnode\*.log
```
Check for errors, usually:
- Missing `node_modules` → Run `npm install`
- Wrong `web.config` → Replace with correct version
### Issue 2: SEO tags not showing
**Solution:**
1. Clear browser cache (Ctrl + Shift + Delete)
2. Check if server is actually running Node.js:
```powershell
Get-Process -Name node
```
3. Check iisnode is processing requests:
- Check `iisnode\*.log` files for activity
### Issue 3: Assets (CSS/JS) not loading
**Solution:**
1. Check browser console (F12)
2. Verify paths in HTML match actual file locations
3. Check IIS MIME types for `.js`, `.css`, `.woff`, `.woff2`
### Issue 4: Server.js not running
**Solution:**
1. Check `web.config` has correct handler
2. Verify iisnode is installed
3. Check Node.js is installed on server: `node --version`
4. Restart App Pool
---
## 📝 QUICK REFERENCE COMMANDS
### Local Development:
```powershell
# Build project
npm run convert-jsx-to-html
# Test locally
cd dist
node server.js
# Stop server
Get-Process -Name node | Stop-Process -Force
```
### On Server:
```powershell
# Install dependencies
npm install express axios
# Restart IIS
iisreset
# Check node processes
Get-Process -Name node
# View logs
type C:\inetpub\wwwroot\pozo.dev\iisnode\*.log
```
---
## 🎯 CHECKLIST BEFORE DEPLOYMENT
- [ ] Local build completed without errors
- [ ] Local server tested and SEO verified
- [ ] All pages show correct titles and meta tags locally
- [ ] `dist/server.js` exists
- [ ] `dist/server/seo-middleware.js` exists
- [ ] `dist/web.config` exists
- [ ] Backed up old production files
- [ ] iisnode installed on server
- [ ] URL Rewrite module installed on server
- [ ] Node.js installed on server
- [ ] `npm install` run on server
- [ ] Permissions set correctly
- [ ] Application pool restarted
- [ ] Production site tested
- [ ] SEO tags verified on production
---
## ✨ SUCCESS CRITERIA
Your deployment is successful when:
1. ✅ All pages load without errors
2. ✅ Every page has unique, correct title in browser tab
3. ✅ Page source (`Ctrl+U`) shows all SEO meta tags
4. ✅ Google Rich Results Test shows no errors
5. ✅ Social media preview tools show correct title, description, and image
6. ✅ Assets (images, CSS, JS) load properly
7. ✅ No console errors in browser (F12)
---
## 🆘 SUPPORT
If you face any issues:
1. Check the TROUBLESHOOTING section above
2. Check server logs: `C:\inetpub\wwwroot\pozo.dev\iisnode\*.log`
3. Check browser console (F12) for errors
4. Verify all files uploaded correctly
5. Confirm Node.js and dependencies installed on server
---
**Created:** 2025-11-04
**Version:** 1.0
**Project:** POZO - Retail ERP & POS
**Tech Stack:** React + Vite + Node.js + Express + IIS + iisnode
---
**நீ இந்த guide-ஐ படி படியா follow பண்ணா, 100% guarantee SEO work ஆகும்! 🚀**
**Oru step-um miss பண்ணாதே! எல்லாம் சரியா வரும்! 💪**