# SilverStripe CMS

> Flexible PHP CMS with built-in versioning and workflows.

- Category: CMS & Blogging
- Difficulty: intermediate
- Components: silverstripe, mysql
- Tags: silverstripe, php, versioning, workflow
- Source: https://docker.recipes/cms/silverstripe

## Overview

SilverStripe is a mature PHP-based content management system originally developed in New Zealand, known for its sophisticated content versioning, built-in workflow capabilities, and developer-friendly ORM. Unlike simpler CMSs, SilverStripe provides enterprise-grade features including draft/published content states, hierarchical page structures, and extensible template systems that make it ideal for complex websites requiring editorial workflows and content governance. This stack combines SilverStripe with MySQL 8.0 to deliver a robust content management platform where MySQL's InnoDB storage engine provides ACID compliance for SilverStripe's versioning system, ensuring data integrity across content revisions and user permissions. The configuration leverages MySQL's JSON data type support for SilverStripe's flexible field storage and MySQL's full-text search capabilities to power the CMS's built-in search functionality. This combination serves organizations that need more than basic blogging capabilities - those requiring sophisticated content workflows, multi-user editorial processes, and the ability to maintain complex content hierarchies with full audit trails and rollback capabilities.

## Features

- Built-in content versioning with draft/published states powered by MySQL's transactional integrity
- Hierarchical page structure with unlimited nesting supported by MySQL's recursive queries
- Fluent ORM query builder that generates optimized MySQL queries with automatic escaping
- Multi-user editorial workflows with approval processes tracked in MySQL audit tables
- Template inheritance system with partial caching stored in MySQL for performance
- Extensible field types including relations that leverage MySQL's foreign key constraints
- Built-in search functionality utilizing MySQL's full-text indexing capabilities
- Module system for extending functionality with database schema migrations

## Use cases

- Corporate websites requiring editorial approval workflows and content governance
- Educational institutions managing complex course catalogs and faculty information
- Government agencies needing audit trails and content versioning for compliance
- Marketing agencies building client websites with sophisticated content management needs
- E-commerce sites using SilverStripe's flexible product catalog capabilities
- Membership organizations with complex user hierarchies and content permissions
- News and media sites requiring editorial workflows and publishing schedules

## Prerequisites

- Docker and Docker Compose installed on the host system
- Minimum 1GB RAM recommended for MySQL 8.0 optimal performance
- Port 80 available on host for SilverStripe web interface
- Basic understanding of PHP development and Composer package management
- Familiarity with MySQL administration for database maintenance tasks
- Understanding of web server concepts and virtual hosting

## docker-compose.yml

```yaml
services:
  silverstripe:
    image: brettt89/silverstripe-web:latest
    container_name: silverstripe
    restart: unless-stopped
    environment:
      SS_DATABASE_CLASS: MySQLDatabase
      SS_DATABASE_SERVER: mysql
      SS_DATABASE_USERNAME: silverstripe
      SS_DATABASE_PASSWORD: ${DB_PASSWORD}
      SS_DATABASE_NAME: silverstripe
    volumes:
      - ./app:/var/www/html
    ports:
      - "80:80"
    depends_on:
      - mysql
    networks:
      - silverstripe-network

  mysql:
    image: mysql:8.0
    container_name: silverstripe-mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${ROOT_PASSWORD}
      MYSQL_DATABASE: silverstripe
      MYSQL_USER: silverstripe
      MYSQL_PASSWORD: ${DB_PASSWORD}
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - silverstripe-network

volumes:
  mysql_data:

networks:
  silverstripe-network:
    driver: bridge
```

## .env

```bash
DB_PASSWORD=changeme
ROOT_PASSWORD=changeme
```

## Usage notes

- Docs: https://docs.silverstripe.org/
- Create project: composer create-project silverstripe/installer
- Access at http://localhost, admin at /admin
- Built-in versioning, draft/published states
- ORM with fluent query builder
- Workflow module for approval processes

## Troubleshooting

- SilverStripe shows database connection error: Verify MySQL container is running and DB_PASSWORD environment variable matches between services
- Admin interface returns 500 error: Check that ./app directory exists and has proper write permissions for SilverStripe cache and assets
- MySQL container fails to start: Ensure mysql_data volume has sufficient disk space and ROOT_PASSWORD is set in environment file
- SilverStripe installer loops endlessly: Clear browser cache and ensure database credentials are correct in environment variables
- Assets upload fails: Verify ./app/assets directory exists with write permissions for web server user
- Module installation fails: Check that Composer cache directory is writable within the silverstripe container

