Skip to content

DisplaceTech/displace-template-wordpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Displace WordPress Template

A production-ready WordPress deployment template for Kubernetes, designed for use with the Displace CLI.

Overview

This template provides everything you need to deploy WordPress to Kubernetes with enterprise-grade features:

  • 🐘 WordPress - Latest Bitnami WordPress image with persistent storage
  • πŸ—„οΈ MariaDB - Database backend with persistent storage
  • ☸️ Kubernetes Manifests - Production-ready deployment without Helm complexity
  • πŸ”’ Automatic HTTPS - SSL certificates via cert-manager and Let's Encrypt
  • πŸ› οΈ Cross-platform Tooling - Makefile that works on Linux, macOS, and Windows
  • πŸ“Š Built-in Monitoring - Health checks, resource limits, and observability
  • πŸ” Security First - Secure credential management with git-safe templates

Template Structure

templates/
β”œβ”€β”€ .gitignore.tmpl                    # Git ignore file template
β”œβ”€β”€ .credentials.tmpl                  # Credential file template (git-ignored)
β”œβ”€β”€ Makefile.tmpl                      # Cross-platform commands
β”œβ”€β”€ README.md.tmpl                     # Project documentation template
β”œβ”€β”€ manifests/                         # Kubernetes manifests
β”‚   β”œβ”€β”€ 01-namespace.yaml.tmpl         # Namespace definition
β”‚   β”œβ”€β”€ 02-database-secret.yaml.tmpl   # Secret template (placeholders)
β”‚   β”œβ”€β”€ 03-mariadb.yaml.tmpl          # MariaDB deployment & service
β”‚   β”œβ”€β”€ 04-wordpress.yaml.tmpl        # WordPress deployment & service
β”‚   └── 05-ingress.yaml.tmpl          # Ingress configuration
└── secrets/                          # Secret overrides (git-ignored)
    └── database-secret-override.yaml.tmpl  # Real credentials

Quick Start

1. Initialize Your Project

# Initialize a new WordPress project
displace project init wordpress

# You'll be prompted for:
# - Project name (e.g., "my-blog")
# - Kubernetes namespace (defaults to project name)

2. Deploy to Kubernetes

cd my-blog

# Deploy everything with one command
make deploy

# Check status
make status

# View logs
make logs

3. Access WordPress

# Forward local port to WordPress service
make port-forward

# Then visit http://localhost:8080
# Admin panel: http://localhost:8080/wp-admin

Usage

This template is automatically downloaded and used by the Displace CLI when initializing WordPress projects:

displace project init wordpress

The CLI will:

  1. Download the latest template release
  2. Generate secure passwords
  3. Process templates with project-specific values
  4. Create all necessary files with proper security settings

Template Variables

Required Variables

Variable Description Sensitive
ProjectName Project identifier No
Namespace Kubernetes namespace No
DBRootPassword MariaDB root password Yes
DBPassword WordPress database password Yes
WordPressPassword WordPress admin password Yes

Optional Variables

Variable Default Description
ProjectDisplayName {{.ProjectName}} Human-readable name
WordPressReplicas 1 Number of WordPress replicas
WordPressStorageSize 10Gi WordPress PVC size
MariaDBStorageSize 8Gi MariaDB PVC size
IngressClass nginx Ingress controller class
CertIssuer letsencrypt-prod Cert-manager issuer

Available Commands

The generated Makefile includes comprehensive commands:

Deployment

Command Description
make deploy Deploy WordPress to Kubernetes
make destroy Remove deployment from cluster
make status Check deployment status

Monitoring

Command Description
make logs View WordPress application logs
make logs-db View MariaDB database logs
make events View recent Kubernetes events

Access

Command Description
make shell Access WordPress pod shell
make shell-db Access MariaDB pod shell
make mysql Connect to MySQL CLI
make port-forward Forward local port to WordPress
make open Open WordPress in browser

Database Management

Command Description
make backup-db Backup database to local file
make restore-db Restore database from backup
make backup-content Backup wp-content directory

Scaling & Utilities

Command Description
make scale REPLICAS=N Scale WordPress replicas
make validate Validate Kubernetes manifests
make info Display project information

Security Features

Git Safety

  • Automatic .gitignore generation protects sensitive files
  • Separate credential files (.credentials) automatically excluded from version control
  • Kubernetes secrets use placeholder values in main templates
  • Real credentials stored in git-ignored override files

Credential Management

  • Secure password generation with YAML-safe character sets
  • Environment variable format for easy shell integration
  • Clear separation between public manifests and private credentials

Docker Images

This template builds WordPress from source and uses the official MariaDB image:

  • WordPress: Custom build from Dockerfile (PHP {{PHPVersion}}, WordPress {{WordPressVersion}})
  • MariaDB: docker.io/library/mariadb:11.5

Troubleshooting

Common Issues

1. Pods Not Starting

make status
make events

2. Database Connection Issues

# Check MariaDB is running
make logs-db

# Test connection
make mysql

3. HTTPS Certificate Issues

kubectl get certificates -n [namespace]
kubectl logs -n cert-manager deployment/cert-manager

Attribution

This template was originally inspired by the Bitnami WordPress Helm chart and has since been rewritten to use official upstream images and a build-from-source approach.

This template provides a simplified, security-focused WordPress deployment optimized for the Displace CLI workflow.

License

Copyright 2025 Displace Technologies

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About Displace Technologies

Displace Technologies - Making Kubernetes deployment simple and reliable.

About

Displace CLI project template for WordPress websites.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors