Skip to main content

ddev setup

DDEV Environment Setup for Drupal AI Platform

One-command setup: ddev start && ddev setup-ai

Quick Setup

# Clone and setup git clone https://gitlab.com/blueflyio/llm-platform.git cd llm-platform # Start DDEV ddev start # Install Drupal + AI modules ddev composer install ddev drush site:install --account-pass=admin -y # Setup AI environment ddev setup-ai # Launch ddev launch

DDEV Configuration

File: .ddev/config.yaml

name: llm-platform type: drupal docroot: web php_version: "8.3" webserver_type: nginx-fpm database: type: postgres version: "16" nodejs_version: "22" hooks: post-start: - exec: drush en ai,ai_agents,eca,key -y - exec: drush cr additional_hostnames: - ai-admin - agent-platform upload_dirs: - files - private

Custom Commands

File: .ddev/commands/web/setup-ai

#!/bin/bash ## Description: Setup AI environment ## Usage: setup-ai ## Example: ddev setup-ai echo " Setting up Drupal AI Platform..." # Install AI modules composer require \ drupal/ai:^1.2.5 \ drupal/ai_agents:^1.2.1 \ drupal/eca:^2.0 \ drupal/flowdrop:1.x-dev \ drupal/key:^1.17 # Enable modules drush en ai,ai_agents,eca,flowdrop,key -y # Import GitLab AI Gateway provider config drush config:import --partial --source=../config/ai/ # Clear cache drush cr echo " AI Platform ready! Login: admin / admin"

Docker Compose Additions

File: .ddev/docker-compose.ai.yaml

version: '3.6' services: # Vector Database (ChromaDB) chromadb: image: chromadb/chroma:latest ports: - "8000" volumes: - chromadb-data:/chroma/chroma environment: IS_PERSISTENT: "TRUE" labels: com.ddev.site-name: ${DDEV_SITENAME} com.ddev.approot: $DDEV_APPROOT # Redis for caching redis: image: redis:7-alpine ports: - "6379" labels: com.ddev.site-name: ${DDEV_SITENAME} volumes: chromadb-data:

Environment Variables

File: .ddev/config.local.yaml

web_environment: - GITLAB_AI_GATEWAY_TOKEN=${GITLAB_TOKEN} - ANTHROPIC_API_KEY=${ANTHROPIC_KEY} - OPENAI_API_KEY=${OPENAI_KEY} - CHROMADB_HOST=chromadb - CHROMADB_PORT=8000 - REDIS_HOST=redis - REDIS_PORT=6379

Sample Data

File: .ddev/commands/web/load-sample-data

#!/bin/bash ## Description: Load AI platform sample data ## Usage: load-sample-data # Create sample agent drush php-eval " \$agent = \Drupal\ai_agents\Entity\Agent::create([ 'id' => 'content_summarizer', 'label' => 'Content Summarizer', 'description' => 'Summarizes article content', 'provider' => 'gitlab_ai_gateway', 'model' => 'claude-sonnet-4', 'system_prompt' => 'You are a content summarizer.', ]); \$agent->save(); " # Create sample ECA workflow drush config:import --partial --source=../config/eca/sample-workflows/ echo " Sample data loaded"

Testing Setup

# Run tests ddev exec vendor/bin/phpunit # With coverage ddev exec vendor/bin/phpunit --coverage-html coverage/ # PHPStan ddev exec vendor/bin/phpstan analyse

Troubleshooting

# Reset everything ddev poweroff ddev delete -y ddev start ddev setup-ai # Check logs ddev logs -f # Access database ddev psql

References