Site design updates

This commit is contained in:
Desktop
2025-11-14 01:16:08 +05:00
parent f8bab8d432
commit e74c048f46
17 changed files with 429 additions and 1618 deletions

View File

@@ -1,194 +0,0 @@
# Deployment Architecture Analysis
## Current Setup
### Domain Routing
- **`app.igny8.com`** → Vite dev server container (`igny8_frontend:5173`)
- Live reload enabled
- Development mode
- Changes reflect immediately
- **`igny8.com`** → Static files from `/var/www/igny8-marketing`
- Production marketing site
- Requires manual build + copy to update
- No containerization
### Current Issues
1. ❌ Marketing site deployment is manual (not containerized)
2. ❌ No automated deployment process
3. ❌ Dev changes affect `app.igny8.com` but not `igny8.com` (confusing)
4. ⚠️ Marketing site not versioned with codebase
---
## Option Comparison
### Option A: Separate Containers (Recommended ✅)
**Structure:**
```
igny8_frontend_dev → app.igny8.com (Vite dev server)
igny8_frontend_prod → app.igny8.com (Production build, optional)
igny8_marketing → igny8.com (Marketing static site)
```
**Pros:**
- ✅ Clear separation of concerns
- ✅ Independent scaling and updates
- ✅ Marketing site can be updated without affecting app
- ✅ Production app can be containerized separately
- ✅ Better security isolation
- ✅ Easier CI/CD automation
- ✅ Version control for marketing deployments
**Cons:**
- ⚠️ Slightly more complex docker-compose setup
- ⚠️ Need to manage 2-3 containers instead of 1
**Implementation:**
```yaml
services:
igny8_frontend_dev:
# Current dev server for app.igny8.com
image: igny8-frontend-dev:latest
ports: ["8021:5173"]
igny8_marketing:
# Production marketing site for igny8.com
image: igny8-marketing:latest
build:
context: ./frontend
dockerfile: Dockerfile.marketing
volumes:
- marketing_static:/usr/share/caddy:ro
```
---
### Option B: Current Approach (Keep Manual)
**Structure:**
```
igny8_frontend_dev → app.igny8.com (Vite dev server)
/var/www/igny8-marketing → igny8.com (Manual static files)
```
**Pros:**
- ✅ Simple (already working)
- ✅ No additional containers
- ✅ Fast static file serving
**Cons:**
- ❌ Manual deployment process
- ❌ No version control for marketing site
- ❌ Hard to rollback
- ❌ Not containerized (harder to manage)
- ❌ Deployment not reproducible
---
### Option C: Unified Production Build
**Structure:**
```
Single container serves both app and marketing from same build
```
**Pros:**
- ✅ Single container to manage
- ✅ Both sites from same codebase
**Cons:**
- ❌ Can't update marketing without rebuilding app
- ❌ Larger container size
- ❌ Less flexible deployment
- ❌ Dev server still separate anyway
---
## Recommendation: **Option A - Separate Containers**
### Why This Is Better:
1. **Production-Ready App Container**
- Can deploy production build of app to `app.igny8.com` when needed
- Dev container for development, prod container for production
2. **Containerized Marketing Site**
- Marketing site becomes a proper container
- Easy to update: rebuild image, restart container
- Version controlled deployments
- Rollback capability
3. **Clear Separation**
- Dev environment: `igny8_frontend_dev``app.igny8.com`
- Production app: `igny8_frontend_prod``app.igny8.com` (when ready)
- Marketing site: `igny8_marketing``igny8.com`
4. **Better CI/CD**
- Can deploy marketing site independently
- Can deploy app independently
- Automated builds and deployments
5. **Scalability**
- Each service can scale independently
- Better resource management
---
## Implementation Plan
### Step 1: Create Marketing Dockerfile
```dockerfile
# frontend/Dockerfile.marketing
FROM node:18-alpine AS builder
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build:marketing
FROM caddy:latest
COPY --from=builder /app/dist /usr/share/caddy
COPY Caddyfile.marketing /etc/caddy/Caddyfile
EXPOSE 8020
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
```
### Step 2: Create Marketing Caddyfile
```caddyfile
# frontend/Caddyfile.marketing
:8020 {
root * /usr/share/caddy
try_files {path} /marketing.html
file_server
}
```
### Step 3: Update docker-compose.app.yml
Add marketing service alongside frontend dev service.
### Step 4: Update Main Caddyfile
Point `igny8.com` to `igny8_marketing:8020` instead of static files.
---
## Migration Path
1. **Phase 1**: Add marketing container (keep current setup working)
2. **Phase 2**: Test marketing container on staging domain
3. **Phase 3**: Switch `igny8.com` to use container
4. **Phase 4**: Remove manual `/var/www/igny8-marketing` setup
---
## Conclusion
**Separate containers (Option A) is the best long-term solution** because:
- ✅ Production-ready architecture
- ✅ Better DevOps practices
- ✅ Easier maintenance
- ✅ Scalable and flexible
- ✅ Industry standard approach
The current setup works but is not ideal for production. Separate containers provide better separation, versioning, and deployment automation.

