Skip to content

Eddy Slidefactory Client Setup - CLI Implementation Guide

Date: 2025-11-20 Status: Implementation Plan Target: eddy-slidefactory repository setup for Docker/Coolify deployment

Overview

This guide provides step-by-step CLI commands to set up eddy-slidefactory as a client repository that: - Depends on slidefactory-core package - Contains Eddy-specific branding and configuration - Uses Docker Compose for infrastructure - Deploys via Coolify (Docker-based platform)

Target Directory: /home/cgast/Github/slidefactory/eddy-slidefactory


Phase 1: Repository Initialization

Step 1.1: Create Directory Structure

cd /home/cgast/Github/slidefactory/eddy-slidefactory

# Create all directories
mkdir -p eddy_branding/static/img
mkdir -p eddy_branding/templates/branding
mkdir -p workflows
mkdir -p docs
mkdir -p .github/workflows

# Create gitkeep for empty directories
touch workflows/.gitkeep

Step 1.2: Initialize Git Repository

cd /home/cgast/Github/slidefactory/eddy-slidefactory

# Initialize git
git init
git branch -M main

# Note: Add remote after creating GitHub repository
# git remote add origin https://github.com/cgast/eddy-slidefactory.git

Phase 2: Core Files

Step 2.1: Create requirements.txt

cd /home/cgast/Github/slidefactory/eddy-slidefactory

cat > requirements.txt << 'EOF'
# Core dependency (use specific version for production)
slidefactory-core @ git+https://github.com/cgast/slidefactory-core.git@v1.0.0

# For development (uncomment to track main branch)
# slidefactory-core @ git+https://github.com/cgast/slidefactory-core.git@main

# Eddy-specific packages (if any)
# Add any additional packages needed for Eddy workflows
EOF

Step 2.2: Create Dockerfile

cd /home/cgast/Github/slidefactory/eddy-slidefactory

cat > Dockerfile << 'EOF'
FROM python:3.11-slim-bookworm

WORKDIR /code

# Install system dependencies
RUN apt-get update && apt-get install -y \
    python3-dev \
    gcc \
    curl \
    netcat-openbsd \
    tzdata \
    libpq-dev \
    postgresql-client \
    libjpeg-dev \
    zlib1g-dev \
    build-essential \
    libxml2-dev \
    libxslt1-dev \
    libssl-dev \
    libreoffice \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Set timezone
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Create appuser
RUN adduser --disabled-password --gecos '' appuser

# Set up directories
RUN mkdir -p /code/downloads /code/logs /code/workflows && \
    chown -R appuser:appuser /code && \
    chmod 755 /code/downloads /code/logs /code/workflows

# Upgrade pip
RUN pip install --no-cache-dir --upgrade pip

# Install Python packages (including slidefactory-core)
COPY requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir -r /code/requirements.txt

# Copy Eddy-specific files
COPY eddy_branding /code/eddy_branding
COPY workflows /code/workflows
COPY start-web-docker.sh /code/start-web-docker.sh
COPY start-worker.sh /code/start-worker.sh
COPY init.sql /code/init.sql

# Make scripts executable
RUN chmod +x /code/start-web-docker.sh /code/start-worker.sh

# Switch to non-root user
USER appuser

# Healthcheck
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
    CMD curl -f http://localhost:8000/health || exit 1

# Expose port
EXPOSE 8000

# Default command
CMD ["sh", "-c", "uvicorn slidefactory.app.main:app --host 0.0.0.0 --port ${PORT:-8000}"]
EOF

Step 2.3: Copy and Modify docker-compose.yml

cd /home/cgast/Github/slidefactory/eddy-slidefactory

# Copy from s5-slidefactory
cp /home/cgast/Github/slidefactory/s5-slidefactory/docker-compose.yml .

# Update image name
sed -i 's|image: slidefactoryacr.azurecr.io/slidefactory|image: eddy/slidefactory|g' docker-compose.yml

# Verify changes
echo "Modified docker-compose.yml - verify image name changed to eddy/slidefactory"

Step 2.4: Create docker-compose.override.yml

cd /home/cgast/Github/slidefactory/eddy-slidefactory

cat > docker-compose.override.yml << 'EOF'
version: '3.8'

services:
  web:
    env_file:
      - .env.local
    ports:
      - "8000:8000"
    volumes:
      # Mount local workflows directory for development
      - ./workflows:/code/workflows
      # Mount branding for live updates
      - ./eddy_branding:/code/eddy_branding

  worker:
    env_file:
      - .env.local

  minio:
    ports:
      - "9000:9000"   # API
      - "9001:9001"   # Console
    environment:
      - MINIO_SERVER_URL=http://localhost:9000
      - MINIO_BROWSER_REDIRECT_URL=http://localhost:9001
    labels:
      - traefik.enable=false  # Disable Traefik for local dev

  postgres:
    ports:
      - "5432:5432"

  redis:
    ports:
      - "6379:6379"
