johnhkchen f7d3296d43 Use HTTP endpoint for MinIO S3 connection
Directus → Coolify/Traefik → MinIO (HTTP internally)
Public access still via HTTPS through Cloudflare

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-22 14:09:35 -07:00
2025-10-22 10:22:22 -07:00
2025-10-22 10:22:22 -07:00
2025-10-22 10:22:22 -07:00

Portfolio Infrastructure - Directus CMS

Shared infrastructure providing CMS and API services for all portfolio demos.

Purpose

This repository contains the infrastructure layer for the portfolio platform:

  • Directus CMS: Content management and API
  • PostgreSQL: Database backend

This is deployed once and provides services to multiple demo applications.

Architecture

┌─────────────────────────────────────┐
│   Portfolio Infrastructure          │
│   Domain: directus.b28.dev          │
├─────────────────────────────────────┤
│  ┌──────────────┐  ┌─────────────┐ │
│  │   Directus   │──│  PostgreSQL │ │
│  │   CMS/API    │  │   Database  │ │
│  └──────────────┘  └─────────────┘ │
└─────────────────────────────────────┘
           │
           │ (consumed by demos)
           ▼
    Demo Applications
    ├─ portfolio-site
    ├─ hackathon-project-1
    └─ hackathon-project-2

Directus Collections

Core Collections

  • profile: Personal information (name, bio, etc.)
  • skills: Technical skills and proficiencies
  • social_links: Social media and contact links
  • posts: Blog posts
  • work_projects: Portfolio work items

Demo Registry

  • demos: Catalog of all live demos
    • name, description, tech_stack
    • repo_url, live_url
    • thumbnail, category
    • built_at, is_featured

Quick Start

Local Development

  1. Copy environment file:

    cp .env.example .env
    
  2. Edit .env with your values:

    # Generate secure keys
    openssl rand -base64 32  # for DIRECTUS_KEY
    openssl rand -base64 32  # for DIRECTUS_SECRET
    
  3. Start services:

    docker compose up -d
    
  4. Access Directus:

Coolify Deployment

  1. Create new resource in Coolify

    • Type: Docker Compose
    • Source: Git repository (this repo)
  2. Set environment variables in Coolify:

    • DB_PASSWORD: Secure database password
    • ADMIN_EMAIL: Your admin email
    • ADMIN_PASSWORD: Secure admin password
    • DIRECTUS_KEY: Generated key
    • DIRECTUS_SECRET: Generated secret
    • PUBLIC_URL: https://directus.b28.dev
  3. Configure domain:

    • Domain: directus.b28.dev
    • Coolify handles SSL/TLS automatically
  4. Deploy

Database Setup

The database is initialized from database/init.sql on first run. This includes:

  • Schema definition (tables, relationships)
  • Initial collections setup
  • Sample data (optional)

Backup Database

docker compose exec postgres pg_dump -U directus directus > backup_$(date +%Y%m%d).sql

Restore Database

docker compose exec -T postgres psql -U directus directus < backup.sql

Adding New Collections

  1. Access Directus admin UI
  2. Navigate to Settings → Data Model
  3. Create new collection
  4. Define fields and relationships
  5. Set permissions

Collections are stored in PostgreSQL and persist across restarts.

Connecting Demos

Demo applications connect to this infrastructure via environment variable:

# In demo's docker-compose.yml
environment:
  DIRECTUS_URL: https://directus.b28.dev

API Access

Directus provides a REST API at:

https://directus.b28.dev/items/{collection}

Example endpoints:

  • GET /items/posts - List all posts
  • GET /items/demos?filter[is_featured][_eq]=true - Featured demos
  • GET /items/profile - Profile data

See Directus API docs for full reference.

Maintenance

Update Directus

docker compose pull directus
docker compose up -d directus

View Logs

docker compose logs -f directus
docker compose logs -f postgres

Restart Services

docker compose restart

Security Notes

  • Never commit .env files - they contain secrets
  • Database backups may contain PII - handle carefully
  • Use strong passwords for admin and database
  • Rotate keys periodically (DIRECTUS_KEY, DIRECTUS_SECRET)

Troubleshooting

Directus won't start

# Check PostgreSQL is healthy
docker compose ps postgres

# Check logs
docker compose logs directus

# Verify environment variables
docker compose exec directus env | grep DB_

Can't access Directus UI

  1. Check service is running: docker compose ps
  2. Verify health check: docker compose exec directus wget -O- http://localhost:8055/server/health
  3. Check Coolify domain configuration

Database connection issues

# Test PostgreSQL connection
docker compose exec postgres psql -U directus -d directus -c "SELECT 1;"

# Check database exists
docker compose exec postgres psql -U directus -l

License

This infrastructure is for personal portfolio use.

Description
Shared Directus CMS for portfolio
Readme 173 KiB
Languages
SQL 100%