# Docker Compose for HVAC Testing Framework # Provides hermetic WordPress testing environment with database isolation # # Usage: # docker-compose up -d # Start services # docker-compose down # Stop services # docker-compose down -v # Stop services and remove volumes (clean slate) version: '3.8' services: # WordPress with HVAC plugin wordpress: image: wordpress:latest container_name: hvac-test-wordpress ports: - "8080:80" environment: WORDPRESS_DB_HOST: mysql:3306 WORDPRESS_DB_NAME: hvac_test WORDPRESS_DB_USER: hvac_user WORDPRESS_DB_PASSWORD: hvac_password WORDPRESS_TABLE_PREFIX: wp_ WORDPRESS_DEBUG: 'true' WORDPRESS_CONFIG_EXTRA: | /* Test-specific configuration */ define('WP_ENVIRONMENT_TYPE', 'development'); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); define('SCRIPT_DEBUG', true); define('CONCATENATE_SCRIPTS', false); /* Disable file editing in admin */ define('DISALLOW_FILE_EDIT', true); /* Memory and time limits for testing */ ini_set('memory_limit', '512M'); ini_set('max_execution_time', 300); /* Test environment markers */ define('HVAC_TEST_ENVIRONMENT', true); define('HVAC_DOCKER_ENVIRONMENT', true); volumes: - wordpress_data:/var/www/html - ../../:/var/www/html/wp-content/plugins/hvac-community-events:ro - ./uploads:/var/www/html/wp-content/uploads - ./test-logs:/var/www/html/wp-content/debug.log depends_on: mysql: condition: service_healthy redis: condition: service_started networks: - hvac-test-network restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost"] interval: 30s timeout: 10s retries: 5 start_period: 40s # MySQL database with test isolation mysql: image: mysql:8.0 container_name: hvac-test-mysql ports: - "3306:3306" environment: MYSQL_ROOT_PASSWORD: hvac_root_password MYSQL_DATABASE: hvac_test MYSQL_USER: hvac_user MYSQL_PASSWORD: hvac_password MYSQL_ROOT_HOST: '%' volumes: - mysql_data:/var/lib/mysql - ./mysql-init:/docker-entrypoint-initdb.d:ro - ./mysql-conf:/etc/mysql/conf.d:ro command: > --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --innodb-buffer-pool-size=256M --innodb-log-file-size=64M --max-connections=200 --sql-mode=STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION networks: - hvac-test-network restart: unless-stopped healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "hvac_user", "-phvac_password"] interval: 10s timeout: 5s retries: 10 start_period: 30s # Redis for caching (optional but recommended for performance testing) redis: image: redis:7-alpine container_name: hvac-test-redis ports: - "6379:6379" command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru volumes: - redis_data:/data networks: - hvac-test-network restart: unless-stopped healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 # WP-CLI container for database operations wpcli: image: wordpress:cli container_name: hvac-test-wpcli volumes: - wordpress_data:/var/www/html - ../../:/var/www/html/wp-content/plugins/hvac-community-events environment: WORDPRESS_DB_HOST: mysql:3306 WORDPRESS_DB_NAME: hvac_test WORDPRESS_DB_USER: hvac_user WORDPRESS_DB_PASSWORD: hvac_password depends_on: mysql: condition: service_healthy networks: - hvac-test-network profiles: - cli command: tail -f /dev/null # MailHog for email testing mailhog: image: mailhog/mailhog:latest container_name: hvac-test-mailhog ports: - "1025:1025" # SMTP server - "8025:8025" # Web interface networks: - hvac-test-network restart: unless-stopped # PHPMyAdmin for database inspection (optional) phpmyadmin: image: phpmyadmin/phpmyadmin:latest container_name: hvac-test-phpmyadmin ports: - "8081:80" environment: PMA_HOST: mysql PMA_PORT: 3306 PMA_USER: hvac_user PMA_PASSWORD: hvac_password MYSQL_ROOT_PASSWORD: hvac_root_password depends_on: mysql: condition: service_healthy networks: - hvac-test-network profiles: - admin volumes: wordpress_data: driver: local mysql_data: driver: local redis_data: driver: local networks: hvac-test-network: driver: bridge name: hvac-test-network # Additional configuration files that can be mounted: # # ./mysql-init/01-test-databases.sql: # CREATE DATABASE IF NOT EXISTS hvac_test_backup; # CREATE DATABASE IF NOT EXISTS hvac_test_template; # GRANT ALL PRIVILEGES ON hvac_test_backup.* TO 'hvac_user'@'%'; # GRANT ALL PRIVILEGES ON hvac_test_template.* TO 'hvac_user'@'%'; # # ./mysql-conf/test-optimizations.cnf: # [mysqld] # innodb_flush_log_at_trx_commit = 2 # sync_binlog = 0 # innodb_flush_method = O_DIRECT # query_cache_type = 1 # query_cache_size = 64M