EOF

Step 2.5: Copy init.sql

cd /home/cgast/Github/slidefactory/eddy-slidefactory

# Copy from s5-slidefactory
cp /home/cgast/Github/slidefactory/s5-slidefactory/init.sql .

echo "Copied init.sql from s5-slidefactory"

Step 2.6: Create Start Scripts

cd /home/cgast/Github/slidefactory/eddy-slidefactory

# Create start-web-docker.sh
cat > start-web-docker.sh << 'EOF'
#!/bin/bash
set -e

echo "🚀 Starting Eddy Slidefactory Web Service"
echo "=========================================="

# Wait for services
echo "⏳ Waiting for PostgreSQL..."
while ! nc -z postgres 5432; do
  sleep 1
done
echo "✓ PostgreSQL ready"

echo "⏳ Waiting for Redis..."
while ! nc -z redis 6379; do
  sleep 1
done
echo "✓ Redis ready"

echo "⏳ Waiting for MinIO..."
while ! nc -z minio 9000; do
  sleep 1
done
echo "✓ MinIO ready"

# Run database migrations
echo "📊 Running database migrations..."
alembic upgrade head

# Initialize system (create admin user if needed)
echo "🔧 Initializing Eddy Slidefactory..."
slidefactory init check || echo "Initialization check complete"

# Start web server
echo "🌐 Starting web server..."
exec uvicorn slidefactory.app.main:app --host 0.0.0.0 --port ${PORT:-8000}
EOF

# Create start-worker.sh
cat > start-worker.sh << 'EOF'
#!/bin/bash
set -e

echo "🚀 Starting Eddy Slidefactory Worker"
echo "===================================="

# Wait for services
echo "⏳ Waiting for PostgreSQL..."
while ! nc -z postgres 5432; do
  sleep 1
done

echo "⏳ Waiting for Redis..."
while ! nc -z redis 6379; do
  sleep 1
done

echo "✓ Services ready"

# Start Celery worker
echo "⚙️  Starting Celery worker..."
exec celery -A slidefactory.app.celery_app worker \
  --loglevel=info \
  --concurrency=2 \
  --time-limit=3600 \
  --soft-time-limit=3300 \
  --events
EOF

# Make scripts executable
chmod +x start-web-docker.sh start-worker.sh

echo "Created and made executable: start-web-docker.sh, start-worker.sh"

Phase 3: Configuration Files

Step 3.1: Create .env.example

cd /home/cgast/Github/slidefactory/eddy-slidefactory

# Copy from s5-slidefactory as base
cp /home/cgast/Github/slidefactory/s5-slidefactory/.env.local .env.example

# Update for Eddy branding
cat >> .env.example << 'EOF'

# ----------------------------------------------------------------
# Eddy-Specific Configuration
# ----------------------------------------------------------------
APPLICATION_NAME="Eddy Slidefactory"
CLIENT_TITLE="Eddy"
CLIENT_LOGO="/eddy_branding/static/img/eddy_logo.png"
CLIENT_LOGO_LARGE="/eddy_branding/static/img/eddy_logo_large.png"
CLIENT_PRIMARY_COLOR="#0066cc"
CLIENT_DESCRIPTION="AI-powered presentation automation for Eddy"
EOF

echo "Created .env.example with Eddy branding configuration"

Step 3.2: Create .gitignore

cd /home/cgast/Github/slidefactory/eddy-slidefactory

cat > .gitignore << 'EOF'
# Environment files
.env
.env.local
.env.*.local

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
*.egg-info/
dist/
build/

# Virtual environments
.venv/
venv/
env/

# Docker
docker-compose.override.yml  # Local dev only (gitignored so users can customize)

# IDE
.vscode/
.idea/
*.swp
*.swo

# Logs
*.log
logs/

# Downloads
downloads/

# OS
.DS_Store
Thumbs.db

