mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-06 15:12:30 +09:00
Make WordPressService.create_site a single one-click orchestrator. It now accepts php_version / enable_page_cache / enable_object_cache and: - Bakes the chosen PHP version into the INITIAL image tag (concrete 6.4-php<x.y>-apache) so the site boots on the right PHP with no post-create container recreate, then finalizes + _harden_docker_site, then best-effort enables page cache (#22) and Redis object cache (#23) AFTER `wp core install` (redis already ships in the stack). Cache enablement never fails the create — failures degrade to a non-fatal warning; the one-time admin password is still surfaced once. - The live create modal (inline in WordPress.jsx) gains a PHP version selector (Default / 8.1 / 8.2 / 8.3) and page-cache / object-cache toggles, threaded through createForm -> POST /sites as phpVersion / enablePageCache / enableObjectCache (PHP validated server-side). Mechanism: declare a hidden VERSION template var and switch the image line to bare ${VERSION} in wordpress.yaml + wordpress-external-db.yaml so a concrete tag is written at install. This also fixes a latent #24 bug where the unresolved ${VERSION:-...} literal made set_php_version drop the WP-core pin; set_php_version now also falls back to the known core for legacy compose files. No DB migration — PHP/object-cache/SSL read live; the page-cache flag rides the existing sync_config column. Deferred: SSL/TLS + custom-domain at create. Managed sites are http://localhost:PORT containers with no per-site reverse proxy and no domain attached at create — the same missing public-domain/routing infra that blocks #21 and that #8 left frontend-only. TLS remains operable post-create via SiteSSLPanel (#8) once a domain is routed. Verified: backend py_compile, frontend lint-clean + production build, a 3-lens adversarial review (no blockers), and Docker Hub confirms all 6.4-php8.{1,2,3}-apache tags exist. Not runtime-exercised on a real Docker host (Windows dev). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
81 lines
2.1 KiB
YAML
81 lines
2.1 KiB
YAML
id: wordpress-external-db
|
|
name: WordPress (External Database)
|
|
version: "6.4"
|
|
description: WordPress CMS connecting to an existing external MySQL database. Use this for dev/prod setups sharing the same database with different table prefixes.
|
|
icon: https://serverkit.ai/imgs/template-icons/wordpress-external-db.png
|
|
website: https://wordpress.org
|
|
documentation: https://wordpress.org/documentation/
|
|
categories:
|
|
- cms
|
|
- blog
|
|
- website
|
|
- development
|
|
|
|
variables:
|
|
- name: VERSION
|
|
description: WordPress image tag (WP core + PHP variant, e.g. 6.4-php8.2-apache)
|
|
type: string
|
|
default: "6.4-apache"
|
|
hidden: true
|
|
- name: HTTP_PORT
|
|
description: HTTP port for WordPress
|
|
type: port
|
|
default: "8080"
|
|
hidden: true
|
|
- name: DB_HOST
|
|
description: External database host (e.g., 192.168.1.100 or db.example.com)
|
|
type: string
|
|
required: true
|
|
- name: DB_PORT
|
|
description: External database port
|
|
type: string
|
|
default: "3306"
|
|
- name: DB_NAME
|
|
description: Database name
|
|
type: string
|
|
default: "wordpress"
|
|
required: true
|
|
- name: DB_USER
|
|
description: Database username
|
|
type: string
|
|
default: "wordpress"
|
|
required: true
|
|
- name: DB_PASSWORD
|
|
description: Database password
|
|
type: password
|
|
required: true
|
|
- name: TABLE_PREFIX
|
|
description: WordPress table prefix (use different prefix for dev vs prod, e.g., wp_dev_)
|
|
type: string
|
|
default: "wp_"
|
|
|
|
ports:
|
|
- port: 8080
|
|
protocol: tcp
|
|
description: Web interface
|
|
|
|
volumes:
|
|
- name: html
|
|
path: /var/www/html
|
|
description: WordPress files
|
|
|
|
compose:
|
|
services:
|
|
wordpress:
|
|
image: wordpress:${VERSION}
|
|
container_name: ${APP_NAME}
|
|
restart: unless-stopped
|
|
environment:
|
|
- WORDPRESS_DB_HOST=${DB_HOST}:${DB_PORT}
|
|
- WORDPRESS_DB_USER=${DB_USER}
|
|
- WORDPRESS_DB_PASSWORD=${DB_PASSWORD}
|
|
- WORDPRESS_DB_NAME=${DB_NAME}
|
|
- WORDPRESS_TABLE_PREFIX=${TABLE_PREFIX}
|
|
volumes:
|
|
- wordpress_html:/var/www/html
|
|
ports:
|
|
- "${HTTP_PORT}:80"
|
|
|
|
volumes:
|
|
wordpress_html:
|