Skip to main content

production validation

Production Deployment Validation Checklist

Purpose: Prevent bad deployments with automated checks

Automated Validation Script

#!/bin/bash # validate-production.sh echo " Running production validation checks..." # 1. Drupal Coding Standards echo " Checking coding standards..." vendor/bin/phpcs --standard=Drupal,DrupalPractice \ --extensions=php,module,inc modules/custom/ || exit 1 # 2. PHPStan Level 8 echo " Running static analysis..." vendor/bin/phpstan analyse modules/custom/ --level=8 || exit 1 # 3. Unit Tests echo " Running unit tests..." vendor/bin/phpunit --coverage-text || exit 1 # 4. Coverage Check (80% minimum) coverage=$(grep -oP 'Lines:\s+\K[\d.]+' coverage.xml | head -1) if [ $(echo "$coverage < 80" | bc) -eq 1 ]; then echo " Coverage $coverage% < 80%" exit 1 fi # 5. Security Check echo " Checking for security vulnerabilities..." composer audit || exit 1 # 6. OSSA Validation echo " Validating OSSA manifests..." for file in ossa-agents/*.yaml; do drush ossa-validate $file || exit 1 done # 7. Configuration Check echo " Validating configuration..." drush config:status --state=Different && exit 1 || echo " Config in sync" # 8. Database Updates echo " Checking for pending database updates..." drush updatedb:status || exit 1 # 9. Check Module Dependencies echo " Verifying module dependencies..." drush pm:list --status=enabled --filter=ai # 10. Performance Check echo " Running performance benchmarks..." ab -n 100 -c 10 https://llm-platform.local/ || exit 1 echo " All validation checks passed!"

GitLab CI Pre-Deploy Stage

validate-production: stage: pre-deploy script: - bash validate-production.sh only: - main when: on_success

Deployment Checklist

Pre-Deployment

  • All tests passing (unit, functional, integration)
  • Code coverage 80%
  • PHPCS/PHPStan passing (Drupal standards, level 8)
  • Security scans clean (composer audit, SAST, dependency scanning)
  • OSSA manifests valid
  • Configuration exported and in sync
  • Database backup created
  • Rollback plan documented

Post-Deployment

  • Site accessible (smoke test)
  • Cron running
  • Queues processing
  • AI agents responding
  • GitLab AI Gateway connected
  • Monitoring alerts configured
  • Performance metrics baseline

Rollback Procedure

# If deployment fails git revert HEAD git push origin main drush config:import --partial drush cr drush updatedb

References

  • CI/CD Template: ci-cd/gitlab-ci-drupal-template.md
  • Testing Strategy: testing/unit-test-strategy.md