frappe-operator

Frappe Operator Examples

This directory contains example manifests for deploying Frappe using the operator with MariaDB Operator integration.

Prerequisites

1. Install MariaDB Operator

The Frappe Operator uses MariaDB Operator for secure database provisioning:

# Install MariaDB Operator CRDs
kubectl apply -f https://github.com/mariadb-operator/mariadb-operator/releases/latest/download/crds.yaml

# Install MariaDB Operator
kubectl apply -f https://github.com/mariadb-operator/mariadb-operator/releases/latest/download/mariadb-operator.yaml

2. Install Frappe Operator

kubectl apply -f https://github.com/vyogotech/frappe-operator/releases/latest/download/install.yaml

Quick Start

# Step 1: Create shared MariaDB instance (one time)
kubectl apply -f mariadb-shared-instance.yaml

# Wait for MariaDB to be ready
kubectl wait --for=condition=Ready mariadb/frappe-mariadb --timeout=300s

# Step 2: Create a bench
kubectl apply -f basic-bench.yaml

# Wait for bench to be ready
kubectl wait --for=condition=Ready frappebench/dev-bench --timeout=300s

# Step 3: Create a site
kubectl apply -f basic-site.yaml

# Wait for site database to be provisioned
kubectl wait --for=condition=Ready database/dev-site-db --timeout=120s

# Wait for site to be ready
kubectl wait --for=condition=Ready frappesite/dev-site --timeout=300s

# Get auto-generated admin password
kubectl get secret dev-site-admin -o jsonpath='{.data.password}' | base64 -d

2. Dedicated MariaDB per Site (Enterprise/Isolated)

# Create bench (if not already created)
kubectl apply -f basic-bench.yaml

# Create site with dedicated MariaDB
kubectl apply -f site-dedicated-mariadb.yaml

# The operator automatically creates:
# - Dedicated MariaDB instance
# - Database and user
# - All necessary credentials

3. Production Deployment

# Step 1: Deploy shared MariaDB with HA
kubectl apply -f mariadb-shared-instance.yaml

# Step 2: Deploy sites with TLS
kubectl apply -f site-shared-mariadb.yaml

Examples

Infrastructure

Basic Examples

Database Modes

Advanced Examples

Legacy Examples (for reference)

Configuration Options

FrappeBench

Key configuration options:

FrappeSite

Key configuration options:

For details on app installation, see Site App Installation Guide.

Best Practices

Development

Production

Troubleshooting

Check Bench Status

kubectl get frappebench -A
kubectl describe frappebench <name>

Check Site Status

kubectl get frappesite -A
kubectl describe frappesite <name>

Check Logs

# Operator logs
kubectl logs -n frappe-operator-system deployment/frappe-operator-controller-manager -c manager

# Site init job logs
kubectl logs job/<site-name>-init

# Application logs
kubectl logs deployment/<bench-name>-gunicorn

# Worker autoscaling logs
kubectl logs deployment/<bench-name>-worker-short
kubectl logs deployment/<bench-name>-worker-long

Check Worker Autoscaling

# Check ScaledObjects (KEDA)
kubectl get scaledobjects

# Check component scaling status
kubectl get frappebench <bench-name> -o jsonpath='{.status.componentScaling}' | jq

# Check HPA created by KEDA
kubectl get hpa

# Check queue length
kubectl exec deployment/<bench-name>-redis-queue -- redis-cli LLEN "rq:queue:short"

Common Issues

  1. Site stuck in Provisioning
    • Check init job: kubectl get job <site-name>-init
    • Check job logs: kubectl logs job/<site-name>-init
  2. Database connection errors
    • Verify database secret exists
    • Check credentials in secret
    • Verify database is accessible
  3. Storage issues
    • Check PVC status: kubectl get pvc
    • Verify storage class supports required access mode
    • Check storage class: kubectl get storageclass

More Information