211 lines
5.0 KiB
Markdown
211 lines
5.0 KiB
Markdown
# 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`
|
|
|