View File

@@ -1,113 +0,0 @@
# Deployment Status - Marketing Container
**Last Updated:** 2025-11-13
**Status:****OPERATIONAL**
---
## Current Status
### Containers
-`igny8_marketing` - Running (Port 8020 internal, 8022 external)
-`igny8_caddy` - Running (Routes `igny8.com``igny8_marketing:8020`)
-`igny8_frontend` - Running (Vite dev server for `app.igny8.com`)
-`igny8_backend` - Running (Django API for `api.igny8.com`)
### Network
- ✅ All containers on `igny8_net` network
- ✅ Caddy can reach marketing container
- ✅ Marketing container serving on port 8020
### HTTP Status
- ✅ Marketing container: HTTP 200 (direct access)
- ✅ Through Caddy: HTTP 200 (production routing)
---
## Deployment Process Verified
The automated deployment process has been tested and is working:
```bash
# 1. Build marketing image
cd /data/app/igny8/frontend
docker build -t igny8-marketing:latest -f Dockerfile.marketing .
# 2. Restart container
cd /data/app/igny8
docker compose -f docker-compose.app.yml -p igny8-app restart igny8_marketing
```
**Result:** ✅ Container restarts with new build, site updates immediately.
---
## Architecture
```
Internet
Caddy (HTTPS:443)
igny8.com → igny8_marketing:8020 (Container)
app.igny8.com → igny8_frontend:5173 (Vite Dev)
api.igny8.com → igny8_backend:8010 (Django)
```
---
## Quick Commands
### Check Status
```bash
docker ps --filter "name=igny8_marketing"
docker logs igny8_marketing --tail 20
```
### Update Marketing Site
```bash
cd /data/app/igny8/frontend
docker build -t igny8-marketing:latest -f Dockerfile.marketing .
cd /data/app/igny8
docker compose -f docker-compose.app.yml -p igny8-app restart igny8_marketing
```
### Test Connectivity
```bash
# Direct container access
curl http://localhost:8022/marketing.html
# Through Caddy (production)
curl https://igny8.com/marketing.html
```
---
## Migration Complete
**Old manual process is deprecated**
**New containerized process is active**
**Site is fully operational**
The marketing site is now:
- Containerized
- Version controlled (Docker images)
- Automatically deployed
- Easy to rollback
- Production-ready
---
## Next Steps (Optional)
1. **Set up CI/CD** - Automate builds on git push
2. **Add health checks** - Monitor container health
3. **Set up monitoring** - Track container metrics
4. **Create backup strategy** - Tag images before updates
---
**See Also:**
- [Marketing Deployment Guide](./MARKETING_DEPLOYMENT.md)
- [Deployment Architecture](./DEPLOYMENT_ARCHITECTURE.md)

View File

