From 7163a12b970740fe9a80b8c0d715dff30b0b71c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 11:34:34 +0000 Subject: [PATCH 1/4] Initial plan From 1502b669cf7b235895d55ac0710fa1135c973bcf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 11:38:19 +0000 Subject: [PATCH 2/4] Add comprehensive documentation about external Redis and MariaDB support Co-authored-by: varun-krishnamurthy <128337350+varun-krishnamurthy@users.noreply.github.com> --- docs/examples.md | 141 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/docs/examples.md b/docs/examples.md index d6345546..0e76d005 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -11,6 +11,7 @@ Real-world deployment patterns and configuration examples for Frappe Operator. - [Production Deployment](#production-deployment) - [Multi-Tenant SaaS](#multi-tenant-saas) - [Enterprise Setup](#enterprise-setup) +- [External Database and Redis](#external-database-and-redis) **📊 Support Status** - [Custom Domains](#custom-domains) - [High Availability](#high-availability) - [Worker Autoscaling](#worker-autoscaling) **⚡ NEW** @@ -423,6 +424,146 @@ stringData: --- +## External Database and Redis + +### Support Status and Configuration + +The Frappe Operator provides varying levels of support for external databases and Redis instances. + +#### External MariaDB/MySQL Support + +**Status:** ✅ **SUPPORTED** (v1.0.0+) + +The operator supports connecting to external MariaDB or MySQL databases (e.g., AWS RDS, Azure Database for MySQL, Google Cloud SQL). + +**Configuration Example:** + +```yaml +--- +apiVersion: vyogo.tech/v1alpha1 +kind: FrappeSite +metadata: + name: external-db-site + namespace: production +spec: + benchRef: + name: prod-bench + siteName: "erp.example.com" + + dbConfig: + mode: external # Use external database + connectionSecretRef: + name: external-db-credentials + +--- +# External database credentials secret +apiVersion: v1 +kind: Secret +metadata: + name: external-db-credentials + namespace: production +type: Opaque +stringData: + host: "mysql.rds.amazonaws.com" # Database hostname + port: "3306" # Database port + database: "erp_production" # Database name + username: "frappe_user" # Database user + password: "your-secure-password-here" # Database password +``` + +**Use Cases:** +- ✅ AWS RDS for MariaDB/MySQL +- ✅ Azure Database for MySQL +- ✅ Google Cloud SQL for MySQL +- ✅ Self-managed external MariaDB/MySQL instances +- ✅ High-availability managed database services + +**Requirements:** +- The external database must be accessible from the Kubernetes cluster +- The database user must have permissions to create and manage databases +- Network connectivity must be properly configured (security groups, firewall rules) + +**Notes:** +- The operator will use the provided database connection details +- Database provisioning (creating database, user, grants) must be handled externally +- The site will connect directly to the external database instance + +--- + +#### External Redis Support + +**Status:** ⚠️ **PLANNED** (Not Yet Implemented) + +External Redis support is defined in the API but **not yet implemented** in the current version (v1.0.0). + +**API Definition (Available but not functional):** + +```yaml +# This configuration is defined in the API but NOT yet implemented +apiVersion: vyogo.tech/v1alpha1 +kind: FrappeBench +metadata: + name: external-redis-bench +spec: + frappeVersion: "version-15" + apps: + - name: erpnext + source: image + + redisConfig: + type: redis + # ConnectionSecretRef is defined but not yet implemented + connectionSecretRef: + name: external-redis-credentials # ⚠️ Not yet functional +``` + +**Current Status:** +- ❌ The `ConnectionSecretRef` field exists in the API (`api/v1alpha1/shared_types.go:240`) +- ❌ Implementation is marked as TODO in the codebase (`controllers/frappebench_resources.go:1504`) +- ❌ The operator currently only supports **in-cluster Redis** deployments +- ✅ In-cluster Redis (managed by operator) works perfectly + +**Current Behavior:** +The operator automatically deploys Redis instances within the cluster for: +- **Redis Cache** - Session storage and caching +- **Redis Queue** - Background job queue management + +You can configure the in-cluster Redis with: +```yaml +redisConfig: + type: redis # or 'dragonfly' for better performance + maxMemory: "4gb" # Memory limit + storageSize: "10Gi" # Persistent storage size + resources: + requests: + cpu: "500m" + memory: "4Gi" +``` + +**Roadmap:** +External Redis support is planned for a future release (v1.1+). When implemented, it will support: +- AWS ElastiCache for Redis +- Azure Cache for Redis +- Google Cloud Memorystore +- Self-managed external Redis instances + +--- + +#### Summary Table + +| Feature | Status | Version | Use Cases | +|---------|--------|---------|-----------| +| **External MariaDB/MySQL** | ✅ Supported | v1.0.0+ | AWS RDS, Azure Database, Cloud SQL, Self-managed | +| **Shared MariaDB** | ✅ Supported | v1.0.0+ | Multi-tenant, cost-effective | +| **Dedicated MariaDB** | ✅ Supported | v1.0.0+ | Enterprise, isolated databases | +| **In-cluster Redis** | ✅ Supported | v1.0.0+ | Default deployment, fully managed | +| **In-cluster Dragonfly** | ✅ Supported | v1.0.0+ | High-performance alternative to Redis | +| **External Redis** | ⚠️ Planned | Future (v1.1+) | ElastiCache, Azure Cache, Memorystore | +| **PostgreSQL** | ⚠️ Planned | v1.1.0+ | PostgreSQL provider | +| **SQLite** | ✅ Supported | v1.0.0+ | Frappe v16+ sites | + +--- + ## Custom Domains ### Custom Domain per Site From 3a9c2f4d33c79b5055fdb34e1419b8405c9e1369 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 11:41:41 +0000 Subject: [PATCH 3/4] Clarify Redis is shared at bench level, not per-site; fix external DB status Co-authored-by: varun-krishnamurthy <128337350+varun-krishnamurthy@users.noreply.github.com> --- docs/examples.md | 135 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 106 insertions(+), 29 deletions(-) diff --git a/docs/examples.md b/docs/examples.md index 0e76d005..46cde59e 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -432,13 +432,14 @@ The Frappe Operator provides varying levels of support for external databases an #### External MariaDB/MySQL Support -**Status:** ✅ **SUPPORTED** (v1.0.0+) +**Status:** ⚠️ **NOT YET IMPLEMENTED** (Planned) -The operator supports connecting to external MariaDB or MySQL databases (e.g., AWS RDS, Azure Database for MySQL, Google Cloud SQL). +External database support is documented in the API and examples but **not yet fully implemented** in the current version (v1.0.0). -**Configuration Example:** +**API Definition (Available but not functional):** ```yaml +# This configuration is defined in the API but NOT fully implemented --- apiVersion: vyogo.tech/v1alpha1 kind: FrappeSite @@ -451,12 +452,12 @@ spec: siteName: "erp.example.com" dbConfig: - mode: external # Use external database + mode: external # ⚠️ Not yet implemented in MariaDBProvider connectionSecretRef: name: external-db-credentials --- -# External database credentials secret +# External database credentials secret format apiVersion: v1 kind: Secret metadata: @@ -471,22 +472,57 @@ stringData: password: "your-secure-password-here" # Database password ``` -**Use Cases:** -- ✅ AWS RDS for MariaDB/MySQL -- ✅ Azure Database for MySQL -- ✅ Google Cloud SQL for MySQL -- ✅ Self-managed external MariaDB/MySQL instances -- ✅ High-availability managed database services +**Current Status:** +- ❌ The `mode: external` option is defined in the CRD but returns "unsupported database mode" error +- ❌ The MariaDBProvider (`controllers/database/mariadb_provider.go:270-277`) only handles `shared` and `dedicated` modes +- ❌ ConnectionSecretRef field exists but is not used in the implementation +- ✅ **Workaround:** Use MariaDB Operator CRs to reference external databases (see below) + +**Current Workaround - Using MariaDB Operator with External Database:** + +You can reference an external database by creating MariaDB Operator custom resources that point to your external instance: + +```yaml +--- +# Create a MariaDB CR that points to external database +apiVersion: k8s.mariadb.com/v1alpha1 +kind: MariaDB +metadata: + name: external-mariadb + namespace: production +spec: + # Configure this to point to your external MariaDB instance + # (Requires MariaDB Operator configuration for external databases) + # See: https://github.com/mariadb-operator/mariadb-operator + +--- +# Reference it in your FrappeSite +apiVersion: vyogo.tech/v1alpha1 +kind: FrappeSite +metadata: + name: mysite + namespace: production +spec: + benchRef: + name: prod-bench + siteName: "erp.example.com" + + dbConfig: + mode: shared # Use shared mode with mariadbRef + mariadbRef: + name: external-mariadb # Reference your external DB + namespace: production +``` -**Requirements:** -- The external database must be accessible from the Kubernetes cluster -- The database user must have permissions to create and manage databases -- Network connectivity must be properly configured (security groups, firewall rules) +**Planned Use Cases (Future Release):** +- AWS RDS for MariaDB/MySQL +- Azure Database for MySQL +- Google Cloud SQL for MySQL +- Self-managed external MariaDB/MySQL instances +- High-availability managed database services -**Notes:** -- The operator will use the provided database connection details -- Database provisioning (creating database, user, grants) must be handled externally -- The site will connect directly to the external database instance +**Roadmap:** +Direct external database support (with `mode: external`) is planned for a future release (v1.1+). --- @@ -549,18 +585,59 @@ External Redis support is planned for a future release (v1.1+). When implemented --- +#### Redis Architecture and Data Isolation + +**Important:** Redis is **shared at the bench level**, not isolated per site. + +**How it Works:** +- Each `FrappeBench` creates **two Redis instances**: + - `{bench-name}-redis-cache` - For session storage and caching + - `{bench-name}-redis-queue` - For background job queues +- **All sites on the same bench share these Redis instances** +- Sites use the default Redis database (db 0) - no database number isolation +- Data isolation is handled by **Frappe's key prefixes**, not separate Redis databases + +**Example Architecture:** +``` +FrappeBench: saas-bench +├── Redis Cache (shared) +│ └── All sites: customer1, customer2, customer3 +├── Redis Queue (shared) +│ └── All sites: customer1, customer2, customer3 +└── MariaDB + ├── Database: customer1_db (isolated) + ├── Database: customer2_db (isolated) + └── Database: customer3_db (isolated) +``` + +**Key Points:** +- ✅ **Database:** Each site gets its own isolated MariaDB database +- ⚠️ **Redis:** All sites on the same bench share Redis (namespaced by keys) +- 💡 **Best Practice:** For complete isolation, use dedicated benches per customer/site + +**Site Configuration Generated:** +```json +{ + "host_name": "customer1.example.com", + "redis_cache": "redis://saas-bench-redis-cache:6379", + "redis_queue": "redis://saas-bench-redis-queue:6379" +} +``` + +--- + #### Summary Table -| Feature | Status | Version | Use Cases | -|---------|--------|---------|-----------| -| **External MariaDB/MySQL** | ✅ Supported | v1.0.0+ | AWS RDS, Azure Database, Cloud SQL, Self-managed | -| **Shared MariaDB** | ✅ Supported | v1.0.0+ | Multi-tenant, cost-effective | -| **Dedicated MariaDB** | ✅ Supported | v1.0.0+ | Enterprise, isolated databases | -| **In-cluster Redis** | ✅ Supported | v1.0.0+ | Default deployment, fully managed | -| **In-cluster Dragonfly** | ✅ Supported | v1.0.0+ | High-performance alternative to Redis | -| **External Redis** | ⚠️ Planned | Future (v1.1+) | ElastiCache, Azure Cache, Memorystore | -| **PostgreSQL** | ⚠️ Planned | v1.1.0+ | PostgreSQL provider | -| **SQLite** | ✅ Supported | v1.0.0+ | Frappe v16+ sites | +| Feature | Status | Version | Isolation Level | Use Cases | +|---------|--------|---------|----------------|-----------| +| **External MariaDB/MySQL** | ⚠️ Planned | v1.1+ | Per-site (with workaround) | AWS RDS, Azure Database, Cloud SQL | +| **Shared MariaDB** | ✅ Supported | v1.0.0+ | Per-site database | Multi-tenant, cost-effective | +| **Dedicated MariaDB** | ✅ Supported | v1.0.0+ | Per-site instance | Enterprise, isolated databases | +| **In-cluster Redis** | ✅ Supported | v1.0.0+ | **Bench-level (shared)** | Default deployment, fully managed | +| **In-cluster Dragonfly** | ✅ Supported | v1.0.0+ | **Bench-level (shared)** | High-performance alternative | +| **External Redis** | ⚠️ Planned | v1.1+ | TBD | ElastiCache, Azure Cache, Memorystore | +| **PostgreSQL** | ⚠️ Planned | v1.1.0+ | Per-site database | PostgreSQL provider | +| **SQLite** | ✅ Supported | v1.0.0+ | Per-site file | Frappe v16+ sites | --- From 39a7cca5352ab0c810d0962ffe95a1a6ad1fc3c9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 12 Jan 2026 11:42:37 +0000 Subject: [PATCH 4/4] Fix status label consistency across document Co-authored-by: varun-krishnamurthy <128337350+varun-krishnamurthy@users.noreply.github.com> --- docs/examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples.md b/docs/examples.md index 46cde59e..c5995496 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -432,7 +432,7 @@ The Frappe Operator provides varying levels of support for external databases an #### External MariaDB/MySQL Support -**Status:** ⚠️ **NOT YET IMPLEMENTED** (Planned) +**Status:** ⚠️ **PLANNED** (Not Yet Implemented) External database support is documented in the API and examples but **not yet fully implemented** in the current version (v1.0.0).