Interface CmsSpec

All Superinterfaces:
ApplicationSpec
All Known Implementing Classes:
BagistoApplicationSpec, ConcreteCmsApplicationSpec, DolphinApplicationSpec, DrupalApplicationSpec, FlarumApplicationSpec, JoomlaApplicationSpec, MagentoApplicationSpec, MediaWikiApplicationSpec, MoodleApplicationSpec, MyBBApplicationSpec, OctoberCmsApplicationSpec, OpenCartApplicationSpec, PhpBBApplicationSpec, PrestaShopApplicationSpec, SuiteCrmApplicationSpec, SyliusApplicationSpec, Typo3ApplicationSpec, WooCommerceApplicationSpec, WordPressApplicationSpec

public interface CmsSpec extends ApplicationSpec
CMS/E-commerce specification interface extending ApplicationSpec.

Provides CMS-specific configuration for PHP-based content management and e-commerce platforms including WordPress, Magento, Joomla, PrestaShop, and Drupal.

Example implementations:

  • WordPressApplicationSpec: PHP-based CMS and blogging platform
  • WooCommerceApplicationSpec: WordPress-based e-commerce
  • MagentoApplicationSpec: Adobe Commerce-compatible e-commerce platform
  • JoomlaApplicationSpec: General-purpose CMS for websites
  • PrestaShopApplicationSpec: Open-source e-commerce
  • DrupalApplicationSpec: CMS with OIDC support

Configuration

  • PHP runtime configuration (version, extensions, OPcache, PHP-FPM)
  • S3 media storage offloading
  • CDN integration for static assets
  • Redis/Memcached object caching
  • Scheduled task management (system cron vs internal)
  • Multi-site/multi-store support
  • OIDC authentication via plugins

4.0 migration intent

This interface is the 3.x CMS/e-commerce convenience contract and remains supported as a compatibility surface during the 4.0 migration. It must not become the template for a new large interface per application family. A CMS implementation remains an ApplicationSpec and will be adapted into the same typed application requirements, provider selection, policy, entitlement, compliance, resolved-plan, and binding contracts used by every other application.

The adapter maps shared infrastructure concerns to named requirements, for example:

  • PHP version, extensions, FPM and OPcache settings to a runtime requirement;
  • the primary CMS database to database.primary;
  • persistent content/files and media offload to named storage requirements;
  • object/session/page cache to named cache requirements;
  • CDN, TLS, DNS, and public/admin routes to delivery and ingress policies; and
  • cron/background work to scheduled-work requirements.

CMS-specific runtime behavior stays application-owned: a plugin may still describe PHP configuration and how resolved database, storage, cache, identity, and ingress bindings become its environment, secret references, configuration files, commands, or EC2 user data. The CMS plugin does not select arbitrary infrastructure providers, create raw resources, override platform profiles, bypass entitlement restrictions, or weaken required compliance controls.

New 4.0 application plugins should declare the narrow reusable requirement records directly. Existing CmsSpec, CmsMediaStorageSpec, and CmsObjectCacheSpec implementations will be retained behind compatibility adapters until synthesis, integration, parameterized, and compliance regressions prove equivalent behavior.