@@ -1,236 +0,0 @@
# Marketing Dev Frontend Configuration Analysis
**Date:** 2025-01-XX
**Status:****FIXED** - All issues resolved
---
## Executive Summary
Analysis of the marketing dev frontend container and configuration reveals:
-**Architecture Consistency**: Follows existing architecture (separate containers)
-**No Parallel Builds**: Uses `image:` not `build:` to avoid conflicts
-**Caddy Routing**: Correctly configured for dev mode
-**Network Configuration**: All containers on `igny8_net` network
- ⚠️ **FIXED**: Port mismatch in production marketing container
---
## Configuration Analysis
### 1. Container Configuration ✅
#### `igny8_marketing_dev` (Development)
- **Image**: `igny8-marketing-dev:latest`
- **Ports**: `8023:5174` (external:internal)
- **Volume Mount**: `/data/app/igny8/frontend:/app:rw` (live reload)
- **Network**: `igny8_net`
- **Status**: ✅ Correctly configured
#### `igny8_marketing` (Production)
- **Image**: `igny8-marketing:latest`
- **Ports**: `8022:8020` (external:internal) - **FIXED**
- **Network**: `igny8_net`
- **Status**: ✅ Fixed - now matches Dockerfile.marketing (port 8020)
### 2. Dockerfile Configuration ✅
#### Dockerfile.marketing.dev
- **Base**: `node:18-alpine`
- **Port**: `5174` (Vite dev server)
- **Command**: `npm run dev:marketing`
- **Status**: ✅ Correct
#### Dockerfile.marketing
- **Base**: `caddy:latest` (multi-stage build)
- **Port**: `8020` (Caddy server)
- **Command**: `caddy run --config /etc/caddy/Caddyfile`
- **Status**: ✅ Correct
### 3. Caddy Routing Configuration ✅
**Main Caddyfile Location**: `/var/lib/docker/volumes/portainer_data/_data/caddy/Caddyfile`
**Current Configuration (Dev Mode)**:
```caddyfile
igny8.com {
reverse_proxy igny8_marketing_dev:5174 {
# WebSocket support for HMR
header_up Connection {>Connection}
header_up Upgrade {>Upgrade}
}
}
```
**Status**: ✅ Correctly routing to dev container with HMR support
**Production Mode** (when switching):
```caddyfile
igny8.com {
reverse_proxy igny8_marketing:8020 {
# Static production build
}
}
```
### 4. Package.json Scripts ✅
- `dev:marketing`: `vite --host 0.0.0.0 --port 5174 --force marketing.html`
- `build:marketing`: `vite build --mode marketing`
**Status**: ✅ All scripts correctly configured
### 5. Network Architecture ✅
All containers are on the `igny8_net` external network:
-`igny8_marketing_dev``igny8_net`
-`igny8_marketing``igny8_net`
-`igny8_frontend``igny8_net`
-`igny8_backend``igny8_net`
-`igny8_caddy``igny8_net`
**Status**: ✅ All containers can communicate via container names
---
## Issues Found & Fixed
### Issue 1: Port Mismatch in Production Container ⚠️ → ✅ FIXED
**Problem**:
- `docker-compose.app.yml` mapped `8022:5174` for `igny8_marketing`
- But `Dockerfile.marketing` exposes port `8020` (Caddy)
- This would cause connection failures when Caddy routes to production
**Fix Applied**:
```yaml
# Before
ports:
- "0.0.0.0:8022:5174" # WRONG
# After
ports:
- "0.0.0.0:8022:8020" # CORRECT - matches Caddy port
```
**Status**: ✅ Fixed in `docker-compose.app.yml`
---
## Architecture Consistency Check
### ✅ Follows Existing Architecture
1. **Separate Containers**: ✅
- Dev and production containers are separate
- Matches architecture principle (Option A from DEPLOYMENT_ARCHITECTURE.md)
2. **No Parallel Builds**: ✅
- Uses `image:` not `build:` in docker-compose
- Prevents Portainer/CLI conflicts
- Images built separately as documented
3. **Network Isolation**: ✅
- All containers on `igny8_net`
- External network (shared with infra stack)
- Container name resolution works
4. **Port Allocation**: ✅
- `8021`: Frontend dev (app)
- `8022`: Marketing production
- `8023`: Marketing dev
- No conflicts
5. **Volume Mounts**: ✅
- Dev container has volume mount for HMR
- Production container is stateless (built image)
---
## Accessibility Verification
### ✅ All Services Accessible
1. **Direct Access**:
- Marketing Dev: `http://localhost:8023`
- Marketing Prod: `http://localhost:8022`
- Frontend Dev: `http://localhost:8021`
2. **Through Caddy (HTTPS)**:
- `https://igny8.com``igny8_marketing_dev:5174` (dev mode) ✅
- `https://app.igny8.com``igny8_frontend:5173`
- `https://api.igny8.com``igny8_backend:8010`
3. **WebSocket Support**:
- Caddy configured with WebSocket headers for HMR ✅
- Dev container supports HMR ✅
---
## Gaps & Parallel Builds Check
### ✅ No Gaps Found
1. **Container Definitions**: All containers defined in `docker-compose.app.yml`
2. **Dockerfiles**: All Dockerfiles exist and are correct
3. **Caddyfile**: Routing configured correctly
4. **Scripts**: All npm scripts exist in package.json
5. **Network**: All containers on same network
### ✅ No Parallel Builds
1. **docker-compose.app.yml**: Uses `image:` not `build:`
2. **Build Instructions**: Clear documentation to build separately ✅
3. **No Conflicts**: Portainer and CLI can use same compose file ✅
---
## Summary
### ✅ Configuration Status
| Component | Status | Notes |
|-----------|--------|-------|
| **Container Config** | ✅ Fixed | Port mismatch corrected |
| **Dockerfiles** | ✅ Correct | All ports match |
| **Caddy Routing** | ✅ Correct | Dev mode active |
| **Network** | ✅ Correct | All on `igny8_net` |
| **Scripts** | ✅ Correct | All npm scripts exist |
| **Architecture** | ✅ Consistent | Follows existing patterns |
| **Accessibility** | ✅ Accessible | All services reachable |
| **No Gaps** | ✅ Complete | All components present |
| **No Parallel Builds** | ✅ Clean | Uses `image:` not `build:` |
### ✅ All Issues Resolved
1. ✅ Port mismatch fixed in `docker-compose.app.yml`
2. ✅ Configuration consistent with architecture
3. ✅ All services accessible
4. ✅ No gaps or parallel builds
---
## Recommendations
### Current Setup (Dev Mode)
- ✅ Marketing dev container is active and accessible
- ✅ HMR working through Caddy
- ✅ All routing correct
### For Production Deployment
1. Build production image: `docker build -t igny8-marketing:latest -f Dockerfile.marketing .`
2. Update Caddyfile to route to `igny8_marketing:8020`
3. Restart Caddy: `docker compose restart caddy`
---
## Conclusion
The marketing dev frontend container and configuration are:
-**Consistent** with existing architecture
-**Fully configured** and accessible
-**No gaps** or missing components
-**No parallel builds** - clean configuration
**All issues have been identified and fixed. The system is ready for use.**

