|
| 1 | +# Jetpack Performance Testing Environment |
| 2 | +# Single WordPress instance with simulated Jetpack connection for LCP measurement. |
| 3 | +# Plugin is mounted from ../plugin (cloned from jetpack-production mirror). |
| 4 | +# |
| 5 | +# Ports are assigned dynamically by Docker. Use 'docker compose port <service> 80' to discover. |
| 6 | + |
| 7 | +services: |
| 8 | + # Shared MySQL database |
| 9 | + db: |
| 10 | + image: mysql:8.0 |
| 11 | + command: --default-authentication-plugin=mysql_native_password |
| 12 | + volumes: |
| 13 | + - db_data:/var/lib/mysql |
| 14 | + - ./init-databases.sql:/docker-entrypoint-initdb.d/init.sql:ro |
| 15 | + restart: unless-stopped |
| 16 | + environment: |
| 17 | + MYSQL_ROOT_PASSWORD: rootpassword |
| 18 | + networks: |
| 19 | + - jetpack-perf |
| 20 | + healthcheck: |
| 21 | + test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-prootpassword"] |
| 22 | + interval: 5s |
| 23 | + timeout: 5s |
| 24 | + retries: 20 |
| 25 | + start_period: 30s |
| 26 | + |
| 27 | + # WordPress with Jetpack simulated connection |
| 28 | + # Uses mu-plugin to fake connection tokens and intercept WP.com API calls with artificial latency |
| 29 | + wordpress-jetpack-connected: |
| 30 | + image: wordpress:6.7-php8.2-apache |
| 31 | + ports: |
| 32 | + - "80" # Dynamic port - use 'docker compose port wordpress-jetpack-connected 80' to discover |
| 33 | + restart: unless-stopped |
| 34 | + environment: |
| 35 | + WORDPRESS_DB_HOST: db |
| 36 | + WORDPRESS_DB_USER: root |
| 37 | + WORDPRESS_DB_PASSWORD: rootpassword |
| 38 | + WORDPRESS_DB_NAME: wp_jetpack_connected |
| 39 | + WORDPRESS_TABLE_PREFIX: wp_ |
| 40 | + WORDPRESS_DEBUG: "false" |
| 41 | + # Simulated latency in milliseconds (configurable) |
| 42 | + WPCOM_SIMULATED_LATENCY_MS: ${WPCOM_SIMULATED_LATENCY_MS:-200} |
| 43 | + volumes: |
| 44 | + - wp_jetpack_connected:/var/www/html |
| 45 | + - ../plugin:/var/www/html/wp-content/plugins/jetpack:ro |
| 46 | + # Mount the mu-plugin for connection simulation |
| 47 | + - ./mu-plugins:/var/www/html/wp-content/mu-plugins:ro |
| 48 | + networks: |
| 49 | + - jetpack-perf |
| 50 | + depends_on: |
| 51 | + db: |
| 52 | + condition: service_healthy |
| 53 | + |
| 54 | + # WP-CLI for setup operations |
| 55 | + wpcli: |
| 56 | + image: wordpress:cli-2.10-php8.2 |
| 57 | + user: "33:33" # Match www-data UID from WordPress Debian image |
| 58 | + volumes: |
| 59 | + - wp_jetpack_connected:/var/www/html/jetpack-connected |
| 60 | + - ./setup-wordpress.sh:/usr/local/bin/setup-wordpress.sh:ro |
| 61 | + - ../plugin:/var/www/html/jetpack-connected/wp-content/plugins/jetpack:ro |
| 62 | + - ./mu-plugins:/var/www/html/jetpack-connected/wp-content/mu-plugins:ro |
| 63 | + networks: |
| 64 | + - jetpack-perf |
| 65 | + depends_on: |
| 66 | + db: |
| 67 | + condition: service_healthy |
| 68 | + wordpress-jetpack-connected: |
| 69 | + condition: service_started |
| 70 | + environment: |
| 71 | + WORDPRESS_DB_HOST: db |
| 72 | + WORDPRESS_DB_USER: root |
| 73 | + WORDPRESS_DB_PASSWORD: rootpassword |
| 74 | + WP_ADMIN_USER: ${WP_ADMIN_USER:-admin} |
| 75 | + WP_ADMIN_PASS: ${WP_ADMIN_PASS:-password} |
| 76 | + WP_ADMIN_EMAIL: ${WP_ADMIN_EMAIL:[email protected]} |
| 77 | + # Run setup and exit |
| 78 | + command: ["sh", "/usr/local/bin/setup-wordpress.sh"] |
| 79 | + |
| 80 | +networks: |
| 81 | + jetpack-perf: |
| 82 | + driver: bridge |
| 83 | + |
| 84 | +volumes: |
| 85 | + db_data: |
| 86 | + wp_jetpack_connected: |
0 commit comments