2132
This commit is contained in:
@@ -1947,152 +1947,6 @@ docker-compose -f docker-compose.app.yml up -d
|
||||
|
||||
---
|
||||
|
||||
## Folder Status Analysis
|
||||
|
||||
### Active Folders
|
||||
|
||||
#### `/sites/` - **ACTIVE & IN USE** ✅
|
||||
**Status:** Currently deployed and running in production
|
||||
**Container:** `igny8_sites` (running on port 8024)
|
||||
**Purpose:** Unified Sites Renderer and Site Builder container
|
||||
|
||||
**Evidence:**
|
||||
- Docker container running: `igny8_sites` (Up 6+ hours)
|
||||
- Referenced in `docker-compose.app.yml` (lines 104-123)
|
||||
- Active backend integration via `/api/v1/publisher/sites/{site_id}/definition/`
|
||||
- Loads site definitions from `/data/app/sites-data/` filesystem
|
||||
- Has complete React application with routing, components, and build configuration
|
||||
|
||||
**Functionality:**
|
||||
1. **Public Site Renderer** (No auth required)
|
||||
- Routes: `/:siteSlug/:pageSlug?`
|
||||
- Loads site definitions from filesystem or API
|
||||
- Renders published sites for public viewing
|
||||
|
||||
2. **Site Builder Interface** (Auth required)
|
||||
- Routes: `/builder/*` (wizard, preview, dashboard)
|
||||
- Protected by JWT authentication
|
||||
- Integrated with main IGNY8 API
|
||||
|
||||
**Migration History:**
|
||||
- Previously separated into two containers (`site-builder` + `sites`)
|
||||
- Successfully merged in November 2025 (see `MIGRATION_SUMMARY.md`)
|
||||
- Old `site-builder` container removed, functionality merged into `sites`
|
||||
|
||||
**Key Files:**
|
||||
```
|
||||
sites/
|
||||
├── package.json ✅ Active (vite 7.2.2, react 19.2.0)
|
||||
├── Dockerfile.dev ✅ Active (used by docker-compose)
|
||||
├── vite.config.ts ✅ Active (port 5176)
|
||||
└── src/
|
||||
├── App.tsx ✅ Unified router (builder + renderer)
|
||||
├── builder/ ✅ Site builder UI (lazy loaded)
|
||||
│ ├── pages/
|
||||
│ └── components/
|
||||
├── pages/
|
||||
│ └── SiteRenderer.tsx ✅ Public site renderer
|
||||
└── loaders/
|
||||
└── loadSiteDefinition.ts ✅ Filesystem/API loader
|
||||
```
|
||||
|
||||
**Backend Integration:**
|
||||
- API: `/api/v1/site-builder/blueprints/` (active, 20+ endpoints)
|
||||
- Service: `igny8_core.business.publishing.services.adapters.sites_renderer_adapter`
|
||||
- Data path: `/data/app/sites-data/clients/{site_id}/v{version}/`
|
||||
|
||||
**Verdict:** **ESSENTIAL - Must be included in portable package**
|
||||
|
||||
---
|
||||
|
||||
#### `/site-builder/` - **REDUNDANT & DEPRECATED** ❌
|
||||
**Status:** Empty folder, functionality migrated to `/sites/`
|
||||
**Last Active:** Before November 2025
|
||||
**Container:** None (removed from docker-compose)
|
||||
|
||||
**Evidence:**
|
||||
- Folder contains only: `dist/` and `node_modules/` (no source code)
|
||||
- No `.tsx`, `.ts`, or configuration files found
|
||||
- Removed from `docker-compose.app.yml` (commented out)
|
||||
- Migration documented in `/sites/MIGRATION_SUMMARY.md`
|
||||
|
||||
**Migration History:**
|
||||
According to `MIGRATION_SUMMARY.md`:
|
||||
- Site Builder functionality merged into `/sites/src/builder/` directory
|
||||
- Unified routing created in `/sites/src/App.tsx`
|
||||
- Docker service `igny8_site_builder` removed
|
||||
- All builder API calls now route through `/sites/` container
|
||||
|
||||
**What Happened:**
|
||||
```
|
||||
Old Structure: New Structure:
|
||||
/site-builder/ → /sites/src/builder/
|
||||
src/ pages/
|
||||
pages/ components/
|
||||
components/ (integrated into sites)
|
||||
api/
|
||||
```
|
||||
|
||||
**Verdict:** **REDUNDANT - Can be safely deleted**
|
||||
|
||||
**Cleanup Recommendation:**
|
||||
```bash
|
||||
# Safe to remove (after final verification)
|
||||
rm -rf /data/app/igny8/site-builder/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Frontend Module Analysis
|
||||
|
||||
#### `/frontend/src/modules/siteBuilder/` - **REDUNDANT & DEPRECATED** ❌
|
||||
**Status:** Empty folders, no active code
|
||||
**Structure:**
|
||||
```
|
||||
frontend/src/modules/siteBuilder/
|
||||
├── components/
|
||||
│ ├── common/ (empty)
|
||||
│ └── steps/ (empty)
|
||||
└── state/ (empty)
|
||||
```
|
||||
|
||||
**Evidence:**
|
||||
- No `.tsx` or `.ts` files found in directory tree
|
||||
- No imports reference this path (`grep` search returned 0 matches)
|
||||
- Site Builder functionality moved to `/sites/src/builder/`
|
||||
|
||||
**Verdict:** **REDUNDANT - Can be safely deleted**
|
||||
|
||||
**Cleanup Recommendation:**
|
||||
```bash
|
||||
# Safe to remove
|
||||
rm -rf /data/app/igny8/frontend/src/modules/siteBuilder/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Updated Portable Package Structure
|
||||
|
||||
Based on analysis, here's the corrected essential package:
|
||||
|
||||
#### Include These Folders:
|
||||
✅ `/backend/` - Main Django application (excluding venv, cache, logs)
|
||||
✅ `/frontend/` - Main React application (excluding node_modules, dist)
|
||||
✅ `/sites/` - **ACTIVE** Sites Renderer & Builder (excluding node_modules, dist)
|
||||
✅ `/docs/` - Documentation
|
||||
✅ `docker-compose.app.yml` - Deployment configuration
|
||||
✅ `README.md`, `CHANGELOG.md` - Project documentation
|
||||
|
||||
#### Exclude These Folders:
|
||||
❌ `/site-builder/` - **DEPRECATED** (empty, migrated to `/sites/`)
|
||||
❌ `/frontend/src/modules/siteBuilder/` - **DEPRECATED** (empty folders)
|
||||
❌ `node_modules/`, `dist/`, `.venv/` - Dependencies (installed on deployment)
|
||||
❌ `__pycache__/`, `*.pyc` - Compiled Python
|
||||
❌ `logs/`, `*.log` - Log files
|
||||
❌ Database files, backups - Environment-specific
|
||||
|
||||
---
|
||||
|
||||
## Deployment Architecture
|
||||
|
||||
### Production Stack
|
||||
|
||||
424
docs/SITES_DECISION_GUIDE.md
Normal file
424
docs/SITES_DECISION_GUIDE.md
Normal file
@@ -0,0 +1,424 @@
|
||||
# Sites Container - Keep vs Remove Decision Guide
|
||||
|
||||
**Version:** 1.0
|
||||
**Date:** November 29, 2025
|
||||
|
||||
---
|
||||
|
||||
## Decision Tree
|
||||
|
||||
```
|
||||
Do you need Site Builder & Sites Renderer features?
|
||||
│
|
||||
├─ NO → Remove everything (Option A: Full Removal)
|
||||
│ ├─ Delete /sites/ folder
|
||||
│ ├─ Delete /site-builder/ folder
|
||||
│ ├─ Remove backend modules
|
||||
│ ├─ Remove database tables
|
||||
│ └─ Clean up all references
|
||||
│
|
||||
└─ YES → Do you need separate container?
|
||||
│
|
||||
├─ NO → Merge into frontend (Option B: Integration)
|
||||
│ ├─ Copy files to /frontend/
|
||||
│ ├─ Update routes in App.tsx
|
||||
│ ├─ Remove /sites/ container
|
||||
│ └─ Keep backend modules
|
||||
│
|
||||
└─ YES → Keep current setup (Option C: No Changes)
|
||||
├─ Keep /sites/ container running
|
||||
├─ Keep separate ports (8021, 8024)
|
||||
└─ Maintain current architecture
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Option A: Full Removal (No Site Features)
|
||||
|
||||
### When to Choose
|
||||
- ✅ You don't need site blueprint creation
|
||||
- ✅ You don't need public site rendering
|
||||
- ✅ You only need WordPress publishing (direct to WP)
|
||||
- ✅ You want minimal feature set
|
||||
|
||||
### What Gets Removed
|
||||
|
||||
#### Frontend
|
||||
```bash
|
||||
# Remove folders
|
||||
rm -rf /sites/
|
||||
rm -rf /site-builder/
|
||||
rm -rf /frontend/src/modules/siteBuilder/
|
||||
rm -rf /frontend/src/pages/Sites/ # if exists
|
||||
rm -rf /frontend/src/components/sites/ # site-specific only
|
||||
|
||||
# Remove from docker-compose
|
||||
# Delete igny8_sites service
|
||||
```
|
||||
|
||||
#### Backend
|
||||
```bash
|
||||
# Remove modules
|
||||
rm -rf backend/igny8_core/modules/site_builder/
|
||||
rm -rf backend/igny8_core/modules/publisher/ # Only if not using WP publish
|
||||
|
||||
# Remove business logic
|
||||
rm -rf backend/igny8_core/business/site_building/
|
||||
rm -rf backend/igny8_core/business/publishing/ # Be careful - WP uses this
|
||||
|
||||
# Update settings.py - remove from INSTALLED_APPS
|
||||
# 'igny8_core.modules.site_builder',
|
||||
```
|
||||
|
||||
#### Database
|
||||
```sql
|
||||
-- Drop tables (CAREFUL - NO UNDO)
|
||||
DROP TABLE site_builder_siteblueprint CASCADE;
|
||||
DROP TABLE site_builder_sitepage CASCADE;
|
||||
DROP TABLE site_builder_taxonomy CASCADE;
|
||||
DROP TABLE site_builder_cluster_blueprints CASCADE;
|
||||
-- etc.
|
||||
```
|
||||
|
||||
#### URLs
|
||||
```python
|
||||
# In backend/igny8_core/urls.py
|
||||
# Remove:
|
||||
# path('api/v1/site-builder/', include('igny8_core.modules.site_builder.urls')),
|
||||
# path('api/v1/publisher/sites/<int:site_id>/definition/', ...)
|
||||
```
|
||||
|
||||
### Files to Update
|
||||
|
||||
| File | Changes |
|
||||
|------|---------|
|
||||
| `docker-compose.app.yml` | Remove igny8_sites service |
|
||||
| `backend/igny8_core/settings.py` | Remove site_builder from INSTALLED_APPS |
|
||||
| `backend/igny8_core/urls.py` | Remove site-builder URL patterns |
|
||||
| `frontend/src/App.tsx` | Remove site-related routes |
|
||||
| `frontend/src/components/sidebar/AppSidebar.tsx` | Remove site builder menu |
|
||||
| `frontend/package.json` | Remove site-builder dependencies (if any) |
|
||||
| `docs/MASTER_REFERENCE.md` | Update architecture section |
|
||||
|
||||
### Impact
|
||||
- ❌ No site blueprint creation
|
||||
- ❌ No public site rendering
|
||||
- ✅ WordPress publishing still works (if using direct WP API)
|
||||
- ✅ Smaller codebase
|
||||
- ✅ Fewer containers
|
||||
- ✅ Simpler deployment
|
||||
|
||||
### Rollback Difficulty
|
||||
🔴 **HARD** - Database tables deleted, requires full backup restore
|
||||
|
||||
---
|
||||
|
||||
## Option B: Merge Into Frontend (Recommended)
|
||||
|
||||
### When to Choose
|
||||
- ✅ You need site builder features
|
||||
- ✅ You need public site rendering
|
||||
- ✅ You want simpler deployment
|
||||
- ✅ You want unified authentication
|
||||
- ✅ Sites are internal or low-traffic
|
||||
|
||||
### What Changes
|
||||
|
||||
#### Keep These (Backend)
|
||||
```
|
||||
backend/igny8_core/
|
||||
├── modules/
|
||||
│ ├── site_builder/ ✅ KEEP
|
||||
│ └── publisher/ ✅ KEEP
|
||||
├── business/
|
||||
│ ├── site_building/ ✅ KEEP
|
||||
│ └── publishing/ ✅ KEEP
|
||||
└── Database tables ✅ KEEP ALL
|
||||
```
|
||||
|
||||
#### Move These (Frontend)
|
||||
```
|
||||
/sites/src/ → /frontend/src/pages/Sites/
|
||||
/sites/src/builder/ → /frontend/src/pages/Sites/Builder/
|
||||
/sites/src/utils/ → /frontend/src/utils/siteRenderer/
|
||||
```
|
||||
|
||||
#### Delete These
|
||||
```
|
||||
/sites/ folder (after copying)
|
||||
/site-builder/ folder
|
||||
/frontend/src/modules/siteBuilder/ (empty)
|
||||
igny8_sites Docker container
|
||||
```
|
||||
|
||||
### Files to Update
|
||||
|
||||
| File | Type | Changes |
|
||||
|------|------|---------|
|
||||
| `frontend/src/App.tsx` | **UPDATE** | Add site builder & renderer routes |
|
||||
| `frontend/src/services/siteRenderer.api.ts` | **CREATE** | Site renderer API client |
|
||||
| `frontend/vite.config.ts` | **UPDATE** | Add SITES_DATA_PATH env |
|
||||
| `docker-compose.app.yml` | **UPDATE** | Remove igny8_sites, update igny8_frontend |
|
||||
| `backend/igny8_core/settings.py` | **VERIFY** | CORS settings (minor) |
|
||||
|
||||
### Step-by-Step Guide
|
||||
📖 **See:** [SITES_REMOVAL_GUIDE.md](./SITES_REMOVAL_GUIDE.md) - Complete instructions
|
||||
|
||||
### Impact
|
||||
- ✅ Site builder still works (routes change)
|
||||
- ✅ Public site rendering still works (routes change)
|
||||
- ✅ Backend unchanged (100% compatible)
|
||||
- ⚠️ Public site URLs change (update links)
|
||||
- ✅ Fewer containers (simpler deployment)
|
||||
- ✅ Unified authentication
|
||||
|
||||
### Rollback Difficulty
|
||||
🟡 **MEDIUM** - Can restore from backup, backend unchanged
|
||||
|
||||
---
|
||||
|
||||
## Option C: Keep Separate Container
|
||||
|
||||
### When to Choose
|
||||
- ✅ You need performance isolation for public sites
|
||||
- ✅ You want to scale sites independently
|
||||
- ✅ You have high-traffic public sites
|
||||
- ✅ You want different deployment schedules
|
||||
- ✅ Current setup works fine
|
||||
|
||||
### What Changes
|
||||
**Nothing!** Keep current architecture.
|
||||
|
||||
### Files to Update
|
||||
**None** - No changes needed
|
||||
|
||||
### Maintenance
|
||||
- Keep `/sites/` folder
|
||||
- Keep `igny8_sites` container running
|
||||
- Keep port 8024 accessible
|
||||
- Maintain separate Docker image
|
||||
|
||||
### Impact
|
||||
- ✅ No migration risk
|
||||
- ✅ Performance isolation
|
||||
- ✅ Independent scaling
|
||||
- ❌ More containers to manage
|
||||
- ❌ More complex deployment
|
||||
|
||||
### Rollback Difficulty
|
||||
🟢 **EASY** - Already the current state
|
||||
|
||||
---
|
||||
|
||||
## Comparison Matrix
|
||||
|
||||
| Aspect | Option A: Full Removal | Option B: Merge to Frontend | Option C: Keep Separate |
|
||||
|--------|----------------------|---------------------------|------------------------|
|
||||
| **Containers** | 1 (frontend only) | 2 (frontend + backend) | 3 (frontend + sites + backend) |
|
||||
| **Site Builder** | ❌ Removed | ✅ In frontend | ✅ In sites container |
|
||||
| **Site Renderer** | ❌ Removed | ✅ In frontend | ✅ In sites container |
|
||||
| **Backend API** | ❌ Removed | ✅ Kept | ✅ Kept |
|
||||
| **Database** | ❌ Dropped | ✅ Kept | ✅ Kept |
|
||||
| **Ports** | 8021 only | 8021 only | 8021, 8024 |
|
||||
| **Deployment** | Simple | Simple | Complex |
|
||||
| **Rollback** | Hard | Medium | Easy |
|
||||
| **Performance** | N/A | Good | Best (isolated) |
|
||||
| **Complexity** | Low | Medium | High |
|
||||
| **Recommended For** | Minimal setup | Most users | High-traffic sites |
|
||||
|
||||
---
|
||||
|
||||
## Migration Difficulty
|
||||
|
||||
### Option A: Full Removal
|
||||
```
|
||||
Difficulty: ████████░░ 80%
|
||||
Time: 6-8 hours
|
||||
Risk: HIGH (data loss)
|
||||
Rollback: HARD (requires backup)
|
||||
```
|
||||
|
||||
**Steps:**
|
||||
1. Backup database
|
||||
2. Remove frontend folders
|
||||
3. Remove backend modules
|
||||
4. Drop database tables
|
||||
5. Update URLs and settings
|
||||
6. Remove Docker services
|
||||
7. Update all documentation
|
||||
|
||||
### Option B: Merge to Frontend
|
||||
```
|
||||
Difficulty: ██████░░░░ 60%
|
||||
Time: 5-6 hours
|
||||
Risk: MEDIUM (UI changes)
|
||||
Rollback: MEDIUM (restore backup)
|
||||
```
|
||||
|
||||
**Steps:**
|
||||
1. Backup files
|
||||
2. Copy frontend files
|
||||
3. Update routes
|
||||
4. Update Docker config
|
||||
5. Test functionality
|
||||
6. Remove old container
|
||||
7. Update documentation
|
||||
|
||||
### Option C: Keep Separate
|
||||
```
|
||||
Difficulty: ░░░░░░░░░░ 0%
|
||||
Time: 0 hours
|
||||
Risk: NONE
|
||||
Rollback: N/A (no changes)
|
||||
```
|
||||
|
||||
**Steps:**
|
||||
1. None - keep current setup
|
||||
|
||||
---
|
||||
|
||||
## Recommendation by Use Case
|
||||
|
||||
### For Development/Testing
|
||||
**→ Option B: Merge to Frontend**
|
||||
- Simpler setup
|
||||
- Easier debugging
|
||||
- Fewer containers
|
||||
- Faster iteration
|
||||
|
||||
### For Small Production (<100 sites)
|
||||
**→ Option B: Merge to Frontend**
|
||||
- Good performance
|
||||
- Simpler deployment
|
||||
- Lower resource usage
|
||||
- Easier maintenance
|
||||
|
||||
### For Large Production (>100 sites, high traffic)
|
||||
**→ Option C: Keep Separate**
|
||||
- Performance isolation
|
||||
- Independent scaling
|
||||
- Better resource management
|
||||
- Fault isolation
|
||||
|
||||
### For Minimal Setup (No site features needed)
|
||||
**→ Option A: Full Removal**
|
||||
- Smallest footprint
|
||||
- Lowest complexity
|
||||
- Minimal maintenance
|
||||
- Only if truly not needed
|
||||
|
||||
---
|
||||
|
||||
## Red Flags - Don't Remove If:
|
||||
|
||||
🚫 **Don't choose Option A if:**
|
||||
- You have existing site blueprints in database
|
||||
- You're actively using site builder
|
||||
- You publish to sites renderer (not just WordPress)
|
||||
- You're unsure if you'll need it later
|
||||
|
||||
🚫 **Don't choose Option B if:**
|
||||
- You have high-traffic public sites (>10k visits/day)
|
||||
- You need to scale sites independently
|
||||
- You have strict performance requirements
|
||||
- You want to deploy sites on different infrastructure
|
||||
|
||||
🚫 **Don't choose Option C if:**
|
||||
- You're struggling with too many containers
|
||||
- You want simpler deployment
|
||||
- You have low-traffic sites
|
||||
- You value simplicity over isolation
|
||||
|
||||
---
|
||||
|
||||
## Safe Path Forward
|
||||
|
||||
### Recommended Approach
|
||||
|
||||
1. **Start with Option C** (Keep separate) ← You are here
|
||||
2. **Evaluate for 30 days**
|
||||
- Monitor site traffic
|
||||
- Check resource usage
|
||||
- Assess deployment complexity
|
||||
3. **If low traffic/simple needs** → **Move to Option B** (Merge)
|
||||
4. **If high traffic/complex needs** → **Stay with Option C** (Keep separate)
|
||||
5. **If features unused** → **Consider Option A** (Remove)
|
||||
|
||||
### Safe Testing Strategy
|
||||
|
||||
```bash
|
||||
# 1. Test Option B in parallel (non-destructive)
|
||||
# Keep sites container running on port 8024
|
||||
# Deploy merged version on port 8021
|
||||
# Compare functionality side-by-side
|
||||
|
||||
# 2. If Option B works well
|
||||
# Switch traffic gradually
|
||||
# Monitor for issues
|
||||
|
||||
# 3. After 30 days of stability
|
||||
# Remove sites container (Option B complete)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Decision Criteria
|
||||
|
||||
### Choose Option A (Full Removal) If:
|
||||
- [ ] No existing site blueprints in database
|
||||
- [ ] No plans to use site builder ever
|
||||
- [ ] Only using WordPress publishing (direct)
|
||||
- [ ] Want absolute minimal setup
|
||||
|
||||
### Choose Option B (Merge to Frontend) If:
|
||||
- [x] Need site builder features
|
||||
- [x] Have low-medium traffic sites
|
||||
- [x] Want simpler deployment
|
||||
- [x] Prefer fewer containers
|
||||
- [x] Sites are mostly internal
|
||||
|
||||
### Choose Option C (Keep Separate) If:
|
||||
- [ ] High-traffic public sites
|
||||
- [ ] Need performance isolation
|
||||
- [ ] Want independent scaling
|
||||
- [ ] Current setup works well
|
||||
- [ ] Have complex requirements
|
||||
|
||||
---
|
||||
|
||||
## Next Steps Based on Choice
|
||||
|
||||
### If Choosing Option A:
|
||||
1. Read [SITES_REMOVAL_GUIDE.md](./SITES_REMOVAL_GUIDE.md) Section: "Full Removal"
|
||||
2. Backup database completely
|
||||
3. Export any site data you want to keep
|
||||
4. Follow removal checklist
|
||||
5. Test thoroughly
|
||||
|
||||
### If Choosing Option B:
|
||||
1. Read [SITES_REMOVAL_GUIDE.md](./SITES_REMOVAL_GUIDE.md) - Full guide
|
||||
2. Read [SITES_REMOVAL_QUICK_REFERENCE.md](./SITES_REMOVAL_QUICK_REFERENCE.md) - Quick commands
|
||||
3. Backup files and database
|
||||
4. Follow Phase 1-7 in guide
|
||||
5. Test thoroughly before cleanup
|
||||
|
||||
### If Choosing Option C:
|
||||
1. No action needed
|
||||
2. Continue with current setup
|
||||
3. Maintain both containers
|
||||
4. Keep documentation updated
|
||||
|
||||
---
|
||||
|
||||
## Support Documentation
|
||||
|
||||
- **Full Removal & Integration Guide:** [SITES_REMOVAL_GUIDE.md](./SITES_REMOVAL_GUIDE.md)
|
||||
- **Quick Reference:** [SITES_REMOVAL_QUICK_REFERENCE.md](./SITES_REMOVAL_QUICK_REFERENCE.md)
|
||||
- **System Architecture:** [MASTER_REFERENCE.md](./MASTER_REFERENCE.md)
|
||||
- **API Reference:** [API-COMPLETE-REFERENCE.md](./API-COMPLETE-REFERENCE.md)
|
||||
|
||||
---
|
||||
|
||||
**Recommendation:** Start with **Option C** (current state), evaluate needs, then move to **Option B** if appropriate.
|
||||
|
||||
**Last Updated:** November 29, 2025
|
||||
743
docs/SITES_REMOVAL_GUIDE.md
Normal file
743
docs/SITES_REMOVAL_GUIDE.md
Normal file
@@ -0,0 +1,743 @@
|
||||
# Sites & Site Builder Removal Guide
|
||||
|
||||
**Version:** 1.0
|
||||
**Date:** November 29, 2025
|
||||
**Purpose:** Complete guide to remove separate sites/site-builder containers and integrate functionality into main frontend app
|
||||
|
||||
---
|
||||
|
||||
## Executive Summary
|
||||
|
||||
This document provides a **safe, step-by-step process** to:
|
||||
1. Remove the `/sites/` container and folder
|
||||
2. Remove the `/site-builder/` folder (already empty/deprecated)
|
||||
3. Integrate Sites Renderer and Site Builder features into the main `/frontend/` application
|
||||
4. Update all affected components, configurations, and documentation
|
||||
|
||||
**Current State:**
|
||||
- 3 separate containers: `igny8_frontend`, `igny8_sites`, `igny8_marketing_dev`
|
||||
- Site Builder UI in separate `/sites/` container (port 8024)
|
||||
- Sites Renderer in separate `/sites/` container (port 8024)
|
||||
|
||||
**Target State:**
|
||||
- 2 containers: `igny8_frontend`, `igny8_marketing_dev`
|
||||
- Site Builder UI integrated into main frontend
|
||||
- Sites Renderer integrated into main frontend
|
||||
- Single unified application on port 8021
|
||||
|
||||
---
|
||||
|
||||
## Impact Analysis
|
||||
|
||||
### Features That Will Be Affected
|
||||
|
||||
#### 1. **Site Blueprint Management** (Site Builder)
|
||||
**Current Location:** `/sites/src/builder/`
|
||||
**Current Routes:** `/builder/*` (separate container)
|
||||
**Functionality:**
|
||||
- Site structure wizard
|
||||
- Blueprint creation and management
|
||||
- Preview canvas for site layouts
|
||||
- Blueprint history dashboard
|
||||
|
||||
**Backend Dependencies:**
|
||||
- API: `/api/v1/site-builder/blueprints/`
|
||||
- Module: `backend/igny8_core/modules/site_builder/`
|
||||
- Business Logic: `backend/igny8_core/business/site_building/`
|
||||
|
||||
**Impact:** Medium - Needs route integration into main app
|
||||
|
||||
---
|
||||
|
||||
#### 2. **Sites Renderer** (Public Site Viewing)
|
||||
**Current Location:** `/sites/src/pages/SiteRenderer.tsx`
|
||||
**Current Routes:** `/:siteSlug/:pageSlug?` (separate container)
|
||||
**Functionality:**
|
||||
- Loads site definitions from `/data/app/sites-data/`
|
||||
- Renders published sites for public viewing
|
||||
- No authentication required
|
||||
|
||||
**Backend Dependencies:**
|
||||
- API: `/api/v1/publisher/sites/{site_id}/definition/`
|
||||
- Service: `backend/igny8_core/business/publishing/services/adapters/sites_renderer_adapter.py`
|
||||
- Data: `/data/app/sites-data/clients/{site_id}/v{version}/`
|
||||
|
||||
**Impact:** High - Public-facing feature, needs careful route handling
|
||||
|
||||
---
|
||||
|
||||
#### 3. **Backend Modules** (Keep These)
|
||||
**Modules to Keep:**
|
||||
```
|
||||
backend/igny8_core/
|
||||
├── modules/
|
||||
│ ├── site_builder/ ✅ KEEP (API endpoints)
|
||||
│ └── publisher/ ✅ KEEP (publishing logic)
|
||||
└── business/
|
||||
├── site_building/ ✅ KEEP (business logic)
|
||||
└── publishing/ ✅ KEEP (renderer adapter)
|
||||
```
|
||||
|
||||
**Rationale:** Backend functionality is used by the main frontend app, just changing the UI container.
|
||||
|
||||
---
|
||||
|
||||
## Removal & Integration Plan
|
||||
|
||||
### Phase 1: Preparation & Backup
|
||||
|
||||
#### Step 1.1: Create Backup
|
||||
```bash
|
||||
# Backup current state
|
||||
cd /data/app/igny8
|
||||
tar -czf backup-sites-$(date +%Y%m%d-%H%M%S).tar.gz sites/ site-builder/
|
||||
|
||||
# Backup docker-compose
|
||||
cp docker-compose.app.yml docker-compose.app.yml.backup
|
||||
|
||||
# Verify backup
|
||||
ls -lh backup-sites-*.tar.gz
|
||||
```
|
||||
|
||||
#### Step 1.2: Document Current Routes
|
||||
```bash
|
||||
# Document current running containers
|
||||
docker ps | grep igny8 > current-containers.txt
|
||||
|
||||
# Test current site builder access
|
||||
curl -I http://localhost:8024/builder/
|
||||
|
||||
# Test current sites renderer
|
||||
curl -I http://localhost:8024/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 2: Frontend Integration
|
||||
|
||||
#### Step 2.1: Copy Site Builder Components to Frontend
|
||||
|
||||
**Source:** `/sites/src/builder/`
|
||||
**Destination:** `/frontend/src/pages/Sites/`
|
||||
|
||||
```bash
|
||||
cd /data/app/igny8
|
||||
|
||||
# Create target directory
|
||||
mkdir -p frontend/src/pages/Sites/Builder
|
||||
|
||||
# Copy builder components
|
||||
cp -r sites/src/builder/pages/* frontend/src/pages/Sites/Builder/
|
||||
cp -r sites/src/builder/components/* frontend/src/components/sites/builder/
|
||||
|
||||
# Copy shared types if needed
|
||||
cp sites/src/types/index.ts frontend/src/types/siteBuilder.types.ts
|
||||
```
|
||||
|
||||
**Files to Copy:**
|
||||
```
|
||||
sites/src/builder/
|
||||
├── pages/
|
||||
│ ├── wizard/
|
||||
│ │ └── WizardPage.tsx → frontend/src/pages/Sites/Builder/Wizard.tsx
|
||||
│ ├── preview/
|
||||
│ │ └── PreviewCanvas.tsx → frontend/src/pages/Sites/Builder/Preview.tsx
|
||||
│ └── dashboard/
|
||||
│ └── SiteDashboard.tsx → frontend/src/pages/Sites/Builder/Dashboard.tsx
|
||||
└── components/
|
||||
└── layout/
|
||||
└── BuilderLayout.tsx → frontend/src/components/sites/BuilderLayout.tsx
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 2.2: Copy Sites Renderer to Frontend
|
||||
|
||||
**Source:** `/sites/src/pages/SiteRenderer.tsx`
|
||||
**Destination:** `/frontend/src/pages/Sites/`
|
||||
|
||||
```bash
|
||||
# Copy renderer components
|
||||
cp sites/src/pages/SiteRenderer.tsx frontend/src/pages/Sites/PublicSiteRenderer.tsx
|
||||
cp sites/src/loaders/loadSiteDefinition.ts frontend/src/services/siteRenderer.api.ts
|
||||
cp -r sites/src/utils/* frontend/src/utils/siteRenderer/
|
||||
```
|
||||
|
||||
**Files to Copy:**
|
||||
```
|
||||
sites/src/
|
||||
├── pages/
|
||||
│ └── SiteRenderer.tsx → frontend/src/pages/Sites/PublicSiteRenderer.tsx
|
||||
├── loaders/
|
||||
│ └── loadSiteDefinition.ts → frontend/src/services/siteRenderer.api.ts
|
||||
└── utils/
|
||||
├── layoutRenderer.tsx → frontend/src/utils/siteRenderer/layoutRenderer.tsx
|
||||
├── pageTypeRenderer.tsx → frontend/src/utils/siteRenderer/pageTypeRenderer.tsx
|
||||
└── templateEngine.tsx → frontend/src/utils/siteRenderer/templateEngine.tsx
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 2.3: Update Frontend Routes
|
||||
|
||||
**File:** `/frontend/src/App.tsx`
|
||||
|
||||
**Add these imports:**
|
||||
```tsx
|
||||
// Site Builder pages
|
||||
const SiteBuilderWizard = lazy(() => import("./pages/Sites/Builder/Wizard"));
|
||||
const SiteBuilderPreview = lazy(() => import("./pages/Sites/Builder/Preview"));
|
||||
const SiteBuilderDashboard = lazy(() => import("./pages/Sites/Builder/Dashboard"));
|
||||
|
||||
// Public Sites Renderer
|
||||
const PublicSiteRenderer = lazy(() => import("./pages/Sites/PublicSiteRenderer"));
|
||||
```
|
||||
|
||||
**Add these routes:**
|
||||
```tsx
|
||||
{/* Site Builder Routes - Protected */}
|
||||
<Route
|
||||
path="/sites/builder"
|
||||
element={
|
||||
<ProtectedRoute>
|
||||
<ModuleGuard module="site_builder">
|
||||
<SiteBuilderWizard />
|
||||
</ModuleGuard>
|
||||
</ProtectedRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/sites/builder/preview"
|
||||
element={
|
||||
<ProtectedRoute>
|
||||
<ModuleGuard module="site_builder">
|
||||
<SiteBuilderPreview />
|
||||
</ModuleGuard>
|
||||
</ProtectedRoute>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/sites/builder/dashboard"
|
||||
element={
|
||||
<ProtectedRoute>
|
||||
<ModuleGuard module="site_builder">
|
||||
<SiteBuilderDashboard />
|
||||
</ModuleGuard>
|
||||
</ProtectedRoute>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* Public Sites Renderer - No Auth Required */}
|
||||
<Route path="/sites/view/:siteSlug/:pageSlug?" element={<PublicSiteRenderer />} />
|
||||
```
|
||||
|
||||
**Note:** Public renderer routes changed from `/:siteSlug/*` to `/sites/view/:siteSlug/*` to avoid route conflicts.
|
||||
|
||||
---
|
||||
|
||||
#### Step 2.4: Update API Client for Sites Data
|
||||
|
||||
**File:** `/frontend/src/services/siteRenderer.api.ts`
|
||||
|
||||
**Update the API URL resolution:**
|
||||
```typescript
|
||||
function getApiBaseUrl(): string {
|
||||
// Use environment variable
|
||||
const envUrl = import.meta.env.VITE_API_URL || import.meta.env.VITE_BACKEND_URL;
|
||||
if (envUrl) {
|
||||
return envUrl.endsWith('/api') ? envUrl : `${envUrl}/api`;
|
||||
}
|
||||
|
||||
// Auto-detect based on current origin
|
||||
if (typeof window !== 'undefined') {
|
||||
const origin = window.location.origin;
|
||||
|
||||
// If accessing via IP, use backend port 8011
|
||||
if (/^\d+\.\d+\.\d+\.\d+/.test(origin) || origin.includes('localhost')) {
|
||||
return origin.replace(':8021', ':8011') + '/api';
|
||||
}
|
||||
}
|
||||
|
||||
// Production: use subdomain
|
||||
return 'https://api.igny8.com/api';
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 2.5: Update Navigation Menu
|
||||
|
||||
**File:** `/frontend/src/components/sidebar/AppSidebar.tsx` or navigation component
|
||||
|
||||
**Add Site Builder menu item:**
|
||||
```tsx
|
||||
{
|
||||
title: "Site Builder",
|
||||
icon: <LayoutGrid className="h-5 w-5" />,
|
||||
items: [
|
||||
{ title: "New Blueprint", path: "/sites/builder" },
|
||||
{ title: "Preview", path: "/sites/builder/preview" },
|
||||
{ title: "History", path: "/sites/builder/dashboard" },
|
||||
],
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 3: Docker Configuration Updates
|
||||
|
||||
#### Step 3.1: Update docker-compose.app.yml
|
||||
|
||||
**File:** `/docker-compose.app.yml`
|
||||
|
||||
**Remove the igny8_sites service:**
|
||||
```yaml
|
||||
# REMOVE THIS ENTIRE SERVICE:
|
||||
# igny8_sites:
|
||||
# image: igny8-sites-dev:latest
|
||||
# container_name: igny8_sites
|
||||
# restart: always
|
||||
# ports:
|
||||
# - "0.0.0.0:8024:5176"
|
||||
# environment:
|
||||
# VITE_API_URL: "https://api.igny8.com/api"
|
||||
# SITES_DATA_PATH: "/sites"
|
||||
# volumes:
|
||||
# - /data/app/igny8/sites:/app:rw
|
||||
# - /data/app/sites-data:/sites:ro
|
||||
# - /data/app/igny8/frontend:/frontend:ro
|
||||
# networks: [igny8_net]
|
||||
```
|
||||
|
||||
**Update igny8_frontend service to access sites-data:**
|
||||
```yaml
|
||||
igny8_frontend:
|
||||
image: igny8-frontend-dev:latest
|
||||
container_name: igny8_frontend
|
||||
restart: always
|
||||
ports:
|
||||
- "0.0.0.0:8021:5173"
|
||||
environment:
|
||||
VITE_BACKEND_URL: "https://api.igny8.com/api"
|
||||
SITES_DATA_PATH: "/sites" # ADD THIS
|
||||
volumes:
|
||||
- /data/app/igny8/frontend:/app:rw
|
||||
- /data/app/sites-data:/sites:ro # ADD THIS - Read-only access to sites data
|
||||
depends_on:
|
||||
igny8_backend:
|
||||
condition: service_healthy
|
||||
networks: [igny8_net]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 3.2: Update Vite Configuration
|
||||
|
||||
**File:** `/frontend/vite.config.ts`
|
||||
|
||||
**Add environment variable for sites data path:**
|
||||
```typescript
|
||||
export default defineConfig({
|
||||
// ... existing config
|
||||
define: {
|
||||
'import.meta.env.SITES_DATA_PATH': JSON.stringify(
|
||||
process.env.SITES_DATA_PATH || '/sites'
|
||||
),
|
||||
},
|
||||
// ... rest of config
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 4: Backend Updates (Minor)
|
||||
|
||||
#### Step 4.1: Update CORS Settings (if needed)
|
||||
|
||||
**File:** `/backend/igny8_core/settings.py`
|
||||
|
||||
**Verify CORS allows frontend port:**
|
||||
```python
|
||||
CORS_ALLOWED_ORIGINS = [
|
||||
'http://localhost:5173', # Frontend dev server
|
||||
'http://localhost:8021', # Frontend external port
|
||||
'https://app.igny8.com',
|
||||
# Remove: 'http://localhost:8024', # Old sites container
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 4.2: Update Site Definition API (Optional Enhancement)
|
||||
|
||||
**File:** `/backend/igny8_core/modules/publisher/views.py`
|
||||
|
||||
**No changes required** - API already works, just being called from different container.
|
||||
|
||||
**Optional:** Add CORS header for public site renderer if needed:
|
||||
```python
|
||||
from rest_framework.decorators import api_view, permission_classes
|
||||
from rest_framework.permissions import AllowAny
|
||||
|
||||
@api_view(['GET'])
|
||||
@permission_classes([AllowAny]) # Public endpoint
|
||||
def get_site_definition(request, site_id):
|
||||
# ... existing code
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 5: Testing & Verification
|
||||
|
||||
#### Step 5.1: Build Updated Frontend
|
||||
```bash
|
||||
cd /data/app/igny8/frontend
|
||||
|
||||
# Install any new dependencies (if added)
|
||||
npm install
|
||||
|
||||
# Build to verify no errors
|
||||
npm run build
|
||||
|
||||
# Rebuild Docker image
|
||||
cd /data/app/igny8/frontend
|
||||
docker build -t igny8-frontend-dev:latest -f Dockerfile.dev .
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 5.2: Stop Old Container
|
||||
```bash
|
||||
# Stop and remove sites container
|
||||
docker stop igny8_sites
|
||||
docker rm igny8_sites
|
||||
|
||||
# Verify it's stopped
|
||||
docker ps | grep sites
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 5.3: Start Updated Stack
|
||||
```bash
|
||||
cd /data/app/igny8
|
||||
|
||||
# Start with updated docker-compose
|
||||
docker compose -f docker-compose.app.yml up -d igny8_frontend
|
||||
|
||||
# Check logs
|
||||
docker logs -f igny8_frontend
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 5.4: Test Functionality
|
||||
|
||||
**Test Site Builder:**
|
||||
```bash
|
||||
# Test builder routes (should require auth)
|
||||
curl -I http://localhost:8021/sites/builder
|
||||
|
||||
# Test in browser:
|
||||
# http://localhost:8021/sites/builder (wizard)
|
||||
# http://localhost:8021/sites/builder/preview
|
||||
# http://localhost:8021/sites/builder/dashboard
|
||||
```
|
||||
|
||||
**Test Sites Renderer:**
|
||||
```bash
|
||||
# Test public site renderer
|
||||
curl -I http://localhost:8021/sites/view/test-site
|
||||
|
||||
# Test in browser:
|
||||
# http://localhost:8021/sites/view/{siteSlug}
|
||||
# http://localhost:8021/sites/view/{siteSlug}/{pageSlug}
|
||||
```
|
||||
|
||||
**Test Existing API:**
|
||||
```bash
|
||||
# Verify site builder API still works
|
||||
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
|
||||
http://localhost:8011/api/v1/site-builder/blueprints/
|
||||
|
||||
# Verify site definition API
|
||||
curl http://localhost:8011/api/v1/publisher/sites/1/definition/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 6: Cleanup
|
||||
|
||||
#### Step 6.1: Remove Folders (After Verification)
|
||||
|
||||
**Only after confirming everything works:**
|
||||
```bash
|
||||
cd /data/app/igny8
|
||||
|
||||
# Remove sites folder
|
||||
rm -rf sites/
|
||||
|
||||
# Remove site-builder folder (already empty)
|
||||
rm -rf site-builder/
|
||||
|
||||
# Remove empty frontend module
|
||||
rm -rf frontend/src/modules/siteBuilder/
|
||||
|
||||
# Verify removal
|
||||
ls -la | grep -E "site-builder|sites"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 6.2: Remove Docker Image (Optional)
|
||||
```bash
|
||||
# Remove unused sites image
|
||||
docker rmi igny8-sites-dev:latest
|
||||
|
||||
# Verify
|
||||
docker images | grep sites
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### Step 6.3: Clean Up Build Instructions
|
||||
|
||||
**File:** `/docker-compose.app.yml` (comments at top)
|
||||
|
||||
**Remove this line:**
|
||||
```yaml
|
||||
# Remove:
|
||||
# cd /data/app/igny8/sites && docker build -t igny8-sites-dev:latest -f Dockerfile.dev .
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 7: Update Documentation
|
||||
|
||||
#### Step 7.1: Update Files List
|
||||
|
||||
**Files to update:**
|
||||
|
||||
1. **README.md**
|
||||
- Remove references to `/sites/` container
|
||||
- Update port mapping (remove 8024)
|
||||
- Update build instructions
|
||||
|
||||
2. **CHANGELOG.md**
|
||||
- Add entry: "Merged Sites & Site Builder into main frontend app"
|
||||
|
||||
3. **docs/MASTER_REFERENCE.md**
|
||||
- Update architecture diagram
|
||||
- Remove igny8_sites container reference
|
||||
- Update route documentation
|
||||
|
||||
4. **docs/API-COMPLETE-REFERENCE.md**
|
||||
- Update base URLs if needed
|
||||
- Verify endpoint documentation
|
||||
|
||||
---
|
||||
|
||||
#### Step 7.2: Update Architecture Diagram
|
||||
|
||||
**In MASTER_REFERENCE.md, update:**
|
||||
|
||||
**OLD:**
|
||||
```
|
||||
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
|
||||
│ Frontend (8021) │ │ Sites (8024) │ │ Backend (8011) │
|
||||
└──────────────────┘ └──────────────────┘ └──────────────────┘
|
||||
```
|
||||
|
||||
**NEW:**
|
||||
```
|
||||
┌──────────────────┐ ┌──────────────────┐
|
||||
│ Frontend (8021) │ │ Backend (8011) │
|
||||
│ - Main App │ │ - Django API │
|
||||
│ - Site Builder │ │ - Celery │
|
||||
│ - Site Renderer │ │ │
|
||||
└──────────────────┘ └──────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Files & Folders Impact Summary
|
||||
|
||||
### Files to Modify
|
||||
|
||||
| File | Action | Reason |
|
||||
|------|--------|--------|
|
||||
| `/frontend/src/App.tsx` | **UPDATE** | Add site builder and renderer routes |
|
||||
| `/frontend/src/services/siteRenderer.api.ts` | **CREATE** | Site renderer API client |
|
||||
| `/frontend/src/pages/Sites/Builder/` | **CREATE** | Copy from sites/src/builder/ |
|
||||
| `/frontend/src/components/sites/builder/` | **CREATE** | Builder components |
|
||||
| `/frontend/vite.config.ts` | **UPDATE** | Add SITES_DATA_PATH env var |
|
||||
| `/docker-compose.app.yml` | **UPDATE** | Remove igny8_sites service |
|
||||
| `/backend/igny8_core/settings.py` | **VERIFY** | CORS settings (minor) |
|
||||
| `/README.md` | **UPDATE** | Architecture docs |
|
||||
| `/docs/MASTER_REFERENCE.md` | **UPDATE** | Remove sites container refs |
|
||||
|
||||
---
|
||||
|
||||
### Files to Delete (After Verification)
|
||||
|
||||
| File/Folder | Safe to Delete | Notes |
|
||||
|-------------|----------------|-------|
|
||||
| `/sites/` | ✅ YES | After copying to frontend |
|
||||
| `/site-builder/` | ✅ YES | Already empty |
|
||||
| `/frontend/src/modules/siteBuilder/` | ✅ YES | Empty folders |
|
||||
| `docker-compose.app.yml.backup` | ✅ YES | After successful migration |
|
||||
| `backup-sites-*.tar.gz` | ⚠️ KEEP | Keep for 30 days as rollback |
|
||||
|
||||
---
|
||||
|
||||
### Backend Files - NO CHANGES NEEDED
|
||||
|
||||
**These stay exactly as they are:**
|
||||
```
|
||||
backend/igny8_core/
|
||||
├── modules/
|
||||
│ ├── site_builder/ ✅ KEEP - No changes
|
||||
│ └── publisher/ ✅ KEEP - No changes
|
||||
├── business/
|
||||
│ ├── site_building/ ✅ KEEP - No changes
|
||||
│ └── publishing/ ✅ KEEP - No changes
|
||||
└── api/
|
||||
└── wordpress_publishing.py ✅ KEEP - No changes
|
||||
```
|
||||
|
||||
**Rationale:** Backend APIs remain unchanged; only the frontend UI container changes.
|
||||
|
||||
---
|
||||
|
||||
## Rollback Plan
|
||||
|
||||
If issues occur, rollback is simple:
|
||||
|
||||
### Option 1: Quick Rollback (Docker)
|
||||
```bash
|
||||
# Restore backup docker-compose
|
||||
cp docker-compose.app.yml.backup docker-compose.app.yml
|
||||
|
||||
# Restart sites container
|
||||
docker compose -f docker-compose.app.yml up -d igny8_sites
|
||||
|
||||
# Verify
|
||||
docker ps | grep sites
|
||||
curl -I http://localhost:8024/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Option 2: Full Rollback (Restore Files)
|
||||
```bash
|
||||
# Extract backup
|
||||
cd /data/app/igny8
|
||||
tar -xzf backup-sites-YYYYMMDD-HHMMSS.tar.gz
|
||||
|
||||
# Rebuild image
|
||||
cd sites
|
||||
docker build -t igny8-sites-dev:latest -f Dockerfile.dev .
|
||||
|
||||
# Restart
|
||||
docker compose -f docker-compose.app.yml up -d igny8_sites
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Migration Checklist
|
||||
|
||||
**Pre-Migration:**
|
||||
- [ ] Backup `/sites/` folder
|
||||
- [ ] Backup `/docker-compose.app.yml`
|
||||
- [ ] Document current container ports
|
||||
- [ ] Test current site builder functionality
|
||||
- [ ] Test current sites renderer functionality
|
||||
|
||||
**Migration Steps:**
|
||||
- [ ] Copy site builder components to `/frontend/src/pages/Sites/Builder/`
|
||||
- [ ] Copy sites renderer to `/frontend/src/pages/Sites/PublicSiteRenderer.tsx`
|
||||
- [ ] Copy utilities to `/frontend/src/utils/siteRenderer/`
|
||||
- [ ] Update `/frontend/src/App.tsx` with new routes
|
||||
- [ ] Create `/frontend/src/services/siteRenderer.api.ts`
|
||||
- [ ] Update `/frontend/vite.config.ts`
|
||||
- [ ] Update `/docker-compose.app.yml` (remove igny8_sites, update igny8_frontend)
|
||||
- [ ] Rebuild frontend Docker image
|
||||
- [ ] Stop igny8_sites container
|
||||
- [ ] Start updated igny8_frontend container
|
||||
|
||||
**Testing:**
|
||||
- [ ] Test site builder wizard at `/sites/builder`
|
||||
- [ ] Test site builder preview at `/sites/builder/preview`
|
||||
- [ ] Test site builder dashboard at `/sites/builder/dashboard`
|
||||
- [ ] Test public site renderer at `/sites/view/{siteSlug}`
|
||||
- [ ] Verify API calls work from frontend
|
||||
- [ ] Check browser console for errors
|
||||
- [ ] Test with authenticated user
|
||||
- [ ] Test without authentication (public renderer)
|
||||
|
||||
**Post-Migration:**
|
||||
- [ ] Verify all tests pass
|
||||
- [ ] Update documentation (README, MASTER_REFERENCE)
|
||||
- [ ] Remove `/sites/` folder
|
||||
- [ ] Remove `/site-builder/` folder
|
||||
- [ ] Remove empty `/frontend/src/modules/siteBuilder/`
|
||||
- [ ] Remove Docker image `igny8-sites-dev:latest`
|
||||
- [ ] Keep backup for 30 days
|
||||
- [ ] Update portable package documentation
|
||||
|
||||
---
|
||||
|
||||
## FAQ
|
||||
|
||||
### Q: Will this break existing site blueprints?
|
||||
**A:** No. Backend database and APIs remain unchanged. Only the UI container changes.
|
||||
|
||||
### Q: What about published sites in `/data/app/sites-data/`?
|
||||
**A:** They remain accessible. The frontend will mount `/sites-data` and load from there.
|
||||
|
||||
### Q: Do I need to update WordPress integration?
|
||||
**A:** No. WordPress talks to backend API, which doesn't change.
|
||||
|
||||
### Q: What if I want to keep sites as separate container?
|
||||
**A:** Keep current setup. This migration is optional for simplification.
|
||||
|
||||
### Q: Will public site URLs change?
|
||||
**A:** Yes, from `http://localhost:8024/:siteSlug` to `http://localhost:8021/sites/view/:siteSlug`. Update any hardcoded links.
|
||||
|
||||
### Q: Can I run both containers during transition?
|
||||
**A:** Yes, for testing. Run sites on 8024 and updated frontend on 8021, compare functionality.
|
||||
|
||||
---
|
||||
|
||||
## Support & Troubleshooting
|
||||
|
||||
### Issue: Routes not working after migration
|
||||
**Solution:** Check route order in `App.tsx`. Public renderer routes should be after protected routes.
|
||||
|
||||
### Issue: API calls failing
|
||||
**Solution:** Verify `VITE_BACKEND_URL` in environment and check CORS settings.
|
||||
|
||||
### Issue: Sites data not loading
|
||||
**Solution:** Verify `/data/app/sites-data` is mounted in docker-compose frontend service.
|
||||
|
||||
### Issue: Build errors
|
||||
**Solution:** Run `npm install` to ensure dependencies match between sites and frontend.
|
||||
|
||||
---
|
||||
|
||||
## Timeline Estimate
|
||||
|
||||
| Phase | Time | Complexity |
|
||||
|-------|------|------------|
|
||||
| Phase 1: Preparation | 30 min | Low |
|
||||
| Phase 2: Frontend Integration | 2-3 hours | Medium |
|
||||
| Phase 3: Docker Updates | 30 min | Low |
|
||||
| Phase 4: Backend Updates | 15 min | Low |
|
||||
| Phase 5: Testing | 1-2 hours | Medium |
|
||||
| Phase 6: Cleanup | 15 min | Low |
|
||||
| Phase 7: Documentation | 1 hour | Low |
|
||||
| **Total** | **5-7 hours** | **Medium** |
|
||||
|
||||
---
|
||||
|
||||
**End of Document**
|
||||
329
docs/SITES_REMOVAL_QUICK_REFERENCE.md
Normal file
329
docs/SITES_REMOVAL_QUICK_REFERENCE.md
Normal file
@@ -0,0 +1,329 @@
|
||||
# Sites Container Removal - Quick Reference
|
||||
|
||||
**Version:** 1.0
|
||||
**Date:** November 29, 2025
|
||||
|
||||
> **Full Guide:** See [SITES_REMOVAL_GUIDE.md](./SITES_REMOVAL_GUIDE.md) for complete step-by-step instructions
|
||||
|
||||
---
|
||||
|
||||
## TL;DR - What Changes
|
||||
|
||||
### Current Architecture (3 Containers)
|
||||
```
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│ Frontend │ │ Sites │ │ Backend │
|
||||
│ Port: 8021 │ │ Port: 8024 │ │ Port: 8011 │
|
||||
│ │ │ - Site Builder │ │ │
|
||||
│ │ │ - Renderer │ │ │
|
||||
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
||||
```
|
||||
|
||||
### Target Architecture (2 Containers)
|
||||
```
|
||||
┌─────────────────┐ ┌─────────────────┐
|
||||
│ Frontend │ │ Backend │
|
||||
│ Port: 8021 │ │ Port: 8011 │
|
||||
│ - Main App │ │ │
|
||||
│ - Site Builder │ │ │
|
||||
│ - Renderer │ │ │
|
||||
└─────────────────┘ └─────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## What Gets Removed
|
||||
|
||||
❌ **Deleted:**
|
||||
- `/sites/` folder (after copying to frontend)
|
||||
- `/site-builder/` folder (empty, deprecated)
|
||||
- `/frontend/src/modules/siteBuilder/` (empty)
|
||||
- `igny8_sites` Docker container
|
||||
- Port 8024
|
||||
|
||||
✅ **Kept:**
|
||||
- Backend `/api/v1/site-builder/` endpoints
|
||||
- Backend `/api/v1/publisher/` endpoints
|
||||
- Backend modules: `site_builder/`, `publisher/`
|
||||
- Backend business logic: `site_building/`, `publishing/`
|
||||
- Database tables (no changes)
|
||||
- `/data/app/sites-data/` directory
|
||||
|
||||
---
|
||||
|
||||
## What Gets Moved
|
||||
|
||||
### File Movements
|
||||
|
||||
| From (Sites Container) | To (Frontend) |
|
||||
|------------------------|---------------|
|
||||
| `sites/src/builder/pages/wizard/` | `frontend/src/pages/Sites/Builder/Wizard.tsx` |
|
||||
| `sites/src/builder/pages/preview/` | `frontend/src/pages/Sites/Builder/Preview.tsx` |
|
||||
| `sites/src/builder/pages/dashboard/` | `frontend/src/pages/Sites/Builder/Dashboard.tsx` |
|
||||
| `sites/src/builder/components/layout/` | `frontend/src/components/sites/BuilderLayout.tsx` |
|
||||
| `sites/src/pages/SiteRenderer.tsx` | `frontend/src/pages/Sites/PublicSiteRenderer.tsx` |
|
||||
| `sites/src/loaders/loadSiteDefinition.ts` | `frontend/src/services/siteRenderer.api.ts` |
|
||||
| `sites/src/utils/layoutRenderer.tsx` | `frontend/src/utils/siteRenderer/layoutRenderer.tsx` |
|
||||
| `sites/src/utils/pageTypeRenderer.tsx` | `frontend/src/utils/siteRenderer/pageTypeRenderer.tsx` |
|
||||
| `sites/src/utils/templateEngine.tsx` | `frontend/src/utils/siteRenderer/templateEngine.tsx` |
|
||||
|
||||
---
|
||||
|
||||
## Route Changes
|
||||
|
||||
### Site Builder Routes
|
||||
|
||||
| Old Route (Port 8024) | New Route (Port 8021) | Auth |
|
||||
|----------------------|----------------------|------|
|
||||
| `/builder` | `/sites/builder` | Required ✅ |
|
||||
| `/builder/preview` | `/sites/builder/preview` | Required ✅ |
|
||||
| `/builder/dashboard` | `/sites/builder/dashboard` | Required ✅ |
|
||||
|
||||
### Sites Renderer Routes
|
||||
|
||||
| Old Route (Port 8024) | New Route (Port 8021) | Auth |
|
||||
|----------------------|----------------------|------|
|
||||
| `/:siteSlug` | `/sites/view/:siteSlug` | None ❌ |
|
||||
| `/:siteSlug/:pageSlug` | `/sites/view/:siteSlug/:pageSlug` | None ❌ |
|
||||
|
||||
**⚠️ Important:** Public site URLs will change! Update any hardcoded links.
|
||||
|
||||
---
|
||||
|
||||
## Files to Update
|
||||
|
||||
### Critical Files (Must Update)
|
||||
|
||||
1. **`/frontend/src/App.tsx`**
|
||||
- Add site builder routes
|
||||
- Add public renderer routes
|
||||
- Add lazy imports
|
||||
|
||||
2. **`/docker-compose.app.yml`**
|
||||
- Remove `igny8_sites` service
|
||||
- Add `/sites-data` volume mount to `igny8_frontend`
|
||||
- Add `SITES_DATA_PATH` env var to `igny8_frontend`
|
||||
|
||||
3. **`/frontend/vite.config.ts`**
|
||||
- Add `SITES_DATA_PATH` environment variable
|
||||
|
||||
### Optional Files (Verify/Update)
|
||||
|
||||
4. **`/backend/igny8_core/settings.py`**
|
||||
- Verify CORS settings (remove port 8024)
|
||||
|
||||
5. **`/frontend/src/components/sidebar/AppSidebar.tsx`**
|
||||
- Add site builder menu items
|
||||
|
||||
---
|
||||
|
||||
## Critical Commands
|
||||
|
||||
### 1. Backup First
|
||||
```bash
|
||||
cd /data/app/igny8
|
||||
tar -czf backup-sites-$(date +%Y%m%d-%H%M%S).tar.gz sites/ site-builder/
|
||||
cp docker-compose.app.yml docker-compose.app.yml.backup
|
||||
```
|
||||
|
||||
### 2. Copy Files
|
||||
```bash
|
||||
# Create directories
|
||||
mkdir -p frontend/src/pages/Sites/Builder
|
||||
mkdir -p frontend/src/components/sites/builder
|
||||
mkdir -p frontend/src/utils/siteRenderer
|
||||
|
||||
# Copy builder pages
|
||||
cp sites/src/builder/pages/wizard/WizardPage.tsx frontend/src/pages/Sites/Builder/Wizard.tsx
|
||||
cp sites/src/builder/pages/preview/PreviewCanvas.tsx frontend/src/pages/Sites/Builder/Preview.tsx
|
||||
cp sites/src/builder/pages/dashboard/SiteDashboard.tsx frontend/src/pages/Sites/Builder/Dashboard.tsx
|
||||
|
||||
# Copy renderer
|
||||
cp sites/src/pages/SiteRenderer.tsx frontend/src/pages/Sites/PublicSiteRenderer.tsx
|
||||
cp sites/src/loaders/loadSiteDefinition.ts frontend/src/services/siteRenderer.api.ts
|
||||
|
||||
# Copy utilities
|
||||
cp -r sites/src/utils/* frontend/src/utils/siteRenderer/
|
||||
```
|
||||
|
||||
### 3. Rebuild & Restart
|
||||
```bash
|
||||
# Rebuild frontend
|
||||
cd /data/app/igny8/frontend
|
||||
docker build -t igny8-frontend-dev:latest -f Dockerfile.dev .
|
||||
|
||||
# Stop sites container
|
||||
docker stop igny8_sites
|
||||
docker rm igny8_sites
|
||||
|
||||
# Start updated frontend
|
||||
cd /data/app/igny8
|
||||
docker compose -f docker-compose.app.yml up -d igny8_frontend
|
||||
```
|
||||
|
||||
### 4. Test
|
||||
```bash
|
||||
# Test site builder (requires auth)
|
||||
curl -I http://localhost:8021/sites/builder
|
||||
|
||||
# Test public renderer
|
||||
curl -I http://localhost:8021/sites/view/test-site
|
||||
|
||||
# Check logs
|
||||
docker logs -f igny8_frontend
|
||||
```
|
||||
|
||||
### 5. Cleanup (After Verification)
|
||||
```bash
|
||||
cd /data/app/igny8
|
||||
rm -rf sites/
|
||||
rm -rf site-builder/
|
||||
rm -rf frontend/src/modules/siteBuilder/
|
||||
docker rmi igny8-sites-dev:latest
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Impact on Other Features
|
||||
|
||||
### ✅ No Impact (These Still Work)
|
||||
|
||||
| Feature | Why No Impact |
|
||||
|---------|---------------|
|
||||
| Planner module | Uses only backend API |
|
||||
| Writer module | Uses only backend API |
|
||||
| Linker module | Uses only backend API |
|
||||
| Optimizer module | Uses only backend API |
|
||||
| WordPress Publishing | Talks to backend, not affected |
|
||||
| Authentication | Frontend change only |
|
||||
| Billing/Credits | Backend only |
|
||||
| AI Content Generation | Backend/Celery only |
|
||||
|
||||
### ⚠️ Needs Update (After Migration)
|
||||
|
||||
| Feature | What to Update | Impact |
|
||||
|---------|----------------|--------|
|
||||
| Site Builder UI | Routes change to `/sites/builder/*` | Low - Internal only |
|
||||
| Public Site Links | URLs change to `/sites/view/{slug}` | Medium - External links |
|
||||
| Navigation Menu | Add site builder menu items | Low - UI only |
|
||||
| Tests | Update route tests if any | Low - Dev only |
|
||||
|
||||
---
|
||||
|
||||
## Docker Compose Changes
|
||||
|
||||
### Before (3 Services)
|
||||
```yaml
|
||||
services:
|
||||
igny8_frontend: # Port 8021
|
||||
igny8_sites: # Port 8024 ❌ REMOVE THIS
|
||||
igny8_backend: # Port 8011
|
||||
igny8_celery_worker:
|
||||
igny8_celery_beat:
|
||||
```
|
||||
|
||||
### After (2 Services)
|
||||
```yaml
|
||||
services:
|
||||
igny8_frontend: # Port 8021 (updated)
|
||||
# igny8_sites removed
|
||||
igny8_backend: # Port 8011
|
||||
igny8_celery_worker:
|
||||
igny8_celery_beat:
|
||||
```
|
||||
|
||||
### Frontend Service Update
|
||||
```yaml
|
||||
igny8_frontend:
|
||||
image: igny8-frontend-dev:latest
|
||||
container_name: igny8_frontend
|
||||
ports:
|
||||
- "0.0.0.0:8021:5173"
|
||||
environment:
|
||||
VITE_BACKEND_URL: "https://api.igny8.com/api"
|
||||
SITES_DATA_PATH: "/sites" # ← ADD THIS
|
||||
volumes:
|
||||
- /data/app/igny8/frontend:/app:rw
|
||||
- /data/app/sites-data:/sites:ro # ← ADD THIS
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Testing Checklist
|
||||
|
||||
**Before Migration:**
|
||||
- [ ] Site builder wizard works at `http://localhost:8024/builder`
|
||||
- [ ] Site preview works at `http://localhost:8024/builder/preview`
|
||||
- [ ] Public site loads at `http://localhost:8024/{siteSlug}`
|
||||
|
||||
**After Migration:**
|
||||
- [ ] Site builder wizard works at `http://localhost:8021/sites/builder`
|
||||
- [ ] Site preview works at `http://localhost:8021/sites/builder/preview`
|
||||
- [ ] Blueprint dashboard works at `http://localhost:8021/sites/builder/dashboard`
|
||||
- [ ] Public site loads at `http://localhost:8021/sites/view/{siteSlug}`
|
||||
- [ ] Auth required for builder routes
|
||||
- [ ] No auth required for public renderer
|
||||
- [ ] API calls succeed from frontend
|
||||
- [ ] No console errors in browser
|
||||
- [ ] Sites data loads from `/data/app/sites-data/`
|
||||
|
||||
---
|
||||
|
||||
## Rollback (If Needed)
|
||||
|
||||
```bash
|
||||
# Quick rollback
|
||||
cp docker-compose.app.yml.backup docker-compose.app.yml
|
||||
docker compose -f docker-compose.app.yml up -d igny8_sites
|
||||
|
||||
# Full rollback
|
||||
cd /data/app/igny8
|
||||
tar -xzf backup-sites-YYYYMMDD-HHMMSS.tar.gz
|
||||
cd sites
|
||||
docker build -t igny8-sites-dev:latest -f Dockerfile.dev .
|
||||
docker compose -f docker-compose.app.yml up -d igny8_sites
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Estimation
|
||||
|
||||
| Task | Time |
|
||||
|------|------|
|
||||
| Backup & Prep | 30 min |
|
||||
| Copy Files & Update Routes | 2 hours |
|
||||
| Docker Config Updates | 30 min |
|
||||
| Rebuild & Deploy | 30 min |
|
||||
| Testing | 1-2 hours |
|
||||
| Cleanup & Docs | 1 hour |
|
||||
| **Total** | **5-6 hours** |
|
||||
|
||||
---
|
||||
|
||||
## Decision Matrix
|
||||
|
||||
### Keep Separate Sites Container If:
|
||||
- ❌ You need different deployment schedules for sites vs main app
|
||||
- ❌ You want sites on different infrastructure
|
||||
- ❌ You have high traffic public sites (performance isolation)
|
||||
- ❌ You want to scale sites independently
|
||||
|
||||
### Merge Into Frontend If:
|
||||
- ✅ You want simpler deployment (fewer containers)
|
||||
- ✅ You want unified routing and authentication
|
||||
- ✅ Sites are internal/low traffic
|
||||
- ✅ You want easier development (single app)
|
||||
- ✅ You want to reduce port complexity
|
||||
|
||||
---
|
||||
|
||||
## Support
|
||||
|
||||
**Full Documentation:** [SITES_REMOVAL_GUIDE.md](./SITES_REMOVAL_GUIDE.md)
|
||||
**Architecture Reference:** [MASTER_REFERENCE.md](./MASTER_REFERENCE.md)
|
||||
**API Reference:** [API-COMPLETE-REFERENCE.md](./API-COMPLETE-REFERENCE.md)
|
||||
|
||||
---
|
||||
|
||||
**Last Updated:** November 29, 2025
|
||||
**Status:** Ready for implementation
|
||||
Reference in New Issue
Block a user