diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0e90053 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,18 @@ +.git +.github +docs +tests +vendor +node_modules +.phpunit.cache +.phpunit.result.cache +composer.lock +docker/host-app/vendor +docker/host-app/node_modules +docker/host-app/public/build +docker/host-app/bootstrap/cache +docker/host-app/storage/framework/cache/data +docker/host-app/storage/framework/sessions +docker/host-app/storage/framework/views +docker/host-app/storage/logs +docker/host-app/database/database.sqlite diff --git a/.gitattributes b/.gitattributes index 8dc9278..5a9bb9e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,17 @@ -# Force LF line endings for all text files * text=auto eol=lf + +*.sh text eol=lf +Dockerfile* text eol=lf +*.yml text eol=lf +*.yaml text eol=lf +*.php text eol=lf +*.js text eol=lf +*.json text eol=lf +*.blade.php text eol=lf +*.css text eol=lf + +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..432e9ea --- /dev/null +++ b/docker/README.md @@ -0,0 +1,13 @@ +# Escalated WordPress โ Docker demo (scaffold, not end-to-end) + +Draft. Mounts the plugin into a stock `wordpress:6.6-php8.3-apache` image alongside MariaDB and Mailpit. + +**Differs from the other escalated-* demos: uses MariaDB, not Postgres.** WordPress is a MySQL-family application and swapping its DB layer is out of scope for a demo. + +**Not end-to-end.** Missing: + +- WP-CLI based setup script: `wp core install`, `wp user create`, plugin activation, seed demo tickets via an `escalated` CLI subcommand if one exists. +- `/demo` picker โ could be a WP page template that lists seeded users with WP auth cookie click-login via `wp_set_auth_cookie()`. +- Environment to reset the whole WP install on each `docker compose up` so the demo is reproducible. + +See the PR body for the punch list. diff --git a/docker/compose.yml b/docker/compose.yml new file mode 100644 index 0000000..ebde77e --- /dev/null +++ b/docker/compose.yml @@ -0,0 +1,63 @@ +name: escalated-wordpress-demo + +services: + wordpress: + image: wordpress:6.6-php8.3-apache + ports: + - "${APP_PORT:-8090}:80" + environment: + WORDPRESS_DB_HOST: db:3306 + WORDPRESS_DB_USER: escalated + WORDPRESS_DB_PASSWORD: escalated + WORDPRESS_DB_NAME: escalated + WORDPRESS_DEBUG: "1" + WORDPRESS_CONFIG_EXTRA: | + define('WP_ENVIRONMENT_TYPE', 'development'); + volumes: + - ../:/var/www/html/wp-content/plugins/escalated-wordpress:ro + - wp-data:/var/www/html + depends_on: + db: + condition: service_healthy + + db: + # WordPress plays best with MySQL. Note this is the one escalated-* demo + # that doesn't use Postgres โ the WP ecosystem targets MySQL/MariaDB. + image: mariadb:11-noble + environment: + MARIADB_DATABASE: escalated + MARIADB_USER: escalated + MARIADB_PASSWORD: escalated + MARIADB_ROOT_PASSWORD: escalated + healthcheck: + test: ["CMD-SHELL", "healthcheck.sh --connect --innodb_initialized"] + interval: 3s + retries: 20 + + wpcli: + image: wordpress:cli-php8.3 + user: "33:33" + depends_on: + wordpress: + condition: service_started + db: + condition: service_healthy + volumes: + - wp-data:/var/www/html + - ../:/var/www/html/wp-content/plugins/escalated-wordpress:ro + - ./setup.sh:/setup.sh:ro + - ./demo-picker.php:/demo-picker.php:ro + environment: + WORDPRESS_DB_HOST: db:3306 + WORDPRESS_DB_USER: escalated + WORDPRESS_DB_PASSWORD: escalated + WORDPRESS_DB_NAME: escalated + command: ["sh", "/setup.sh"] + + mailpit: + image: axllent/mailpit:latest + ports: + - "${MAILPIT_PORT:-8025}:8025" + +volumes: + wp-data: diff --git a/docker/demo-picker.php b/docker/demo-picker.php new file mode 100644 index 0000000..f22d85e --- /dev/null +++ b/docker/demo-picker.php @@ -0,0 +1,67 @@ + 'ID', 'order' => 'ASC']); + echo '
Click a user to log in. Every restart resets the WordPress install.
'; + foreach ($users as $u) { + $is_admin = user_can($u, 'manage_options'); + $is_agent = user_can($u, 'edit_posts') && ! $is_admin; + $badge = $is_admin ? 'Admin' : ($is_agent ? 'Agent' : ''); + echo ''; + } + echo '