Repository navigation
WP Complete Example
This guide demonstrates how to create a complete WordPress + MySQL application using Timonel's umbrella chart functionality. The example shows the proper way to build, configure, and deploy a multi-service application with Helm chart generation.
- Overview
- Prerequisites
- Project Setup
- Creating the MySQL Subchart
- Creating the WordPress Subchart
- Configuring the Umbrella Chart
- Verification and Testing
- Deployment
- Lessons Learned
This example demonstrates how to create a complete WordPress + MySQL application using Timonel's umbrella chart functionality. The final result includes:
- A MySQL database subchart with persistent storage
- A WordPress application subchart with Ingress configuration
- Proper Helm chart generation with all necessary templates
- Full compatibility with Helm deployment tools
Before starting, ensure you have:
- Node.js (v18 or later)
- npm or pnpm package manager
- Helm CLI (v3.x)
- Kubernetes cluster (optional, for actual deployment)
- Timonel CLI installed globally
npm install -g timonelCreate a new umbrella chart in the examples directory:
cd examples
npx timonel umbrella init wordpress-mysql-complete
cd wordpress-mysql-completeThis creates the basic structure with umbrella.ts and umbrella.config.json files.
npx timonel umbrella add mysqlEdit charts/mysql/chart.ts:
import { App } from 'cdk8s';
import { Subchart } from 'timonel';
export function createChart(): Subchart {
const app = new App();
return new Subchart(app, 'mysql', {
name: 'mysql',
appName: 'mysql',
image: 'mysql:8.0',
port: 3306,
serviceType: 'ClusterIP',
enableIngress: false,
env: {
MYSQL_ROOT_PASSWORD: 'rootpassword',
MYSQL_DATABASE: 'wordpress',
MYSQL_USER: 'wordpress',
MYSQL_PASSWORD: 'wordpress'
},
persistentVolume: {
enabled: true,
size: '10Gi',
mountPath: '/var/lib/mysql'
}
});
}
export default createChart;npx timonel umbrella add wordpressEdit charts/wordpress/chart.ts:
import { App } from 'cdk8s';
import { Subchart } from 'timonel';
export function createChart(): Subchart {
const app = new App();
return new Subchart(app, 'wordpress', {
name: 'wordpress',
appName: 'wordpress',
image: 'wordpress:latest',
port: 80,
replicas: 1,
serviceType: 'LoadBalancer',
enableIngress: true,
ingressHost: 'wordpress.local',
env: {
WORDPRESS_DB_HOST: 'mysql:3306',
WORDPRESS_DB_NAME: 'wordpress',
WORDPRESS_DB_USER: 'wordpress',
WORDPRESS_DB_PASSWORD: 'wordpress'
},
persistentVolume: {
enabled: true,
size: '5Gi',
mountPath: '/var/www/html'
}
});
}
export default createChart;Edit umbrella.ts to include the critical synthesis calls:
import { App, YamlOutputType } from 'cdk8s';
import { UmbrellaChart } from 'timonel';
import mysql from './charts/mysql/chart';
import wordpress from './charts/wordpress/chart';
export function synth(outDir: string) {
const app = new App({
outdir: outDir,
outputFileExtension: '.yaml',
yamlOutputType: YamlOutputType.FILE_PER_RESOURCE
});
const chart = new UmbrellaChart(app, 'wordpress-mysql-complete', {
name: 'wordpress-mysql-complete',
version: '0.1.0',
description: 'wordpress-mysql-complete umbrella chart',
services: [],
subcharts: [
{ name: 'mysql', chart: mysql },
{ name: 'wordpress', chart: wordpress }
]
});
// CRITICAL: Generate Helm chart files
chart.writeHelmChart(outDir);
// CRITICAL: Generate CDK8s YAML files
app.synth();
}
// Auto-execute when run directly
if (import.meta.url === new URL(import.meta.url).href) {
synth(process.argv[2] || 'dist');
}
export default synth;npx timonel umbrella synthCheck the generated files:
tree dist/You should see a complete Helm chart structure with:
- Main umbrella chart files (
Chart.yaml,values.yaml) - MySQL subchart in
charts/mysql/with templates and values - WordPress subchart in
charts/wordpress/with templates and values - Proper Ingress template in WordPress subchart
helm install wordpress-mysql-test ./dist --dry-run --debughelm template wordpress-mysql ./distIf you have a Kubernetes cluster:
# Helm creates the namespace automatically with --create-namespace
helm install wordpress-mysql ./dist -n wordpress-mysql --create-namespace
kubectl get all -n wordpress-mysqlThe umbrella chart must include both:
-
chart.writeHelmChart(outDir)- generates Helm chart files -
app.synth()- synthesizes the CDK8s application
Error encountered: Initially forgot these calls, resulting in incomplete chart generation.
Timonel automatically generates complete ingress structures with:
- Basic properties (
enableIngress,ingressHost) - Advanced configuration (
annotations,className,hosts,tls) - Proper Helm templating with conditional rendering
Error encountered: Manual defaultValues modifications in subcharts were unnecessary and caused
conflicts.
Each subchart operates independently but integrates seamlessly through the umbrella chart's coordination.
Generated templates are fully Helm-compatible and follow Kubernetes best practices for production deployments.
Key Success: The final implementation generates production-ready Helm charts that pass
helm install --dry-run and deploy successfully to Kubernetes clusters.
This example demonstrates how to create a production-ready WordPress + MySQL Helm chart using Timonel. The key is following the proper synthesis workflow and using Timonel's built-in configurations.
Result: A complete, deployable Helm chart that follows Kubernetes best practices, generated entirely through Timonel's declarative approach.
Timonel documentation · Repository · npm · Issues