Since:
3.1.0
See Also:
  • Method Details

    • phpVersion

      String phpVersion()
      Returns the required PHP version for this CMS.

      Common versions:

      • 8.2 - WordPress, Magento 2.4.6+, Drupal 10
      • 8.1 - PrestaShop 8.x, Joomla 5
      • 7.4 - Legacy support (not recommended)
      Returns:
      PHP version string (e.g., "8.2", "8.1")
    • requiredPhpExtensions

      List<String> requiredPhpExtensions()
      Returns required PHP extensions for this CMS.

      Common extensions include:

      • mysqli, pdo_mysql - MySQL database connectivity
      • gd, imagick - Image processing
      • curl - HTTP client
      • mbstring - Multibyte string handling
      • xml, dom - XML processing
      • zip - Archive handling
      • intl - Internationalization
      • opcache - Bytecode caching
      • redis - Redis client
      Returns:
      List of PHP extension names
    • phpFpmConfig

      default Map<String,String> phpFpmConfig()
      Returns PHP-FPM pool configuration overrides.

      Common settings:

      • pm - Process manager (static, dynamic, ondemand)
      • pm.max_children - Maximum worker processes
      • pm.start_servers - Initial workers (dynamic mode)
      • pm.min_spare_servers - Minimum idle workers
      • pm.max_spare_servers - Maximum idle workers
      • pm.max_requests - Requests before worker recycle
      Returns:
      Map of PHP-FPM configuration key-value pairs
    • opcacheConfig

      default Map<String,String> opcacheConfig()
      Returns OPcache configuration for PHP bytecode caching.

      Recommended production settings:

      • opcache.enable=1 - Enable OPcache
      • opcache.memory_consumption=128 - Cache memory (MB)
      • opcache.max_accelerated_files=10000 - Cached file limit
      • opcache.revalidate_freq=60 - File check interval (seconds)
      • opcache.validate_timestamps=0 - Disable for production
      Returns:
      Map of OPcache configuration key-value pairs
    • phpMemoryLimit

      default int phpMemoryLimit()
      Returns PHP memory limit in megabytes.

      Recommended values:

      • WordPress: 256MB
      • WooCommerce: 512MB
      • Magento: 756MB-2GB
      • Drupal: 256MB
      Returns:
      Memory limit in MB
    • phpMaxExecutionTime

      default int phpMaxExecutionTime()
      Returns PHP max execution time in seconds.
      Returns:
      Max execution time (default: 300 seconds)
    • phpUploadMaxFilesize

      default int phpUploadMaxFilesize()
      Returns PHP upload max filesize in megabytes.
      Returns:
      Upload max filesize in MB (default: 64MB)
    • phpPostMaxSize

      default int phpPostMaxSize()
      Returns PHP post max size in megabytes.
      Returns:
      Post max size in MB (default: 64MB)
    • supportsS3MediaStorage

      default boolean supportsS3MediaStorage()
      Returns whether S3 media offloading is supported.

      When enabled, media uploads are stored in S3 instead of local filesystem, enabling horizontal scaling and CDN integration.

      Returns:
      true if S3 media storage is supported
    • s3MediaPlugin

      default String s3MediaPlugin()
      Returns the plugin/module identifier for S3 media integration.

      Examples:

      • WordPress: "wp-offload-media" or "amazon-s3-and-cloudfront"
      • Magento: "magento/module-aws-s3"
      • Drupal: "s3fs"
      Returns:
      Plugin identifier, or null if native S3 support
    • mediaUploadPath

      String mediaUploadPath()
      Returns the local media upload path within the container.

      Examples:

      • WordPress: "/var/www/html/wp-content/uploads"
      • Magento: "/var/www/html/pub/media"
      • Drupal: "/var/www/html/sites/default/files"
      Returns:
      Absolute path to media upload directory
    • supportsCdnIntegration

      default boolean supportsCdnIntegration()
      Returns whether CDN integration is supported.

      CDN integration via CloudFront enables:

      • Edge caching for static assets
      • Global content delivery
      • SSL termination at edge
      • DDoS protection
      Returns:
      true if CDN integration is supported (default: true)
    • cdnAssetPaths

      @Deprecated default List<String> cdnAssetPaths()
      Deprecated.
      Override cdnStaticPaths() instead
      Returns static asset paths to be served via CDN.

      These paths will be configured as CloudFront cache behaviors with optimized caching policies. Implementations should override cdnStaticPaths() instead; this method is kept for backwards compatibility and defaults to cdnStaticPaths().

      Returns:
      List of URL path patterns (e.g., "/wp-content/themes/*")
    • cdnMediaPaths

      default List<String> cdnMediaPaths()
      Returns paths served from the S3 media origin in CloudFront.

      These paths correspond to user-uploaded media files (images, videos, documents) that are offloaded to S3. They will be routed to the S3 origin with a long-TTL media cache policy.

      Examples:

      • WordPress: ["/wp-content/uploads/*"]
      • Magento: ["/media/*"]
      • Drupal: ["/sites/default/files/*"]
      Returns:
      List of URL path patterns for S3 media origin (default: derived from mediaUploadPath(), empty if that path isn't under the web root)
    • cdnStaticPaths

      default List<String> cdnStaticPaths()
      Returns static asset paths cached at the edge in CloudFront.

      These paths (CSS, JS, fonts, theme assets) are served from the ALB origin with a long-TTL static cache policy. They do not include user-uploaded media; see cdnMediaPaths() for that.

      Examples:

      • WordPress: ["/wp-content/themes/*", "/wp-content/plugins/*", "/wp-includes/*"]
      • Magento: ["/static/*"]
      • Drupal: ["/core/*", "/modules/*", "/themes/*"]
      Returns:
      List of URL path patterns for edge-cached static assets (default: empty)
    • cdnAdminPaths

      default List<String> cdnAdminPaths()
      Returns admin/back-office paths that bypass CDN caching entirely.

      Requests to these paths are forwarded to the ALB with caching disabled and all headers/cookies forwarded, ensuring the CMS admin panel receives full session state.

      This is also the single source of truth for ALB OIDC path-based authentication. The default protectedPaths() implementation below delegates here, so CMS implementations only need to override cdnAdminPaths() and both CDN routing and ALB auth stay in sync.

      Examples:

      • WordPress: ["/wp-admin/*", "/wp-login.php"]
      • Magento: ["/admin/*", "/backend/*"]
      • Joomla: ["/administrator/*"]
      Returns:
      List of URL path patterns that must not be cached (default: empty)
    • protectedPaths

      default List<String> protectedPaths()
      Returns paths requiring ALB OIDC authentication for this CMS.

      Defaults to cdnAdminPaths() so that CDN routing and ALB-level Cognito authentication always protect the same paths. Override only when the protected path set differs from the CDN admin paths.

      Specified by:
      protectedPaths in interface ApplicationSpec
      Returns:
      list of path patterns requiring authentication
      See Also:
    • redisEnvVars

      default Map<String,String> redisEnvVars(String host, int port)
      Returns Redis connection environment variables for this CMS.

      The default implementation returns the generic REDIS_HOST / REDIS_PORT pair. CMS implementations should override to add their plugin-specific variable names.

      Examples of CMS-specific additions:

      • WordPress: WP_REDIS_HOST, WP_REDIS_PORT, WP_REDIS_DATABASE
      • Magento: MAGENTO_CACHE_BACKEND_REDIS_SERVER (+ page-cache and session variants)
      • Drupal: DRUPAL_REDIS_HOST, DRUPAL_REDIS_PORT
      Parameters:
      host - Redis primary endpoint hostname
      port - Redis port (usually 6379)
      Returns:
      mutable map of environment variable key-value pairs
    • databaseEnvVars

      default Map<String,String> databaseEnvVars(String host, int port, String name, String user)
      Returns database connection environment variables for this CMS.

      The default implementation returns generic DB_HOST / DB_PORT / DB_NAME / DB_USER. CMS implementations should override to add their native variable names.

      Examples of CMS-specific additions:

      • WordPress: WORDPRESS_DB_HOST, WORDPRESS_DB_NAME, WORDPRESS_DB_USER
      • Magento: MAGENTO_DATABASE_HOST, MAGENTO_DATABASE_NAME
      • Drupal: DRUPAL_DATABASE_HOST, DRUPAL_DATABASE_DRIVER
      Parameters:
      host - RDS endpoint hostname
      port - database port (3306 for MySQL/MariaDB, 5432 for Postgres)
      name - database name
      user - database username
      Returns:
      mutable map of environment variable key-value pairs
    • supportsObjectCache

      default boolean supportsObjectCache()
      Returns whether Redis/Memcached object caching is supported.

      Object caching stores database query results and computed values in memory for faster retrieval.

      Returns:
      true if object caching is supported
    • preferredCacheBackend

      default String preferredCacheBackend()
      Returns the preferred caching backend.
      Returns:
      "redis", "memcached", or "none"
    • objectCachePlugin

      default String objectCachePlugin()
      Returns the object cache plugin/module identifier.

      Examples:

      • WordPress: "redis-cache" (Redis Object Cache plugin)
      • Magento: Built-in Redis support
      • Drupal: "redis" module
      Returns:
      Plugin identifier for object caching
    • hasScheduledTasks

      default boolean hasScheduledTasks()
      Returns whether the CMS has scheduled tasks (cron jobs).

      Most CMS platforms have internal task schedulers:

      • WordPress: WP-Cron
      • Magento: Cron groups (index, default, consumers)
      • Drupal: Cron module
      Returns:
      true if scheduled tasks exist
    • useSystemCron

      default boolean useSystemCron()
      Returns whether to use system cron instead of internal scheduler.

      System cron is recommended for production because:

      • More reliable execution timing
      • Reduced page load overhead
      • Better control over resource usage
      Returns:
      true to disable internal cron and use system cron
    • cronCommands

      default Map<String,String> cronCommands(String siteUrl)
      Returns scheduled task commands for system cron.

      Map keys are cron schedule expressions, values are commands.

      Example for WordPress:

      "* /15 * * * *" -> "curl -s https://example.com/wp-cron.php"
      
      Parameters:
      siteUrl - The site URL for cron execution
      Returns:
      Map of cron schedule to command
    • supportsMultisite

      default boolean supportsMultisite()
      Returns whether multi-site/multi-store is supported.

      Multi-site capabilities:

      • WordPress: Multisite network
      • Magento: Multi-store views
      • Drupal: Multi-site configuration
      • PrestaShop: Multi-shop
      Returns:
      true if multi-site is available
    • multisiteMode

      default String multisiteMode()
      Returns the multi-site configuration mode.

      Modes:

      • "subdomain" - sites.example.com
      • "subdirectory" - example.com/sites/
      • "domain" - separate domains per site
      • "none" - multi-site not enabled
      Returns:
      Multi-site mode string
    • cmsCategory

      default String cmsCategory()
      Returns the CMS category.

      Categories:

      • "cms" - Content management (WordPress, Joomla, Drupal)
      • "ecommerce" - E-commerce (WooCommerce, Magento, PrestaShop)
      Returns:
      "cms" or "ecommerce"
    • isEcommerce

      default boolean isEcommerce()
      Returns whether this is an e-commerce platform.

      E-commerce platforms may require:

      • PCI-DSS compliance
      • Higher resource allocation
      • Payment gateway integration
      • Inventory management
      Returns:
      true for e-commerce platforms
    • category

      default String category()
      Get the application category from @CmsPlugin.

      Overrides ApplicationSpec.category() to read from CmsPlugin annotation instead of ApplicationPlugin.

      Specified by:
      category in interface ApplicationSpec
      Returns:
      the category from @CmsPlugin (e.g., "cms", "ecommerce", "forum", "wiki", "lms", "social")
    • displayName

      default String displayName()
      Get the human-readable display name for this CMS.

      Overrides ApplicationSpec.displayName() to read from CmsPlugin annotation instead of ApplicationPlugin.

      Specified by:
      displayName in interface ApplicationSpec
      Returns:
      the display name from @CmsPlugin, or capitalized applicationId() if not specified
    • description

      default String description()
      Get the CMS description.

      Overrides ApplicationSpec.description() to read from CmsPlugin annotation instead of ApplicationPlugin.

      Specified by:
      description in interface ApplicationSpec
      Returns:
      the description from @CmsPlugin
    • defaultCpu

      default int defaultCpu()
      Get the default Fargate CPU units from @CmsPlugin.
      Specified by:
      defaultCpu in interface ApplicationSpec
      Returns:
      the default CPU units
    • defaultMemory

      default int defaultMemory()
      Get the default Fargate memory from @CmsPlugin.
      Specified by:
      defaultMemory in interface ApplicationSpec
      Returns:
      the default memory in MB
    • defaultInstanceType

      default String defaultInstanceType()
      Get the default EC2 instance type from @CmsPlugin.
      Specified by:
      defaultInstanceType in interface ApplicationSpec
      Returns:
      the default instance type
    • supportsFargate

      default boolean supportsFargate()
      Check if this CMS supports Fargate deployment.
      Specified by:
      supportsFargate in interface ApplicationSpec
      Returns:
      true if Fargate is supported
    • supportsEc2

      default boolean supportsEc2()
      Check if this CMS supports EC2 deployment.
      Specified by:
      supportsEc2 in interface ApplicationSpec
      Returns:
      true if EC2 is supported
    • requiresDatabase

      default boolean requiresDatabase()
      CMS apps declare database requirement on CmsPlugin.requiresDatabase().
      Specified by:
      requiresDatabase in interface ApplicationSpec
    • supportsOidcIntegration

      default boolean supportsOidcIntegration()
      Check if this CMS supports OIDC integration.

      Overrides ApplicationSpec.supportsOidcIntegration() to read from CmsPlugin annotation instead of ApplicationPlugin.

      Specified by:
      supportsOidcIntegration in interface ApplicationSpec
      Returns:
      true if OIDC is supported based on @CmsPlugin.supportsOidc()
    • preferredWebServer

      default String preferredWebServer()
      Returns the preferred web server.
      Returns:
      "nginx", "apache", or "caddy"
    • documentRoot

      default String documentRoot()
      Returns the document root path within the container.

      This is where the web server serves files from.

      Returns:
      Document root path (e.g., "/var/www/html")
    • containerCommand

      default List<String> containerCommand()
      Returns the container startup command for this CMS.

      Use this to override the default container entrypoint/command. Common uses include:

      • Configuring web server to listen on non-privileged ports
      • Setting up environment-specific configuration
      • Running initialization scripts before the main process

      Example for Apache on port 8080:

      return List.of("/bin/sh", "-c",
          "sed -i 's/Listen 80/Listen 8080/' /etc/apache2/ports.conf && " +
          "sed -i 's/:80/:8080/' /etc/apache2/sites-available/*.conf && " +
          "apache2-foreground");
      
      Returns:
      List of command arguments, or null to use the image default
    • cliTool

      default String cliTool()
      Returns the CLI tool for this CMS, if available.

      Examples:

      • WordPress: "wp" (WP-CLI)
      • Magento: "bin/magento"
      • Drupal: "drush"
      • Joomla: "cli/joomla.php"
      Returns:
      CLI tool command, or null if not available
    • cliToolInstallCommands

      default List<String> cliToolInstallCommands()
      Returns commands to install the CLI tool.
      Returns:
      List of shell commands to install CLI tool