Skip to content

Deploying SilverStripe

Introduction

SilverStripe is a powerful open-source content management system and PHP framework used by governments, enterprises, and developers worldwide. It combines an intuitive drag-and-drop page editor with a robust MVC framework, making it suitable for both simple websites and complex web applications.

Originally developed in New Zealand, SilverStripe has grown into a mature platform trusted by organizations including the New Zealand government, major universities, and international brands. Its dual nature as both a CMS and a development framework provides flexibility for projects of any scale.

Key features of SilverStripe include:

  • Intuitive CMS Interface: A clean, modern admin interface that content editors love
  • Drag-and-Drop Editing: Visual page building with elemental content blocks
  • MVC Framework: Full-featured PHP framework for custom development
  • GraphQL API: Built-in headless CMS capabilities for modern frontends
  • Version Control: Content versioning with draft and published states
  • Multi-Site Support: Manage multiple websites from a single installation
  • User Permissions: Granular access control for content and admin sections
  • Asset Management: Powerful file and image management system
  • Form Builder: Visual form creation with validation and submissions tracking
  • SEO Tools: Built-in meta tag management and URL handling
  • Subsites Module: Create and manage related websites easily
  • Active Community: Strong ecosystem of modules and community support
  • Enterprise Ready: Used by major organizations for mission-critical sites

This guide walks through deploying SilverStripe on Klutch.sh using Docker, configuring the database, and setting up your CMS for production use.

Why Deploy SilverStripe on Klutch.sh

Deploying SilverStripe on Klutch.sh provides several advantages:

Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds SilverStripe without complex server configuration.

Persistent Storage: Attach persistent volumes for assets, uploads, and cached files that survive redeployments.

HTTPS by Default: Klutch.sh provides automatic SSL certificates for secure content management.

GitHub Integration: Connect your repository for automatic deployments when you push changes.

Scalable Resources: Allocate CPU and memory based on your site’s traffic and complexity.

Environment Variable Management: Securely store database credentials and configuration.

Custom Domains: Assign your own domain for your SilverStripe installation.

Always-On Availability: Your website remains accessible 24/7 without managing infrastructure.

Prerequisites

Before deploying SilverStripe on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your SilverStripe project
  • A MySQL or PostgreSQL database
  • Basic familiarity with Docker, PHP, and Composer
  • (Optional) A custom domain for your website

Deploying SilverStripe on Klutch.sh

    Create a GitHub Repository

    Create a new GitHub repository for your SilverStripe project. You can start with a fresh installation or an existing SilverStripe site.

    Create Your Dockerfile

    Create a Dockerfile in your repository:

    FROM php:8.2-apache
    RUN apt-get update && apt-get install -y \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    libzip-dev \
    libicu-dev \
    unzip \
    git \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install gd pdo pdo_mysql zip intl opcache
    RUN a2enmod rewrite
    COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
    WORKDIR /var/www/html
    COPY . .
    RUN composer install --no-dev --optimize-autoloader
    RUN chown -R www-data:www-data /var/www/html \
    && chmod -R 755 /var/www/html
    ENV SS_DATABASE_CLASS="MySQLDatabase"
    ENV SS_DATABASE_SERVER=${SS_DATABASE_SERVER}
    ENV SS_DATABASE_NAME=${SS_DATABASE_NAME}
    ENV SS_DATABASE_USERNAME=${SS_DATABASE_USERNAME}
    ENV SS_DATABASE_PASSWORD=${SS_DATABASE_PASSWORD}
    ENV SS_DEFAULT_ADMIN_USERNAME=${SS_DEFAULT_ADMIN_USERNAME}
    ENV SS_DEFAULT_ADMIN_PASSWORD=${SS_DEFAULT_ADMIN_PASSWORD}
    ENV SS_ENVIRONMENT_TYPE="live"
    EXPOSE 80
    CMD ["apache2-foreground"]

    Create Apache Configuration

    Create a .htaccess file if not already present in your project root:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/resources
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* index.php [L]
    </IfModule>

    Push Your Repository to GitHub

    Commit and push all files to your GitHub repository.

    Create a Database

    Set up a MySQL or PostgreSQL database for SilverStripe. Note down the connection details.

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project.

    Create a New App

    Within your project, create a new app and connect your GitHub repository.

    Configure Environment Variables

    Add the following environment variables:

    VariableValue
    SS_DATABASE_SERVERYour database host
    SS_DATABASE_NAMEYour database name
    SS_DATABASE_USERNAMEYour database username
    SS_DATABASE_PASSWORDYour database password
    SS_DEFAULT_ADMIN_USERNAMEInitial admin username
    SS_DEFAULT_ADMIN_PASSWORDInitial admin password

    Configure HTTP Settings

    Set the traffic type to HTTP and configure the internal port to 80.

    Attach Persistent Storage

    Add persistent volumes:

    Mount PathRecommended SizePurpose
    /var/www/html/public/assets10 GB+Uploaded files and images
    /var/www/html/silverstripe-cache1 GBApplication cache

    Deploy Your Application

    Click Deploy to start the build process.

    Run Database Build

    After the first deployment, access the dev/build URL to initialize the database: https://your-app.klutch.sh/dev/build

    Access Your CMS

    Navigate to https://your-app.klutch.sh/admin and log in with your admin credentials.

Configuring SilverStripe

After deployment, configure your site through the CMS:

  1. Site Settings: Configure your site name, tagline, and contact information
  2. Theme: Apply and customize your chosen theme
  3. Pages: Create your site structure and content
  4. Users: Set up additional CMS users with appropriate permissions

Additional Resources

Conclusion

Deploying SilverStripe on Klutch.sh gives you a powerful, flexible CMS with automatic builds and persistent storage. Whether you’re building a simple brochure site or a complex web application, SilverStripe’s combination of intuitive editing and powerful development capabilities provides the tools you need.

With Klutch.sh handling infrastructure, you can focus on creating great content and building custom functionality for your specific needs.