| name | drupal-flake-process |
| description | Daily driver for drupal-flake development. Auto-detects active environments, provides URLs, drush commands, XDebug, logs, and lifecycle management. Cross-references drupal-flake-test for testing setup. |
| compatibility | opencode |
| metadata | {"framework":"Drupal","primary_tool":"drupal-flake","secondary_tools":["ddev","docker","drush"],"services":["nginx","php-fpm","mysql","process-compose"],"features":["auto-detection","daily-workflow","debugging","logs"]} |
Auto-Detection (Run First)
⚠️ MUTUALLY EXCLUSIVE: Use drupal-flake OR DDev, never both. Both use *.ddev.site domains but with different port strategies.
if ls /tmp/process-compose-*.sock 2>/dev/null | grep -q ""; then
DRUPAL_ENV="drupal-flake"
BASE_URL="http://$(grep DOMAIN .env 2>/dev/null | cut -d= -f2):$(grep PORT .env 2>/dev/null | cut -d= -f2)"
echo "drupal-flake active: $BASE_URL"
elif which ddev >/dev/null 2>&1 && ddev describe 2>/dev/null | grep -q RUNNING; then
DRUPAL_ENV="ddev"
BASE_URL=$(ddev describe --json-output 2>/dev/null | jq -r '.raw.services.web.short_url' 2>/dev/null)
echo "ddev active: $BASE_URL"
elif docker ps 2>/dev/null | grep -qiE "(drupal|php|nginx)"; then
DRUPAL_ENV="docker"
echo "docker containers running"
else
DRUPAL_ENV="none"
echo "No environment detected. Run: setup-drupal to initialize, then start-detached"
fi
Domain & Port Strategy
| Environment | Domain | Port | Example URL |
|---|
| drupal-flake | *.ddev.site | Custom (e.g., 2675) | http://mysite.ddev.site:2675 |
| DDev | *.ddev.site | Standard (80/443) | https://mysite.ddev.site |
Never run both simultaneously - they would conflict on the domain. If switching, stop one before starting the other.
Daily Development Workflow
1. Get Site URL
drupal-flake:
export DOMAIN=$(grep DOMAIN .env | cut -d= -f2)
export PORT=$(grep PORT .env | cut -d= -f2)
echo "http://${DOMAIN}:${PORT}"
BASE_URL="http://$(grep DOMAIN .env | cut -d= -f2):$(grep PORT .env | cut -d= -f2)"
curl -s -o /dev/null -w "%{http_code}" "$BASE_URL"
Port calculation: Generated automatically from the site name using T9 phone keypad mapping + 2 (e.g. "cms" → 2675). Run setup-drupal to auto-configure, or set PORT manually in .env.
2. Drush Commands
drupal-flake:
drush status
drush uli
drush cache:rebuild
drush config:export -y
drush sql:dump > backup.sql
./bin/drush [command]
xdrush [command]
Available commands:
drush - Standard drush (fast, no XDebug)
xdrush - Drush with XDebug enabled
xphpunit - PHPUnit with XDebug
xcomposer - Composer with XDebug
3. XDebug Debugging
Trigger XDebug:
export XDEBUG_CONFIG="idekey=PHPSTORM"
Pre-configured commands:
drush - Standard drush (daily use, fast)
xdrush - Drush with XDebug (debugging only, slower)
xphpunit - PHPUnit with XDebug on port 9003
4. Logs & Monitoring
Watchdog logs (Drupal dblog):
drush watchdog:show --tail
drush watchdog:show --type=error
drush watchdog:delete all
System logs (process-compose):
pc-logs nginx
pc-logs php-fpm
pc-logs mysql
pc-logs --follow
Log files directly:
tail -f data/logs/nginx-error.log
tail -f data/logs/php-fpm-error.log
5. Database Operations
drush sql:dump > $(date +%Y%m%d)-backup.sql
drush sql:query --file=backup.sql
mysql -u root -S data/db/mysql.sock [database]
Environment Detection Details
drupal-flake (Nix)
ls -la /tmp/process-compose-*.sock 2>/dev/null
echo $DIRENV_DIR
DDev (Alternative to drupal-flake)
⚠️ Never auto-start without explicit request. DDev is an alternative container-based solution - don't use with drupal-flake simultaneously.
ddev describe 2>/dev/null | grep -E "(RUNNING|short_url)"
Docker
docker ps --format "table {{.Names}}\t{{.Status}}" | grep -iE "(drupal|php|nginx)"
Environment Comparison
drupal-flake vs DDev: Mutually Exclusive Alternatives
| Aspect | drupal-flake (Nix) | DDev (Docker) |
|---|
| Domain | *.ddev.site | *.ddev.site |
| Port | Custom (e.g., 2675) | Standard 80/443 |
| URL Example | http://mysite.ddev.site:2675 | https://mysite.ddev.site |
| When to use | Nix-based, lightweight | Full container orchestration |
| Conflict | ⚠️ Don't run simultaneously | ⚠️ Don't run simultaneously |
If switching environments:
pc-stop
ddev stop
Lifecycle Commands
nix run
start-detached
pc-stop
stop-all
pc-status
pc-attach
Troubleshooting Quick Fixes
| Issue | Fix |
|---|
| mysql.sock error | git init && git add .env .gitignore |
| .env not loading | direnv reload or cd . && cd - |
| Port conflict | lsof -i :PORT then change PORT in .env |
| Stale socket | rm -f /tmp/process-compose-*.sock |
| Site not responding | Check HTTP 200: curl -s -o /dev/null -w "%{http_code}" $BASE_URL |
Testing Setup
For PHPUnit, browser testing, CI/CD:
→ Load drupal-flake-test skill
Quick test check:
ls phpunit.xml 2>/dev/null || echo "Run: phpunit-setup"
Workflow Summary
Daily pattern:
- Auto-detect environment (socket check)
- Get URL from .env:
http://$(grep DOMAIN .env | cut -d= -f2):$(grep PORT .env | cut -d= -f2)
- Use
drush (fast) or ./bin/drush for management, drush uli for login
- Watch logs:
drush watchdog:show --tail or pc-logs --follow
- Debug: Use
xdrush (XDebug enabled) or add ?XDEBUG_TRIGGER=1 to URLs
- Test: Load
drupal-flake-test skill for PHPUnit/Puppeteer