Files
portfolio/scripts
denshooter 07741761cc Updating (#65)
* Fix ActivityFeed: Remove dynamic import that was causing it to disappear in production

* Fix ActivityFeed hydration error: Move localStorage read to useEffect to prevent server/client mismatch

* Update Node.js version to 25 in Gitea workflows

- Fix EBADENGINE error for camera-controls@3.1.2 which requires Node.js >=22
- Update production-deploy.yml, dev-deploy.yml, and ci-cd-with-gitea-vars.yml.disabled
- Node.js v25 matches local development environment

* Update Dockerfile to use Node.js 25

- Update base image from node:20 to node:25
- Matches Gitea workflow configuration and camera-controls@3.1.2 requirements

* Fix production deployment: Start database dependencies

- Remove --no-deps flag which prevented postgres and redis from starting
- Remove --build flag as image is already built in previous step
- This fixes 'Can't reach database server at postgres:5432' error

* Fix postgres health check in production

- Remove init-db.sql volume mount (not available in CI/CD environment)
- Init script not needed as Prisma handles schema migrations
- Postgres will initialize empty database automatically

* Fix cache permission error in Docker container

- Create cache directories AFTER copying standalone files
- Create both fetch-cache and images subdirectories
- Set proper ownership for nextjs user
- Fixes EACCES permission denied errors for prerender cache

* Fix German jogging fallback text

* Use Directus content in production

* fix: Security vulnerability - block malicious file requests

* fix: Switch projects to Directus, add security fixes and example projects
2026-02-15 22:04:26 +01:00
..
2026-02-15 22:04:26 +01:00
2026-01-22 20:56:35 +01:00
2025-09-08 08:36:16 +02:00
2025-09-06 08:57:31 +00:00
2025-09-08 08:36:16 +02:00
2025-09-06 08:57:31 +00:00
2025-09-05 21:35:54 +00:00
2026-01-08 16:27:40 +01:00
2026-01-08 11:31:57 +01:00

Directus Setup & Migration Scripts

Automatische Scripts zum Erstellen und Befüllen aller Collections in Directus.

📦 Verfügbare Scripts

1. Tech Stack ( Bereits ausgeführt)

# Collections erstellen
node scripts/setup-directus-collections.js

# Daten migrieren
node scripts/migrate-tech-stack-to-directus.js

Was erstellt wird:

  • tech_stack_categories (4 Kategorien: Frontend, Backend, Tools, Security)
  • tech_stack_items (~16 Items)
  • Translations (DE + EN)

2. Projects (🔥 Neu)

# Collections erstellen
node scripts/setup-directus-projects.js

# Daten aus PostgreSQL migrieren
node scripts/migrate-projects-to-directus.js

Was erstellt wird:

  • projects Collection mit 30+ Feldern:
    • Basics: slug, title, description, content
    • Meta: category, difficulty, tags, technologies
    • Links: github, live, image_url, demo_video
    • Details: challenges, lessons_learned, future_improvements
    • Performance: lighthouse scores, bundle sizes
  • projects_translations für mehrsprachige Inhalte
  • Migriert ALLE Projekte aus PostgreSQL

Hinweis: Läuft nur wenn Projects Collection noch nicht existiert!


3. Hobbies (🎮 Neu)

# Collections erstellen
node scripts/setup-directus-hobbies.js

# Daten migrieren
node scripts/migrate-hobbies-to-directus.js

Was erstellt wird:

  • hobbies Collection (4 Hobbies: Self-Hosting, Gaming, Game Servers, Jogging)
  • Translations (DE + EN)

🚀 Komplette Migration (alles auf einmal)

# 1. Tech Stack
node scripts/setup-directus-collections.js
node scripts/migrate-tech-stack-to-directus.js

# 2. Projects
node scripts/setup-directus-projects.js
node scripts/migrate-projects-to-directus.js

# 3. Hobbies
node scripts/setup-directus-hobbies.js
node scripts/migrate-hobbies-to-directus.js

Oder als One-Liner:

node scripts/setup-directus-collections.js && \
node scripts/migrate-tech-stack-to-directus.js && \
node scripts/setup-directus-projects.js && \
node scripts/migrate-projects-to-directus.js && \
node scripts/setup-directus-hobbies.js && \
node scripts/migrate-hobbies-to-directus.js

⚙️ Voraussetzungen

# Dependencies installieren
npm install node-fetch@2 dotenv @prisma/client

In .env:

DIRECTUS_URL=https://cms.dk0.dev
DIRECTUS_STATIC_TOKEN=your_token_here
DATABASE_URL=postgresql://...

📊 Nach der Migration

Directus Admin Panel:

API Endpoints (automatisch verfügbar):

# Tech Stack
GET https://cms.dk0.dev/items/tech_stack_categories?fields=*,translations.*,items.*

# Projects
GET https://cms.dk0.dev/items/projects?fields=*,translations.*

# Hobbies
GET https://cms.dk0.dev/items/hobbies?fields=*,translations.*

🔄 Code-Updates nach Migration

1. lib/directus.ts erweitern

// Bereits implementiert:
export async function getTechStack(locale: string)

// TODO:
export async function getProjects(locale: string)
export async function getHobbies(locale: string)

2. Components anpassen

  • About.tsx - Bereits updated für Tech Stack
  • About.tsx - TODO: Hobbies aus Directus laden
  • Projects.tsx - TODO: Projects aus Directus laden

🐛 Troubleshooting

Error: "Collection already exists"

→ Normal! Script überspringt bereits existierende Collections automatisch.

Error: "DIRECTUS_STATIC_TOKEN not found"

→ Stelle sicher dass .env vorhanden ist und require('dotenv').config() funktioniert.

Error: "Unauthorized" oder HTTP 403

→ Überprüfe Token-Rechte in Directus Admin → Settings → Access Tokens

Migration findet keine Projekte

→ Stelle sicher dass PostgreSQL läuft und DATABASE_URL korrekt ist.


📝 Nächste Schritte

  1. Alle Scripts ausführen (siehe oben)
  2. Verifizieren in Directus Admin Panel
  3. ⏭️ Code updaten (lib/directus.ts + Components)
  4. ⏭️ Testen auf localhost
  5. ⏭️ Deployen auf Production

💡 Pro-Tipps

  • Backups: Exportiere Schema regelmäßig via Directus UI
  • Version Control: Committe Schema-Files ins Git
  • Incremental: Scripts können mehrfach ausgeführt werden (idempotent)
  • Rollback: Lösche Collections in Directus UI falls nötig