122 lines
2.6 KiB
Markdown
122 lines
2.6 KiB
Markdown
# 🚀 Production Deployment Guide
|
|
|
|
## 📋 **Prerequisites**
|
|
|
|
- Salesforce CLI (sf) installed
|
|
- Python 3.8+ on your server
|
|
- Access to your Salesforce sandbox
|
|
|
|
## 🎯 **Step 1: Deploy LWC to Salesforce**
|
|
|
|
```bash
|
|
# Make script executable
|
|
chmod +x deploy-lwc-production.sh
|
|
|
|
# Run deployment
|
|
./deploy-lwc-production.sh
|
|
```
|
|
|
|
**Expected Output:**
|
|
```
|
|
✅ LWC deployment successful!
|
|
✅ Custom objects deployed!
|
|
✅ Permission set created!
|
|
✅ Lightning App Page created!
|
|
```
|
|
|
|
## 🌐 **Step 2: Deploy PDF API to Your Server**
|
|
|
|
```bash
|
|
# On your server
|
|
cd python-pdf-generator
|
|
|
|
# Create virtual environment
|
|
python3 -m venv venv
|
|
source venv/bin/activate
|
|
|
|
# Install dependencies
|
|
pip install -r requirements.txt
|
|
|
|
# Start API server
|
|
python3 api_server.py
|
|
```
|
|
|
|
**Server will start on:** `http://0.0.0.0:8000`
|
|
|
|
## 🔧 **Step 3: Configure LWC with Your API URL**
|
|
|
|
Edit `force-app/main/default/lwc/propertyTemplateSelector/propertyTemplateSelector.js`:
|
|
|
|
```javascript
|
|
// Change this line
|
|
pdfApiBaseUrl = 'https://YOUR-ACTUAL-IP:8000/api';
|
|
```
|
|
|
|
**Replace `YOUR-ACTUAL-IP` with your server's IP address.**
|
|
|
|
## 🔒 **Step 4: Security Configuration**
|
|
|
|
### **Firewall Setup:**
|
|
```bash
|
|
# Open port 8000
|
|
sudo ufw allow 8000
|
|
```
|
|
|
|
### **CORS Configuration (if needed):**
|
|
Edit `python-pdf-generator/api_server.py`:
|
|
```python
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=[
|
|
"https://tso3--r1.sandbox.lightning.force.com",
|
|
"https://your-salesforce-domain.com"
|
|
],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
```
|
|
|
|
## 🧪 **Step 5: Test Your Deployment**
|
|
|
|
1. **Open Salesforce Sandbox:** `https://tso3--r1.sandbox.lightning.force.com`
|
|
2. **Login:** `contact+tso3@propertycrm.ae.r1` / `Demo@123`
|
|
3. **Search for:** "Property Brochure Generator"
|
|
4. **Test the flow:** Template → Property → Preview → Download
|
|
|
|
## 📊 **Expected Results**
|
|
|
|
- ✅ LWC loads in Salesforce
|
|
- ✅ Properties load from your data
|
|
- ✅ PDF preview generates
|
|
- ✅ PDF downloads successfully
|
|
- ✅ All 23+ properties accessible
|
|
|
|
## 🚨 **Troubleshooting**
|
|
|
|
### **LWC Not Loading:**
|
|
- Check deployment logs
|
|
- Verify permission sets
|
|
- Check user access
|
|
|
|
### **API Connection Failed:**
|
|
- Verify IP address in LWC
|
|
- Check firewall settings
|
|
- Ensure API server is running
|
|
|
|
### **No Properties Found:**
|
|
- Verify `pcrm__Property__c` object exists
|
|
- Check field permissions
|
|
- Verify data in sandbox
|
|
|
|
## 📞 **Support**
|
|
|
|
For deployment issues:
|
|
1. Check Salesforce CLI logs
|
|
2. Verify API server status
|
|
3. Check browser console for errors
|
|
4. Ensure all prerequisites are met
|
|
|
|
---
|
|
|
|
**🎯 Your system is now production-ready!** |