View File

@@ -1,210 +0,0 @@
# Marketing Site Container Deployment Guide
## ✅ Implementation Complete
The marketing site is now containerized and running! This document explains the new setup and how to use it.
---
## 🏗️ Architecture
### Before (Manual)
- Marketing files in `/var/www/igny8-marketing/`
- Manual build → copy → restart process
- No version control for deployments
### After (Containerized) ✅
- Marketing site runs in `igny8_marketing` container
- Automated builds and deployments
- Version controlled with Docker images
- Easy rollback capability
---
## 📦 New Components
### 1. Dockerfile.marketing
**Location:** `/data/app/igny8/frontend/Dockerfile.marketing`
Builds the marketing site and serves it with Caddy.
### 2. Caddyfile.marketing
**Location:** `/data/app/igny8/frontend/Caddyfile.marketing`
Caddy configuration for the marketing container (port 8020).
### 3. igny8_marketing Service
**Location:** `docker-compose.app.yml`
New container service for the marketing site.
### 4. Updated Main Caddyfile
**Location:** `/var/lib/docker/volumes/portainer_data/_data/caddy/Caddyfile`
Now routes `igny8.com` to `igny8_marketing:8020` container instead of static files.
---
## 🚀 Deployment Process
### Initial Setup (One-time)
1. **Build the marketing image:**
```bash
cd /data/app/igny8/frontend
docker build -t igny8-marketing:latest -f Dockerfile.marketing .
```
2. **Start the marketing container:**
```bash
cd /data/app/igny8
docker compose -f docker-compose.app.yml -p igny8-app up -d igny8_marketing
```
3. **Reload Caddy:**
```bash
cd /data/app
docker compose restart caddy
```
### Updating Marketing Site
**New Process (Automated):**
```bash
# 1. Rebuild the marketing image
cd /data/app/igny8/frontend
docker build -t igny8-marketing:latest -f Dockerfile.marketing .
# 2. Restart the container (picks up new image)
cd /data/app/igny8
docker compose -f docker-compose.app.yml -p igny8-app restart igny8_marketing
```
**Old Process (Manual - No Longer Needed):**
```bash
# ❌ OLD WAY - Don't use anymore
npm run build:marketing
sudo cp -r dist/* /var/www/igny8-marketing/
docker compose restart caddy
```
---
## 🔄 Rollback Process
If you need to rollback to a previous version:
```bash
# 1. Tag the current image as backup
docker tag igny8-marketing:latest igny8-marketing:backup-$(date +%Y%m%d)
# 2. Tag a previous image as latest (if you have it)
docker tag igny8-marketing:previous-version igny8-marketing:latest
# 3. Restart container
docker compose -f docker-compose.app.yml -p igny8-app restart igny8_marketing
```
---
## 📊 Container Status
### Check Marketing Container
```bash
docker ps --filter "name=igny8_marketing"
```
### View Marketing Logs
```bash
docker logs igny8_marketing
docker logs igny8_marketing --tail 50 -f # Follow logs
```
### Test Marketing Site
```bash
# Test direct container access
curl http://localhost:8022/marketing.html
# Test through Caddy (production)
curl https://igny8.com/marketing.html
```
---
## 🔍 Troubleshooting
### Container Not Starting
```bash
# Check logs
docker logs igny8_marketing
# Check if image exists
docker images | grep igny8-marketing
# Rebuild if needed
cd /data/app/igny8/frontend
docker build -t igny8-marketing:latest -f Dockerfile.marketing .
```
### Caddy Not Routing Correctly
```bash
# Check Caddy logs
docker logs igny8_caddy
# Verify Caddyfile
cat /var/lib/docker/volumes/portainer_data/_data/caddy/Caddyfile
# Reload Caddy
cd /data/app
docker compose restart caddy
```
### Network Issues
```bash
# Verify containers are on same network
docker network inspect igny8_net | grep -A 5 igny8_marketing
docker network inspect igny8_net | grep -A 5 igny8_caddy
```
---
## 📝 File Locations
| Component | Location |
|-----------|----------|
| Dockerfile.marketing | `/data/app/igny8/frontend/Dockerfile.marketing` |
| Caddyfile.marketing | `/data/app/igny8/frontend/Caddyfile.marketing` |
| docker-compose.app.yml | `/data/app/igny8/docker-compose.app.yml` |
| Main Caddyfile | `/var/lib/docker/volumes/portainer_data/_data/caddy/Caddyfile` |
| Marketing Image | Docker: `igny8-marketing:latest` |
| Container Name | `igny8_marketing` |
| Container Port | `8020` (internal), `8022` (external) |
---
## ✅ Benefits
1. **Automated Deployments** - No more manual file copying
2. **Version Control** - Each deployment is a Docker image
3. **Easy Rollback** - Quick container image rollback
4. **Isolation** - Marketing site isolated in its own container
5. **Reproducible** - Same build process every time
6. **CI/CD Ready** - Can be fully automated
---
## 🎯 Current Status
✅ Marketing container is **running**
✅ Caddy routing is **configured**
✅ Site is **accessible** at `https://igny8.com`
✅ Direct container access at `http://localhost:8022`
---
## 📚 Related Documentation
- [Deployment Architecture Analysis](./DEPLOYMENT_ARCHITECTURE.md)
- Docker Compose: `/data/app/igny8/docker-compose.app.yml`
- Main Caddyfile: `/var/lib/docker/volumes/portainer_data/_data/caddy/Caddyfile`