# Workflows (if containing sensitive data)
workflows/*
!workflows/.gitkeep

# Local data volumes
postgres_data/
redis_data/
minio_data/
EOF

echo "Created .gitignore"

Phase 4: Eddy Branding (Placeholders)

Step 4.1: Create Placeholder Logo Files

cd /home/cgast/Github/slidefactory/eddy-slidefactory

# Create placeholder text files (replace with actual images later)
cat > eddy_branding/static/img/README.md << 'EOF'
# Eddy Branding Assets

Place your Eddy branding assets here:

## Required Files

- **eddy_logo.png** (192x192px) - Small logo for navbar
- **eddy_logo_large.png** (800x200px) - Banner logo for login page
- **favicon.ico** (32x32px) - Browser favicon

## Guidelines

- Use transparent backgrounds where appropriate
- PNG format for logos
- ICO format for favicon
- Maintain brand colors: #0066cc (or your Eddy brand color)

## Temporary Placeholders

Until you add actual images, the application will fall back to default slidefactory-core branding.
EOF

echo "Created branding directory with README - add actual logo files later"

Step 4.2: Create Optional Template Override

cd /home/cgast/Github/slidefactory/eddy-slidefactory

cat > eddy_branding/templates/branding/README.md << 'EOF'
# Template Overrides

Place Jinja2 template overrides here if you need to customize the UI beyond branding assets.

## Example: Custom Header

Create `header.html.j2` in this directory to override the default header:

jinja2
{# Custom Eddy header #}
<header class="eddy-header">
    <img src="{{ settings.CLIENT_LOGO }}" alt="Eddy Logo">
    <h1>{{ settings.CLIENT_TITLE }}</h1>
</header>


## Template Priority

1. `eddy_branding/templates/` (highest priority)
2. `slidefactory-core` templates (fallback)

Most branding can be done through environment variables and static assets without template overrides.
EOF

echo "Created template override directory with README"

Phase 5: Documentation

Step 5.1: Create README.md

cd /home/cgast/Github/slidefactory/eddy-slidefactory

cat > README.md << 'EOF'
# Eddy Slidefactory

AI-powered presentation automation platform for Eddy, powered by [Slidefactory Core](https://github.com/cgast/slidefactory-core).

## Quick Start

### Prerequisites
- Docker and Docker Compose
- Git

### Local Development

1. Clone repository:
   bash
   git clone https://github.com/cgast/eddy-slidefactory.git
   cd eddy-slidefactory


2. Copy environment template:
   bash
   cp .env.example .env.local


3. Edit `.env.local` with your API keys:
   bash
   # Required: Add your AI provider API key
   OPENAI_API_KEY=sk-your-key-here
   # Or use other providers: Azure OpenAI, Anthropic, Mistral, etc.


4. Start services:
   bash
   docker compose up


5. Access application:
   - **Web UI**: http://localhost:8000
   - **MinIO Console**: http://localhost:9001 (admin/adminadminadmin)

6. Initialize admin user:
   bash
   docker compose exec web slidefactory init admin


### Production Deployment (Coolify)

See [docs/COOLIFY_SETUP.md](docs/COOLIFY_SETUP.md) for deployment instructions.

## Architecture

- **Core Engine**: slidefactory-core (packaged dependency)
- **Branding**: Eddy-specific assets in `eddy_branding/`
- **Workflows**: Custom workflow templates in `workflows/`
- **Infrastructure**: Docker Compose (PostgreSQL, Redis, MinIO)

## Configuration

Key environment variables in `.env.local`:

bash
# AI Provider
AI_PROVIDER=openai
AI_MODEL=gpt-4
OPENAI_API_KEY=sk-your-key

# Branding
CLIENT_TITLE="Eddy"
CLIENT_LOGO="/eddy_branding/static/img/eddy_logo.png"
CLIENT_PRIMARY_COLOR="#0066cc"


See `.env.example` for all options.

## Development

### Update Core Package

bash
# Edit requirements.txt to new version
slidefactory-core @ git+https://github.com/cgast/slidefactory-core.git@v1.1.0

# Rebuild Docker image
docker compose build

# Restart services
docker compose up


### Add Branding Assets

1. Add logo files to `eddy_branding/static/img/`:
   - `eddy_logo.png` (192x192px)
   - `eddy_logo_large.png` (800x200px)
   - `favicon.ico` (32x32px)

2. Update `.env.local` to reference new assets

3. Restart containers to see changes

### Add Custom Workflows

Place workflow templates in `workflows/` directory. They will be automatically discovered.

## Troubleshooting

### Services Won't Start

bash
# Check logs
docker compose logs web
docker compose logs worker

# Restart services
docker compose down
docker compose up

### Database Connection Error

bash
# Check PostgreSQL is running
docker compose ps postgres

# Verify connection string in .env.local
DATABASE_URL=postgresql+psycopg2://postgres:postgres@postgres:5432/slidefactory

### MinIO Authentication Error

bash
# Check MinIO is running
docker compose ps minio

# Verify credentials match in .env.local
MINIO_ACCESS_KEY=admin
MINIO_SECRET_KEY=adminadminadmin


## Support

- **Core Package**: [slidefactory-core](https://github.com/cgast/slidefactory-core)
- **Eddy Client Issues**: [eddy-slidefactory/issues](https://github.com/cgast/eddy-slidefactory/issues)
- **Documentation**: [docs/](docs/)

## License

Copyright © 2025 Eddy
EOF

echo "Created README.md"

Step 5.2: Create docs/COOLIFY_SETUP.md

cd /home/cgast/Github/slidefactory/eddy-slidefactory

cat > docs/COOLIFY_SETUP.md << 'EOF'
# Coolify Deployment Guide

Deploy Eddy Slidefactory using Coolify.

## Prerequisites

- Coolify instance installed and running
- Domain names configured:
  - Main app: `slidefactory.eddy.com`
  - MinIO API: `minio-api.eddy.com`
  - MinIO Console: `minio-console.eddy.com`

## Setup Steps

### 1. Create New Service in Coolify

1. Go to Coolify dashboard
2. Click "New Service"
3. Select "Docker Compose"
4. Connect Git repository:
   - **Repository**: `https://github.com/cgast/eddy-slidefactory.git`
   - **Branch**: `main`
   - **Docker Compose Location**: `docker-compose.yml` (root)

### 2. Configure Environment Variables

Add these environment variables in Coolify UI:

**Required:**
 bash
# AI Provider
AI_PROVIDER=openai
AI_MODEL=gpt-4
OPENAI_API_KEY=sk-your-openai-key-here

# Database (internal Docker service)
DATABASE_URL=postgresql+psycopg2://postgres:postgres@postgres:5432/slidefactory

# Redis (internal Docker service)
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0

# MinIO (internal Docker service)
STORAGE_PROVIDER=minio
MINIO_CLIENT_URL=minio:9000
MINIO_ACCESS_KEY=admin
MINIO_SECRET_KEY=your-secure-random-password-here

# MinIO Public URLs (replace with your actual domains)
MINIO_OWN_SERVER_URL=minio-api.eddy.com
MINIO_OWN_CONSOLE_URL=minio-console.eddy.com

# Branding
APPLICATION_NAME="Eddy Slidefactory"
CLIENT_TITLE="Eddy"
CLIENT_PRIMARY_COLOR="#0066cc"


**Optional:**
 bash
# N8N Integration
N8N_API_URL=http://n8n:5678/api/v1
N8N_API_KEY=your-n8n-api-key

# Jina AI (for document processing)
JINA_API_KEY=your-jina-key

# Other AI Providers
AZURE_OPENAI_API_KEY=your-azure-key
ANTHROPIC_API_KEY=your-anthropic-key
MISTRAL_API_KEY=your-mistral-key


### 3. Configure Domains

In Coolify, set up domains for each service:

**Web Service (`web`):**
- Domain: `slidefactory.eddy.com`
- Port: 8000
- SSL: Enable (Let's Encrypt)
- Protocol: HTTPS

**MinIO API (`minio` service, port 9000):**
- Domain: `minio-api.eddy.com`
- SSL: Enable (Let's Encrypt)
- Note: Coolify reads Traefik labels from docker-compose.yml

**MinIO Console (`minio` service, port 9001):**
- Domain: `minio-console.eddy.com`
- SSL: Enable (Let's Encrypt)
- Note: Coolify reads Traefik labels from docker-compose.yml

### 4. Configure Health Checks

Coolify will use the healthchecks defined in docker-compose.yml:

- **Web**: HTTP GET `http://localhost:8000/health` (every 30s)
- **Worker**: Celery inspect ping (every 30s)
- **PostgreSQL**: `pg_isready` (every 10s)
- **Redis**: `redis-cli ping` (every 10s)
- **MinIO**: `mc ready local` (every 5s)

### 5. Deploy

Click **"Deploy"** in Coolify. The deployment will:

1. Pull code from GitHub
2. Build Docker image (takes 5-10 minutes first time)
3. Start all services:
   - PostgreSQL (database)
   - Redis (cache/queue)
   - MinIO (file storage)
   - Web (FastAPI application)
   - Worker (Celery background tasks)
   - createbuckets (one-time MinIO setup)
4. Run database migrations (via start-web-docker.sh)
5. Create MinIO buckets
6. Start accepting requests

### 6. Post-Deployment Setup

**Create Admin User:**

Via Coolify terminal (Connect to `web` service):
 bash
slidefactory init admin


Follow prompts to create admin account.

**Verify Services:**

1. Access https://slidefactory.eddy.com
2. Login with admin credentials
3. Check MinIO console: https://minio-console.eddy.com
4. Test presentation generation

**Configure N8N (Optional):**

If using N8N workflows:
1. Access N8N UI
2. Create API key in N8N settings
3. Add `N8N_API_KEY` to Coolify environment variables
4. Redeploy to pick up new environment variable

## Monitoring

### Health Checks

- **Web**: https://slidefactory.eddy.com/health
- **Worker**: Celery inspect ping (internal)

### Logs

View logs in Coolify dashboard:
- Click on service name
- Go to "Logs" tab
- Real-time log streaming available

### Metrics

Monitor in Coolify:
- CPU usage
- Memory usage
- Network traffic
- Container restarts

### Volumes

Persistent data stored in Docker volumes:
- `postgres_data` - Database
- `redis_data` - Cache
- `minio_data` - File storage

**Check volume sizes:**
 bash
docker system df -v


## Backup

### Database Backup

 bash
# Via Coolify terminal (postgres service)
pg_dump -U postgres slidefactory > /tmp/backup_$(date +%Y%m%d).sql

# Or from Docker host
docker compose exec postgres pg_dump -U postgres slidefactory > backup.sql


### MinIO Backup

 bash
# Install MinIO client (mc)
mc alias set eddy-minio https://minio-api.eddy.com admin <your-password>

# Backup buckets
mc mirror eddy-minio/presentations ./backups/presentations
mc mirror eddy-minio/workflows ./backups/workflows


### Automated Backups

Set up cron job on Coolify host:
 bash
0 2 * * * /path/to/backup-script.sh


## Updating

### Update Core Package Version

1. Edit `requirements.txt`:
    txt
   slidefactory-core @ git+https://github.com/cgast/slidefactory-core.git@v1.1.0


2. Commit and push to GitHub:
    bash
   git add requirements.txt
   git commit -m "chore: Update slidefactory-core to v1.1.0"
   git push origin main


3. Redeploy in Coolify (automatic or manual trigger)

### Update Environment Variables

1. Update in Coolify dashboard
2. Click "Redeploy" to apply changes

### Update Docker Compose

1. Edit `docker-compose.yml` in repository
2. Commit and push changes
3. Redeploy in Coolify

## Troubleshooting

### Services Not Starting

**Check logs:**
 bash
# In Coolify UI, view logs for each service
# Or via terminal
docker compose logs web
docker compose logs worker
docker compose logs postgres


**Common issues:**
- Database migrations failing → Check DATABASE_URL
- MinIO not accessible → Check MINIO_OWN_SERVER_URL
- Worker not starting → Check Redis connection

### Database Connection Errors

Verify environment variable:
 bash
DATABASE_URL=postgresql+psycopg2://postgres:postgres@postgres:5432/slidefactory


Note: Use `postgres` (service name) not `localhost`

### MinIO Authentication Errors

Ensure URLs match actual domains:
 bash
MINIO_OWN_SERVER_URL=minio-api.eddy.com  # No http:// or https://
MINIO_OWN_CONSOLE_URL=minio-console.eddy.com


Check Traefik labels in docker-compose.yml match these domains.

### Worker Not Processing Tasks

1. Check Redis connection:
    bash
   docker compose exec redis redis-cli ping


2. Check worker logs:
    bash
   docker compose logs worker


3. Verify Celery broker URL:
    bash
   CELERY_BROKER_URL=redis://redis:6379/0


### SSL Certificate Issues

Coolify uses Let's Encrypt automatically. If issues:

1. Verify domains point to Coolify server IP
2. Check Coolify can reach port 80/443
3. Wait for certificate generation (can take a few minutes)
4. Check Coolify logs

## Security

### Passwords

Change default passwords in production:
 bash
# MinIO
MINIO_SECRET_KEY=<generate-secure-password>

# PostgreSQL (if exposing externally)
POSTGRES_PASSWORD=<generate-secure-password>


Generate secure passwords:
 bash
openssl rand -base64 32


### API Keys

Keep API keys secure:
- Store in Coolify environment variables (encrypted)
- Never commit to Git
- Rotate regularly
- Use read-only keys where possible

### SSL/TLS

All services should use HTTPS in production:
- Let's Encrypt certificates auto-renew
- Force HTTPS redirects enabled via Traefik
- HSTS headers enabled

### Firewall

Coolify should handle firewall rules, but verify:
- Only ports 80 and 443 exposed publicly
- Internal services (postgres, redis, minio) not exposed
- SSH access restricted

## Performance Optimization

### Worker Scaling

Scale Celery workers in docker-compose.yml:
 yaml
worker:
  deploy:
    replicas: 4  # Scale to 4 workers


Or adjust concurrency:
 yaml
command: celery -A slidefactory.app.celery_app worker --concurrency=4


### Database Tuning

For high load, adjust PostgreSQL settings in docker-compose.yml:
 yaml
postgres:
  command: postgres -c max_connections=200 -c shared_buffers=256MB


### Resource Limits

Set in docker-compose.yml:
 yaml
worker:
  deploy:
    resources:
      limits:
        memory: 4G
        cpus: '2'


## Support

- **Coolify Documentation**: https://coolify.io/docs
- **Slidefactory Core**: https://github.com/cgast/slidefactory-core
- **Eddy Issues**: https://github.com/cgast/eddy-slidefactory/issues

## Checklist

Post-deployment verification:

- [ ] Web UI accessible via HTTPS
- [ ] Admin user created successfully
- [ ] MinIO console accessible
- [ ] Can upload workflow templates
- [ ] Can generate test presentation
- [ ] Worker processing tasks
- [ ] Database migrations applied
- [ ] Logs show no errors
- [ ] Health checks passing
- [ ] SSL certificates valid
- [ ] Backups configured
EOF

echo "Created docs/COOLIFY_SETUP.md"

Step 5.3: Create docs/DEPLOYMENT.md

cd /home/cgast/Github/slidefactory/eddy-slidefactory

cat > docs/DEPLOYMENT.md << 'EOF'
# Deployment Guide

General deployment information for Eddy Slidefactory.

## Deployment Options

### 1. Coolify (Recommended)

Docker-based PaaS platform for easy deployment.

See [COOLIFY_SETUP.md](COOLIFY_SETUP.md) for complete guide.

**Pros:**
- Easy setup and management
- Built-in SSL/TLS (Let's Encrypt)
- Traefik reverse proxy included
- Web UI for logs and monitoring
- One-click deployments

**Requirements:**
- Coolify instance (self-hosted)
- Domain names configured
- GitHub repository

### 2. Docker Compose (Manual)

Deploy on any server with Docker.

**Setup:**
 bash
# 1. Clone repository
git clone https://github.com/cgast/eddy-slidefactory.git
cd eddy-slidefactory

# 2. Create .env file
cp .env.example .env
# Edit .env with production values

# 3. Start services
docker compose up -d

# 4. Initialize
docker compose exec web slidefactory init admin


**Requires manual setup:**
- Reverse proxy (nginx/Traefik)
- SSL certificates
- Domain configuration
- Monitoring
- Backups

### 3. Kubernetes

For high-availability deployments.

**Not included in this repository** - requires:
- Kubernetes manifests
- Helm charts
- Load balancer
- Ingress controller

Contact for enterprise Kubernetes deployment support.

## Infrastructure Requirements

### Minimum (Development/Testing)

- **CPU**: 2 cores
- **RAM**: 4 GB
- **Storage**: 20 GB
- **Network**: 10 Mbps

### Recommended (Production)

- **CPU**: 4+ cores
- **RAM**: 8+ GB
- **Storage**: 100+ GB (SSD preferred)
- **Network**: 100+ Mbps
- **Backups**: Automated daily backups

### Services Resource Usage

| Service | CPU | Memory | Storage |
|---------|-----|--------|---------|
| Web | 0.5-1 core | 512 MB - 1 GB | Minimal |
| Worker | 0.5-2 cores | 1-2 GB | Minimal |
| PostgreSQL | 0.5-1 core | 512 MB - 2 GB | 10-50 GB |
| Redis | 0.1 core | 256 MB | 1 GB |
| MinIO | 0.5 core | 512 MB | 50-500 GB |

## Environment Variables

### Required

 bash
AI_PROVIDER=openai
AI_MODEL=gpt-4
OPENAI_API_KEY=sk-xxx
DATABASE_URL=postgresql+psycopg2://...
CELERY_BROKER_URL=redis://...
STORAGE_PROVIDER=minio


### Optional

 bash
N8N_API_URL=http://...
JINA_API_KEY=jina_xxx
AZURE_OPENAI_API_KEY=xxx


See `.env.example` for complete list.

## Security Checklist

- [ ] Change all default passwords
- [ ] Use strong passwords (min 32 chars)
- [ ] Enable SSL/TLS for all services
- [ ] Keep API keys in secure environment variables
- [ ] Enable firewall (only ports 80/443 exposed)
- [ ] Regular security updates
- [ ] Automated backups configured
- [ ] Monitor logs for suspicious activity
- [ ] Use secrets management (HashiCorp Vault, etc.)
- [ ] Enable audit logging

## Backup Strategy

### What to Backup

1. **Database** (PostgreSQL)
   - Full daily backups
   - Transaction logs (continuous)

2. **File Storage** (MinIO)
   - Presentations
   - Templates
   - Workflows
   - Context files

3. **Configuration**
   - Environment variables
   - docker-compose.yml
   - Custom workflows

### Backup Commands

 bash
# Database backup
docker compose exec postgres pg_dump -U postgres slidefactory > backup.sql

# MinIO backup (using mc client)
mc mirror production-minio/presentations ./backups/presentations

# Configuration backup
tar czf config-backup.tar.gz .env docker-compose.yml workflows/


### Backup Schedule

- **Daily**: Full database backup
- **Hourly**: Transaction log backup
- **Daily**: MinIO file backup
- **Retention**: 30 days minimum

## Monitoring

### Health Checks

 bash
# Web service
curl https://slidefactory.eddy.com/health

# Expected: {"status": "healthy"}


### Logs

 bash
# View logs
docker compose logs -f web
docker compose logs -f worker

# Search logs
docker compose logs web | grep ERROR


### Metrics to Monitor

- CPU usage
- Memory usage
- Disk space
- Network traffic
- Database connections
- Queue length (Celery)
- Response times
- Error rates

### Alerting

Set up alerts for:
- Service down
- High error rate (>1%)
- Disk space low (<10%)
- Database connection failures
- Worker queue backlog

## Scaling

### Horizontal Scaling

Scale workers:
 yaml
worker:
  deploy:
    replicas: 4


### Vertical Scaling

Increase resources in docker-compose.yml:
 yaml
deploy:
  resources:
    limits:
      cpus: '4'
      memory: 8G


### Database Scaling

For high load:
- Use read replicas
- Enable connection pooling
- Optimize queries
- Add indexes

## Troubleshooting

See [COOLIFY_SETUP.md](COOLIFY_SETUP.md#troubleshooting) for detailed troubleshooting guide.

## Support

- **Documentation**: [Coolify Setup](COOLIFY_SETUP.md)
- **Core Package**: [slidefactory-core](https://github.com/cgast/slidefactory-core)
- **Issues**: [GitHub Issues](https://github.com/cgast/eddy-slidefactory/issues)
EOF

echo "Created docs/DEPLOYMENT.md"

Phase 6: CI/CD

Step 6.1: Create GitHub Actions Workflow

cd /home/cgast/Github/slidefactory/eddy-slidefactory

cat > .github/workflows/docker-build.yml << 'EOF'
name: Build Docker Image

on:
  push:
    branches:
      - main
    tags:
      - 'v*'
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Build Docker image
        uses: docker/build-push-action@v5
        with:
          context: .
          push: false
          tags: eddy/slidefactory:${{ github.sha }}
          cache-from: type=gha
          cache-to: type=gha,mode=max

      - name: Test image
        run: |
          docker run --rm eddy/slidefactory:${{ github.sha }} \
            python -c "import slidefactory; print(f'Core version: {slidefactory.__version__}')"
EOF

echo "Created .github/workflows/docker-build.yml"

Phase 7: Initial Git Commit

Step 7.1: Review Files

cd /home/cgast/Github/slidefactory/eddy-slidefactory

# List all created files
echo "Created files:"
find . -type f ! -path './.git/*' | sort

echo ""
echo "Directory structure:"
tree -L 3 -I '.git' || find . -type d ! -path './.git/*' | sort

Step 7.2: Create Initial Commit

cd /home/cgast/Github/slidefactory/eddy-slidefactory

# Add all files
git add .

# Create initial commit
git commit -m "chore: Initial eddy-slidefactory setup

- Added Dockerfile extending slidefactory-core
- Added docker-compose.yml with all services
- Added start scripts for web and worker
- Added .env.example with Eddy branding
- Added documentation (README, Coolify setup guide)
- Added GitHub Actions for Docker build
- Created branding directory structure
- Created workflow directory structure

Ready for:
- Adding Eddy logo assets
- Creating GitHub repository
- Deploying to Coolify
"

echo "Initial commit created"
echo ""
echo "Next steps:"
echo "1. Create GitHub repository: https://github.com/new"
echo "2. Add remote: git remote add origin https://github.com/cgast/eddy-slidefactory.git"
echo "3. Push: git push -u origin main"

Phase 8: Verification

Step 8.1: Test Local Setup

cd /home/cgast/Github/slidefactory/eddy-slidefactory

echo "Testing local Docker setup..."

# Create .env.local for testing
cp .env.example .env.local

# Update with minimal config for testing
cat >> .env.local << 'EOF'

# Minimal config for local testing
AI_PROVIDER=openai
AI_MODEL=gpt-3.5-turbo
OPENAI_API_KEY=sk-test-key-replace-with-real-key
EOF

echo ""
echo "Created .env.local - UPDATE with real API keys before running"
echo ""
echo "To test locally:"
echo "  1. Edit .env.local with your API keys"
echo "  2. Run: docker compose up"
echo "  3. Access: http://localhost:8000"
echo "  4. Initialize: docker compose exec web slidefactory init admin"

Step 8.2: Verify File Integrity

cd /home/cgast/Github/slidefactory/eddy-slidefactory

echo "Verifying file integrity..."

# Check all required files exist
files=(
  "Dockerfile"
  "docker-compose.yml"
  "docker-compose.override.yml"
  "requirements.txt"
  "init.sql"
  "start-web-docker.sh"
  "start-worker.sh"
  ".env.example"
  ".gitignore"
  "README.md"
  "docs/COOLIFY_SETUP.md"
  "docs/DEPLOYMENT.md"
  ".github/workflows/docker-build.yml"
  "workflows/.gitkeep"
  "eddy_branding/static/img/README.md"
)

missing=0
for file in "${files[@]}"; do
  if [ ! -f "$file" ]; then
    echo "❌ Missing: $file"
    missing=$((missing + 1))
  else
    echo "✓ Found: $file"
  fi
done

echo ""
if [ $missing -eq 0 ]; then
  echo "✅ All required files created successfully!"
else
  echo "⚠️  $missing file(s) missing"
fi

# Check executable permissions
echo ""
echo "Checking executable permissions..."
if [ -x "start-web-docker.sh" ] && [ -x "start-worker.sh" ]; then
  echo "✓ Start scripts are executable"
else
  echo "❌ Start scripts need executable permissions"
  echo "   Run: chmod +x start-web-docker.sh start-worker.sh"
fi

Complete Setup Summary

What Was Created

eddy-slidefactory/
├── Dockerfile ✓
├── docker-compose.yml ✓
├── docker-compose.override.yml ✓
├── requirements.txt ✓
├── init.sql ✓
├── start-web-docker.sh ✓
├── start-worker.sh ✓
├── .env.example ✓
├── .gitignore ✓
├── README.md ✓
├── eddy_branding/
│   ├── static/img/README.md ✓
│   └── templates/branding/README.md ✓
├── workflows/.gitkeep ✓
├── docs/
│   ├── COOLIFY_SETUP.md ✓
│   └── DEPLOYMENT.md ✓
└── .github/workflows/
    └── docker-build.yml ✓

Next Steps Checklist

# 1. Add branding assets
cd /home/cgast/Github/slidefactory/eddy-slidefactory
# Add: eddy_branding/static/img/eddy_logo.png
# Add: eddy_branding/static/img/eddy_logo_large.png
# Add: eddy_branding/static/img/favicon.ico

# 2. Update .env.local with real API keys
vim .env.local

# 3. Test locally
docker compose up

# 4. Create GitHub repository
# Go to: https://github.com/new
# Name: eddy-slidefactory
# Private or Public

# 5. Push to GitHub
git remote add origin https://github.com/cgast/eddy-slidefactory.git
git push -u origin main

# 6. Set up Coolify deployment
# Follow: docs/COOLIFY_SETUP.md

Quick Start Commands

# Local development
cd /home/cgast/Github/slidefactory/eddy-slidefactory
docker compose up -d
docker compose exec web slidefactory init admin

# View logs
docker compose logs -f web
docker compose logs -f worker

# Stop services
docker compose down

# Rebuild after changes
docker compose build
docker compose up -d

Troubleshooting

Permission Denied on Scripts

chmod +x start-web-docker.sh start-worker.sh

Docker Compose Not Found

# Use newer syntax
docker compose up

# Or older syntax
docker-compose up

Files Not Created

# Re-run specific phase
cd /home/cgast/Github/slidefactory/eddy-slidefactory
# Copy-paste commands from relevant phase above

Need to Reset

cd /home/cgast/Github/slidefactory
rm -rf eddy-slidefactory
mkdir eddy-slidefactory
# Start from Phase 1

Setup complete! All files created. Ready to: 1. Add branding assets 2. Configure .env.local 3. Test locally 4. Push to GitHub 5. Deploy to Coolify