### Local Rulebricks chart overlay and helm install Source: https://rulebricks.com/docs/private-deployment/authentication/token-passthrough Create a values-local.yaml overlay for a local Rulebricks chart install pointing at a local Supabase stack, then install or upgrade the chart with that overlay. The overlay sets the domain, admin email, Supabase URL and keys, enables external auth with the X-Auth-Token header, and disables the bundled Supabase. The helm command installs the chart into the rulebricks namespace using the overlay file. ```yaml global: domain: 'localhost' email: 'admin@test.local' supabase: url: 'http://127.0.0.1:54321' anonKey: '' serviceKey: '' jwtSecret: '' externalAuth: enabled: true header: 'X-Auth-Token' supabase: enabled: false ``` ```bash helm upgrade --install rulebricks oci://ghcr.io/rulebricks/helm/stack \ --namespace rulebricks --create-namespace \ -f values-local.yaml ``` -------------------------------- ### Install Rulebricks with external-dns and TLS Source: https://rulebricks.com/docs/private-deployment/quick-start Single-phase installation with external-dns for automated DNS on AWS, GCP, or Azure. Enables external-dns and TLS in one command. ```bash helm install rulebricks oci://ghcr.io/rulebricks/helm/stack \ --namespace rulebricks \ --create-namespace \ -f your-values.yaml \ --set external-dns.enabled=true \ --set global.externalDnsEnabled=true \ --set global.tlsEnabled=true ``` -------------------------------- ### Install Rulebricks CLI via npm Source: https://rulebricks.com/docs/private-deployment/cli Install the Rulebricks CLI globally using npm. Requires Node.js >= 18. ```bash npm install -g @rulebricks/cli ``` -------------------------------- ### Have/Need response example Source: https://rulebricks.com/docs/contexts/key-concepts/live-contexts Example API response showing the have/need pattern. The status is 'pending' until the 'need' array is empty, then it becomes 'complete'. Use this to show progress, decide what to fetch next, or debug rule execution. ```json { "status": "pending", "have": ["application_id", "credit_score", "annual_income"], "need": ["employment_verified"], "expires_at": "2024-01-22T10:30:00Z" } ``` -------------------------------- ### Install and upgrade Rulebricks Helm chart Source: https://rulebricks.com/docs/private-deployment/quick-start Install the Rulebricks Helm chart with a custom values file, then enable TLS after DNS is configured. Requires Kubernetes 1.29+, Helm 3.2.0+, and kubectl configured for the cluster. ```bash # 1. Create your values file # 2. Install the chart helm install rulebricks oci://ghcr.io/rulebricks/helm/stack \ --namespace rulebricks \ --create-namespace \ -f your-values.yaml # 3. Follow the on-screen instructions for DNS setup # 4. Enable TLS once DNS is configured helm upgrade rulebricks oci://ghcr.io/rulebricks/helm/stack \ --namespace rulebricks \ --reuse-values \ --set global.tlsEnabled=true ``` -------------------------------- ### Request Schema Configuration Source: https://rulebricks.com/docs/getting-started/start-building Example JSON structure for defining the input fields of a pricing rule. ```json { "price": 40, "date_purchased": "2024-01-15T10:30:00Z", "gift": false } ``` -------------------------------- ### DDQL Search Examples Source: https://rulebricks.com/docs/managing-rules/rule-logging Basic examples of using DDQL to filter rule execution logs based on request or response data. ```text credit_score >= 700 AND approval_decision = "denied" customer_id = "CUST-12345" amount > 10000 AND risk_score < 0.2 tier:gold OR tier:platinum ``` -------------------------------- ### Configure Generic OTLP Tracing Source: https://rulebricks.com/docs/private-deployment/tracing Example configuration for a generic OTLP backend using bearer token authentication from an existing secret. ```yaml # Generic OTLP backend global: tracing: enabled: true destination: "otlp" otlp: endpoint: "https://otlp-gateway.example.com/otlp" authMode: "bearer" existingSecret: name: "otlp-creds" tokenKey: "token" ``` -------------------------------- ### Catch-All Blocking Example Source: https://rulebricks.com/docs/warnings/warning-types Demonstrates a catch-all row blocking subsequent rows and the fix by moving the catch-all to the bottom. ```text Row 1: If tier = "gold" → Discount 20% Row 2: If any → Discount 0% ← Catch-all Row 3: If tier = "platinum" → Discount 30% ← Never reached! ``` ```text Row 1: If tier = "gold" → Discount 20% Row 2: If tier = "platinum" → Discount 30% Row 3: If any → Discount 0% ← Now at the bottom ``` -------------------------------- ### Response Schema Configuration Source: https://rulebricks.com/docs/getting-started/start-building Example JSON structure for defining the output result of a rule. ```json { "result": true } ``` -------------------------------- ### Configure Managed Supabase Cloud Source: https://rulebricks.com/docs/private-deployment/configuration-reference Example configuration for using Supabase Cloud instead of a self-hosted instance, including disabling the local Supabase service. ```yaml global: supabase: url: 'https://abcd1234.supabase.co' anonKey: '' serviceKey: '' accessToken: '' supabase: enabled: false # Disable self-hosted Supabase ``` -------------------------------- ### Example HTTP Request with Token Source: https://rulebricks.com/docs/private-deployment/authentication/token-passthrough An example of an HTTP GET request including the JWT in a custom header. The header name is configurable via 'global.externalAuth.header'. ```http GET /dashboard HTTP/1.1 Host: rulebricks.internal X-Auth-Token: eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJzdWIiOiJleHQtdXNlci1mM2EyIiwiZW1haWwiOiJhbGljZUBhY21lLmNvbSIsIm5hbWUiOiJBbGljZSBMaW0ifQ. ``` -------------------------------- ### Rulebricks CLI Quick Start: init and deploy Source: https://rulebricks.com/docs/private-deployment/cli Run the configuration wizard to generate values.yaml, then deploy to your cluster. The generated Helm values pin a single product version under global.version, selecting app, HPS, and HPS worker images together. ```bash # Configuration wizard (generates values.yaml) rulebricks init # Deploy to your cluster rulebricks deploy my-deployment ``` -------------------------------- ### Set up AWS cluster with CloudFormation Source: https://rulebricks.com/docs/private-deployment/cli Creates an EKS cluster, node group, S3 bucket, and monitoring resources using a CloudFormation template. Includes optional prereq check, stack creation, wait, and kubeconfig update. ```bash cd cluster-setup/aws # Optional access check AWS_REGION=us-east-1 bash check-aws-prereqs.sh # Create the stack (named IAM roles require the capability flag) aws cloudformation create-stack \ --stack-name rulebricks-cluster \ --region us-east-1 \ --template-body file://rulebricks-cluster.cfn.yaml \ --parameters file://parameters.json \ --capabilities CAPABILITY_NAMED_IAM aws cloudformation wait stack-create-complete \ --stack-name rulebricks-cluster --region us-east-1 aws eks update-kubeconfig --name rulebricks-cluster --region us-east-1 ``` -------------------------------- ### Text Data Type Examples Source: https://rulebricks.com/docs/getting-started/start-building Examples of string values used in Rulebricks text fields. ```text 'Hello, world!' 'approved' ``` -------------------------------- ### Good example: Server-side token generation Source: https://rulebricks.com/docs/embedding-rulebricks/core-concepts-and-security Shows the recommended pattern of generating an embed token on the server using the API key from an environment variable, keeping the key secret. ```javascript // Server-side createEmbedToken({ apiKey: process.env.RULEBRICKS_API_KEY, ... }) ``` -------------------------------- ### Install @rulebricks/embedded package Source: https://rulebricks.com/docs/embedding-rulebricks/installation-and-setup Install the package using npm, yarn, or pnpm. Requires React 18+. ```bash npm install @rulebricks/embedded # or yarn add @rulebricks/embedded # or pnpm add @rulebricks/embedded ``` -------------------------------- ### Derived Fact Expression Examples Source: https://rulebricks.com/docs/contexts/key-concepts/facts-and-schema Examples of expressions for calculating ratios, categorizing risk, and aggregating data from relationships. ```javascript // Debt-to-income ratio monthly_debt / (annual_income / 12) // Risk category based on score ifelse( credit_score >= 750, 'low', ifelse(credit_score >= 650, 'medium', 'high') ) // Aggregate from the configured "transactions" relationship sum($transactions, 'total') // The equivalent namespaced relationship form is also supported sum($relations.transactions, 'total') ``` -------------------------------- ### Execute Rules with Upfront Data Source: https://rulebricks.com/docs/contexts Demonstrates the alternative approach of executing rules when all data is available immediately. ```http // Assumes we have all the data upfront POST /api/v1/solve/approval-rule { "credit_score": 720, "annual_income": 120000, "employment_verified": true } // Manual write-back/result storage // ... ``` -------------------------------- ### Global domain and email configuration (rulebricks.acme.com example) Source: https://rulebricks.com/docs/private-deployment/configuration-reference Sets the instance domain to 'rulebricks.acme.com' and the Let's Encrypt email. The domain must resolve to the cluster's load balancer before TLS is enabled. ```yaml global: domain: 'rulebricks.acme.com' email: 'devops@acme.com' ``` -------------------------------- ### Result Object JSON example Source: https://rulebricks.com/docs/getting-started/requests-and-responses Example of a Result Object in JSON notation, which is the output of a rule. It contains a single field 'score' with a value of 90. ```json { "score": 90 } ``` -------------------------------- ### Request Object JSON example Source: https://rulebricks.com/docs/getting-started/requests-and-responses Example of a Request Object in JSON notation, used as input to a rule. It contains fields like industry, company_size, location, and date_form_completed. ```json { "industry": "Financial technology", "company_size": 4400, "location": { "city": "San Francisco", "state": "California", "country": "United States" }, "date_form_completed": "2022-11-23" } ``` -------------------------------- ### Plain JSON object example Source: https://rulebricks.com/docs/objects A plain JSON object example for field suggestions without full validation. Rulebricks automatically detects whether you're using a JSON Schema or a plain JSON object. ```json { "customer_id": "cust_12345", "order_total": 299.99, "is_priority": true } ``` -------------------------------- ### Sync a collection with the rulebricks CLI Source: https://rulebricks.com/docs/advanced-features/values-and-functions CLI wrapper for the sync endpoint, including automatic chunking. Uses the same collection and API key as the REST example. ```bash rulebricks values sync medical-codes.json --collection "Medical Codes" \ --url https://rulebricks.example.com --api-key $RULEBRICKS_API_KEY ``` -------------------------------- ### Inconsistent JSON object examples Source: https://rulebricks.com/docs/objects Two example JSON objects showing inconsistent field naming across rules. The first uses snake_case (customer_id, order_total, is_priority), the second uses camelCase (customerId, total, priority). Using Objects ensures consistent field names across rules. ```json { "customer_id": "cust_12345", "order_total": 299.99, "is_priority": true } ``` ```json { "customerId": "cust_12345", "total": 299.99, "priority": true } ``` -------------------------------- ### Configure Kafka Topics Source: https://rulebricks.com/docs/private-deployment/configuration-reference Example configuration for defining Kafka topics, including partitions, replicas, and retention settings. This structure is used by the Strimzi Topic Operator or the external provisioning hook. ```yaml kafka: topics: - name: com.rulebricks.solution partitions: 128 replicas: 1 config: retention.ms: '300000' retention.bytes: '134217728' max.message.bytes: '33554432' # ... see the chart's values.yaml for the full default topic list ``` -------------------------------- ### Coverage Gap Example Source: https://rulebricks.com/docs/warnings/warning-types Displays a range of values that are not explicitly handled by the existing rules. ```text Row 1: If age < 18 → Minor rate Row 2: If age > 65 → Senior rate ← Gap: Ages 18-65 have no explicit handling ```