View File

@@ -1,160 +0,0 @@
# Marketing Development Environment with HMR
**Status:****ACTIVE**
The marketing site now has a development environment with Hot Module Replacement (HMR) - just like the app dev environment!
---
## 🚀 Quick Start
### Current Setup
- **Dev Server:** `igny8_marketing_dev` (Vite with HMR)
- **Access:** `https://igny8.com` (routed through Caddy)
- **Direct Access:** `http://localhost:8023`
- **Port:** 5174 (internal), 8023 (external)
### How It Works
1. **Volume Mount:** `/data/app/igny8/frontend``/app` (live file watching)
2. **HMR Enabled:** Changes to files/images update in real-time
3. **No Rebuild Needed:** Just edit files and see changes instantly!
---
## 📝 Development Workflow
### Making Changes
1. **Edit files** in `/data/app/igny8/frontend/src/marketing/`
2. **Edit images** in `/data/app/igny8/frontend/public/marketing/images/`
3. **See changes instantly** - HMR updates the browser automatically!
### No Need To:
- ❌ Run `npm run build:marketing`
- ❌ Rebuild Docker image
- ❌ Restart container
- ❌ Copy files manually
### Just:
- ✅ Edit files
- ✅ Save
- ✅ See changes in browser (HMR handles the rest!)
---
## 🔄 Switching Between Dev and Production
### Development Mode (Current)
**Caddyfile routes to:** `igny8_marketing_dev:5174`
```caddyfile
igny8.com {
reverse_proxy igny8_marketing_dev:5174 {
# WebSocket support for HMR
header_up Connection {>Connection}
header_up Upgrade {>Upgrade}
}
}
```
### Production Mode
**Caddyfile routes to:** `igny8_marketing:8020`
```caddyfile
igny8.com {
reverse_proxy igny8_marketing:8020 {
# Static production build
}
}
```
**To switch:** Edit `/var/lib/docker/volumes/portainer_data/_data/caddy/Caddyfile` and restart Caddy.
---
## 🛠️ Container Management
### Start Dev Server
```bash
cd /data/app/igny8
docker compose -f docker-compose.app.yml -p igny8-app up -d igny8_marketing_dev
```
### View Logs
```bash
docker logs igny8_marketing_dev -f
```
### Restart Dev Server
```bash
docker compose -f docker-compose.app.yml -p igny8-app restart igny8_marketing_dev
```
### Stop Dev Server
```bash
docker compose -f docker-compose.app.yml -p igny8-app stop igny8_marketing_dev
```
---
## 📂 File Locations
| Type | Location |
|------|----------|
| **Marketing Components** | `/data/app/igny8/frontend/src/marketing/` |
| **Marketing Pages** | `/data/app/igny8/frontend/src/marketing/pages/` |
| **Marketing Images** | `/data/app/igny8/frontend/public/marketing/images/` |
| **Marketing Styles** | `/data/app/igny8/frontend/src/marketing/styles/` |
---
## ✅ Benefits
1. **Real-time Updates** - Changes reflect immediately
2. **No Rebuilds** - Edit and save, that's it!
3. **Fast Development** - Same experience as app dev environment
4. **Image Updates** - Images in `public/marketing/images/` update instantly
5. **Component Updates** - React components hot-reload automatically
---
## 🔍 Troubleshooting
### Changes Not Appearing
1. Check container is running: `docker ps | grep igny8_marketing_dev`
2. Check logs: `docker logs igny8_marketing_dev`
3. Verify volume mount: Files should be in `/data/app/igny8/frontend/`
### HMR Not Working
1. Check browser console for WebSocket errors
2. Verify Caddyfile has WebSocket headers
3. Restart Caddy: `docker compose restart caddy`
### Port Conflicts
- Dev server uses port 5174 (internal), 8023 (external)
- If conflicts occur, change port in `docker-compose.app.yml`
---
## 📊 Current Status
**Dev Server:** Running
**HMR:** Enabled
**Volume Mount:** Active
**Caddy Routing:** Configured
**WebSocket Support:** Enabled
---
## 🎯 Next Steps
When ready for production:
1. Build production image: `docker build -t igny8-marketing:latest -f Dockerfile.marketing .`
2. Update Caddyfile to route to `igny8_marketing:8020`
3. Restart Caddy: `docker compose restart caddy`
---
**See Also:**
- [Marketing Deployment Guide](./MARKETING_DEPLOYMENT.md)
- [Deployment Architecture](./DEPLOYMENT_ARCHITECTURE.md)