### Install and Start React App Frontend Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/install-sample-applications/curbside-pickup/_index.md Install frontend dependencies and start the React development server. This command should be executed from the `/apps/curbside-pickup/app` folder. The frontend will then be accessible at http://localhost:3000. ```bash npm install npm start ``` -------------------------------- ### Complete Drasi Installation Workflow with Manifests Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/installation/install-using-manifests/_index.md A comprehensive example demonstrating the full workflow of installing Drasi using manifests, from generation to verification. ```bash # 1. Generate manifests in a specific directory mkdir drasi-manifests drasi init --manifest ./drasi-manifests # 2. Review the generated manifests (optional) ls drasi-manifests/ # kubernetes-resources.yaml # drasi-resources.yaml # 3. Apply infrastructure manifest kubectl apply -f drasi-manifests/kubernetes-resources.yaml # 4. Wait for infrastructure to be ready kubectl wait --for=condition=available --timeout=300s deployment/drasi-api -n drasi-system # 5. Configure Drasi CLI drasi env kube # 6. Apply Drasi resources drasi apply -f drasi-manifests/drasi-resources.yaml # 7. Verify installation drasi list querycontainer -n drasi-production ``` -------------------------------- ### Complete File Reaction Configuration Example Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-reactions/configure-file-reaction/_index.md This YAML configuration demonstrates a full setup for the file reaction, including source database connection, query definition, and detailed file output settings with custom templates for different data operations. ```yaml host: 0.0.0.0 port: 8080 logLevel: info sources: - kind: postgres id: orders-db host: ${DB_HOST} database: ecommerce user: ${DB_USER} password: ${DB_PASSWORD} tables: - public.orders queries: - id: all-orders query: | MATCH (o:orders) RETURN o.id, o.customer, o.total, o.status sources: - sourceId: orders-db reactions: - kind: file id: order-audit queries: [all-orders] outputPath: /data/audit writeMode: append filenameTemplate: "orders.ndjson" routes: all-orders: added: template: '{"ts":"{{timestamp}}","op":"add","id":"{{after.id}}","customer":"{{after.customer}}","total":{{after.total}}}' updated: template: '{"ts":"{{timestamp}}","op":"update","id":"{{after.id}}","status":"{{before.status}}->{{after.status}}"}' deleted: template: '{"ts":"{{timestamp}}","op":"delete","id":"{{before.id}}"}' ``` -------------------------------- ### Install Dependencies and Start Backend Functions App Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/install-sample-applications/building-comfort/_index.md Installs Node.js dependencies and starts the backend Functions App locally. The --javascript flag is used to specify the runtime. ```bash npm install npm start -- --javascript ``` -------------------------------- ### Run App Backend Functions Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/install-sample-applications/curbside-pickup/_index.md Start the Functions app after installing dependencies. This command initiates the backend services for the curbside pickup application. ```bash npm start ``` -------------------------------- ### Example server.yaml configuration Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-drasi-server/_index.md A basic example of a server.yaml file defining core server settings. ```yaml id: production-server host: 0.0.0.0 port: 8080 logLevel: info persistConfig: true persistIndex: true ``` -------------------------------- ### Drasi Installation Output Example Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/installation/install-on-kind/_index.md This is an example of the expected output upon a successful Drasi installation. It indicates the status of Dapr, infrastructure components, control plane, query containers, and default providers. ```text Installing Drasi with version 0.1.3 from registry ghcr.io ℹ Dapr not installed ✓ Dapr installed successfully ✓ Infrastructure deployed ✓ app=rg-redis is online ✓ app=rg-mongo is online ✓ Control plane is online ✓ drasi/infra=api is online ✓ drasi/infra=resource-provider is online ✓ Query container created ✓ Apply: QueryContainer/default: complete ✓ Wait QueryContainer/default online ✓ Default source providers created ✓ Apply: SourceProvider/PostgreSQL: complete ✓ Apply: SourceProvider/SQLServer: complete ✓ Apply: SourceProvider/CosmosGremlin: complete ✓ Default reaction providers created ✓ Apply: ReactionProvider/Debug: complete ✓ Apply: ReactionProvider/Debezium: complete ✓ Apply: ReactionProvider/EventGrid: complete ✓ Apply: ReactionProvider/Gremlin: complete ✓ Apply: ReactionProvider/Result: complete ✓ Apply: ReactionProvider/SignalR: complete ✓ Apply: ReactionProvider/StorageQueue: complete ✓ Apply: ReactionProvider/StoredProc: complete ``` -------------------------------- ### Install Debian/Ubuntu dependencies Source: https://github.com/drasi-project/docs/blob/main/docs/shared-content/installation/drasi-server/build-from-source-prereqs.md Install the necessary development libraries and compilers using apt-get. ```bash sudo apt-get install -y libssl-dev pkg-config clang libclang-dev libjq-dev libonig-dev protobuf-compiler ``` -------------------------------- ### Run Interactive Tutorial Setup Script (macOS/Linux) Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/building-comfort/_index.md Execute this script to automate the setup of the tutorial environment on macOS or Linux. It checks for prerequisites, deploys applications, and initializes Drasi. ```bash # Ensure that you are in the tutorial directory cd tutorial/building-comfort ./scripts/setup-tutorial.sh ``` -------------------------------- ### Run Interactive Tutorial Setup Script (Windows PowerShell) Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/building-comfort/_index.md Execute this PowerShell script to automate the setup of the tutorial environment on Windows. It checks for prerequisites, deploys applications, and initializes Drasi. ```powershell # Ensure that you are in the tutorial directory cd tutorial\building-comfort .\scripts\setup-tutorial.ps1 ``` -------------------------------- ### Install Drasi with Custom Settings Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/installation/install-on-aks/_index.md Install Drasi specifying a particular version and namespace. This example installs Drasi version 0.1.3 into the 'drasi-dev' namespace, overriding the default settings. ```text drasi init --version 0.1.3 -n drasi-dev ``` -------------------------------- ### Example: Create PostgreSQL Source Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/rest-api/_index.md Example using curl to create a PostgreSQL source. ```APIDOC ## Example: Create PostgreSQL Source ### Request Example (curl) ```bash curl -X POST http://localhost:8080/api/v1/sources \ -H "Content-Type: application/json" \ -d '{ "kind": "postgres", "id": "orders-db", "host": "localhost", "port": 5432, "database": "ecommerce", "user": "postgres", "password": "secret", "tables": ["public.orders"] }' ``` ``` -------------------------------- ### Run Drasi Tutorial Setup Script Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/drasi-for-dapr/_index.md Execute the setup script for the Dapr tutorial. Choose the appropriate script based on your operating system (Linux/Mac or Windows PowerShell). This script automates the setup of a k3d cluster, Drasi platform, Dapr, PostgreSQL, Redis, and deploys all necessary services. ```bash cd tutorial/dapr # For Linux/Mac ./scripts/setup-tutorial.sh # For Windows PowerShell ./scripts/setup-tutorial.ps1 ``` -------------------------------- ### Complete gRPC Reaction Configuration Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-reactions/configure-grpc-reaction/_index.md This example shows a full configuration for a gRPC reaction, including source definitions, query setup, and reaction parameters like endpoint, timeout, batching, and metadata. ```yaml host: 0.0.0.0 port: 8080 logLevel: info sources: - kind: postgres id: orders-db host: ${DB_HOST} database: ecommerce user: ${DB_USER} password: ${DB_PASSWORD} tables: - public.orders queries: - id: order-events query: "MATCH (o:orders) RETURN o.id, o.status, o.total" sources: - sourceId: orders-db reactions: - kind: grpc id: order-processor queries: [order-events] endpoint: ${GRPC_ENDPOINT:-grpc://localhost:50052} timeoutMs: 10000 batchSize: 50 batchFlushTimeoutMs: 1000 maxRetries: 5 metadata: authorization: Bearer ${API_TOKEN} ``` -------------------------------- ### Run Cleanup Script for Local Setup Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/drasi-for-dapr/_index.md Execute these scripts to clean up resources created during the tutorial setup. Ensure you are in the 'tutorial/dapr' directory before running. ```bash cd tutorial/dapr # Linux/Mac ./scripts/cleanup-tutorial.sh ``` ```powershell cd tutorial/dapr # Windows PowerShell ./scripts/cleanup-tutorial.ps1 ``` -------------------------------- ### Select Installed Bootstrap Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/create-config-with-wizard/_index.md Prompt to select the newly installed bootstrap plugin. ```text ? Select bootstraps (space to select, enter to confirm): > [ ] postgres (v0.2.5, from libdrasi_bootstrap_postgres.dylib) [ ] ⬇ Install a bootstrap from a registry [Use arrow keys to navigate, space to select/deselect] ``` -------------------------------- ### Drasi Server Version Output Example Source: https://github.com/drasi-project/docs/blob/main/docs/shared-content/installation/drasi-server/download-binary.md Example output displayed after running the version command. ```text drasi-server 0.2.1 rustc: rustc 1.88.0 (6b00bc388 2025-06-23) plugin-sdk: 0.9.1 ``` -------------------------------- ### Full Example: Mock Source with Queries and Reactions Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-sources/configure-mock-source/_index.md A comprehensive example demonstrating the configuration of a mock source generating sensor data, a query to detect high temperatures, and a reaction to log alerts. ```yaml sources: - kind: mock id: sensors autoStart: true dataType: type: sensor_reading sensor_count: 3 intervalMs: 1000 queries: - id: high-temp query: | MATCH (s:SensorReading) WHERE s.temperature > 25 RETURN s.sensor_id, s.temperature sources: - sourceId: sensors autoStart: true reactions: - kind: log id: alerts queries: [high-temp] autoStart: true ``` -------------------------------- ### Start Local HTTP Test Servers Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-reactions/configure-http-reaction/_index.md Commands to start a simple local HTTP server for testing reaction endpoints. ```bash # Python python -m http.server 9999 # Node.js npx http-server -p 9999 ``` -------------------------------- ### Start a complete pipeline dynamically Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/rest-api/_index.md Use these commands to create a source, a query that subscribes to it, and a reaction that consumes query results. Finally, start all components if autoStart was not enabled. ```bash # 1. Create a source curl -X POST http://localhost:8080/api/v1/sources \ -H "Content-Type: application/json" \ -d '{"kind":"postgres","id":"db","host":"localhost","port":5432,"database":"mydb","user":"user","password":"pass","tables":["public.items"]}' # 2. Create a query that subscribes to the source curl -X POST http://localhost:8080/api/v1/queries \ -H "Content-Type: application/json" \ -d '{"id":"active-items","query":"MATCH (i:items) WHERE i.active RETURN i","sources":[{"sourceId":"db"}]}' # 3. Create a reaction that consumes query results curl -X POST http://localhost:8080/api/v1/reactions \ -H "Content-Type: application/json" \ -d '{"kind":"log","id":"logger","queries":["active-items"]}' # 4. Start all components (if autoStart was not set) curl -X POST http://localhost:8080/api/v1/sources/db/start curl -X POST http://localhost:8080/api/v1/queries/active-items/start curl -X POST http://localhost:8080/api/v1/reactions/logger/start ``` -------------------------------- ### Install App Backend Dependencies Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/install-sample-applications/curbside-pickup/_index.md Install the necessary Node.js dependencies for the App backend before running it. Execute this command from the `/apps/curbside-pickup/functions` folder. ```bash npm install ``` -------------------------------- ### Promote Middleware Input Example Source: https://github.com/drasi-project/docs/blob/main/docs/content/reference/middleware/_index.md Example input JSON demonstrating nested data structures that can be promoted to top-level properties by the promote middleware. ```json { "user": { "id": "user123", "location": { "city": "New York" } }, "order": { "total": 100.50 }, "metadata": { "source": "api", "version": "1.1" } } ``` -------------------------------- ### Install React SignalR Package Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/configure-reactions/configure-signalr-reaction/_index.md Install the @drasi/signalr-react package using npm. ```bash npm install --save @drasi/signalr-react ``` -------------------------------- ### Install Contour Ingress Controller for Kind Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/getting-started/_index.md Execute this command to install the Contour ingress controller on a Kind local cluster. ```bash drasi ingress init --local-cluster ``` -------------------------------- ### Install macOS dependencies Source: https://github.com/drasi-project/docs/blob/main/docs/shared-content/installation/drasi-server/build-from-source-prereqs.md Use Homebrew to install the required protobuf and jq packages on macOS. ```bash brew install protobuf brew install jq ``` -------------------------------- ### Cleanup Local Setup Resources Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/risky-containers/_index.md Use these commands to remove all resources created during the tutorial setup. This includes Drasi configurations, Kubernetes resources, and secrets. ```sh drasi delete -f ./drasi/queries.yaml drasi delete -f ./drasi/sources.yaml kubectl delete -f ./resources/my-app.yaml kubectl delete -f ./resources/postgres.yaml kubectl delete secret k8s-context -n drasi-system ``` ```sh drasi delete -f ./drasi/reaction.yaml kubectl delete -f ./resources/slack-url.yaml ``` -------------------------------- ### Start Drasi Server Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/cli/_index.md Starts the Drasi Server using a specified configuration file. This is the default command if no subcommand is provided. ```bash drasi-server --config config/server.yaml ``` ```bash drasi-server run --config config/server.yaml ``` -------------------------------- ### Install npm Packages Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/connecting-frontends/react/index.md Installs the necessary packages for the React application. Run this command in the project's root directory. ```shell cd 02-connect-frontends/react npm install ``` -------------------------------- ### Install npm Packages Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/connecting-frontends/vue/index.md Installs the necessary packages for the Vue application. Run this command in the project's Vue directory. ```shell cd 02-connect-frontends/vue npm install ``` -------------------------------- ### Install Drasi CLI on Linux Source: https://github.com/drasi-project/docs/blob/main/docs/shared-content/installation/drasi-cli/cli-installation.md Use this command to download and execute the installation script for the Drasi CLI on Linux. ```shell wget -q "https://raw.githubusercontent.com/drasi-project/drasi-platform/main/cli/installers/install-drasi-cli.sh" -O - | /bin/bash ``` -------------------------------- ### Start LocalStack and Create Test Queue Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-reactions/configure-aws-sqs-reaction/_index.md Use Docker to start a LocalStack instance and the AWS CLI to create a test SQS queue for local development. ```bash # Start LocalStack docker run -d --name localstack -p 4566:4566 localstack/localstack # Create a test queue aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name test-queue ``` -------------------------------- ### Promote Middleware Output Example Source: https://github.com/drasi-project/docs/blob/main/docs/content/reference/middleware/_index.md Example output JSON showing how the promote middleware transforms nested data into top-level properties based on the provided mappings and 'on_conflict: skip' setting. ```json { "user": { "id": "user123", "location": { "city": "New York" } }, "order": { "total": 100.50 }, "metadata": { "source": "api", "version": "1.1" }, "userId": "user123", "city": "New York", "orderTotal": 100.50, "meta": { "source": "api", "version": "1.1" } } ``` -------------------------------- ### Start Query Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/rest-api/_index.md Begin the execution of a specified query. ```http POST /api/v1/queries/{id}/start ``` -------------------------------- ### Complete Drasi Server Configuration Example Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-reactions/configure-platform-reaction/_index.md An example of a complete Drasi server configuration file, including host, port, logging, data sources, queries, and platform reactions. ```yaml host: 0.0.0.0 port: 8080 logLevel: info sources: - kind: postgres id: orders-db host: ${DB_HOST} database: ecommerce user: ${DB_USER} password: ${DB_PASSWORD} tables: - public.orders queries: - id: order-events query: "MATCH (o:orders) RETURN o.id, o.status, o.total" sources: - sourceId: orders-db reactions: - kind: platform id: order-stream queries: [order-events] redisUrl: ${REDIS_URL:-redis://localhost:6379} pubsubName: ecommerce-orders sourceName: order-service maxStreamLength: 100000 batchEnabled: true batchMaxSize: 100 batchMaxWaitMs: 100 ``` -------------------------------- ### Start a complete pipeline dynamically Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/rest-api/_index.md This workflow demonstrates how to create and start a full data pipeline, including a source, a query, and a reaction, using a series of POST requests. ```APIDOC ## Create a source POST /api/v1/sources ### Description Creates a new data source. ### Request Body - **kind** (string) - Required - The type of the source (e.g., "postgres"). - **id** (string) - Required - A unique identifier for the source. - **host** (string) - Required - The hostname or IP address of the data source. - **port** (integer) - Required - The port number for the data source connection. - **database** (string) - Required - The name of the database. - **user** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. - **tables** (array of strings) - Required - A list of tables to monitor. ### Request Example ```json { "kind": "postgres", "id": "db", "host": "localhost", "port": 5432, "database": "mydb", "user": "user", "password": "pass", "tables": ["public.items"] } ``` ## Create a query POST /api/v1/queries ### Description Creates a new continuous query. ### Request Body - **id** (string) - Required - A unique identifier for the query. - **query** (string) - Required - The Cypher query to execute. - **sources** (array of objects) - Required - A list of sources to subscribe to. - **sourceId** (string) - Required - The ID of the source. ### Request Example ```json { "id": "active-items", "query": "MATCH (i:items) WHERE i.active RETURN i", "sources": [{"sourceId": "db"}] } ``` ## Create a reaction POST /api/v1/reactions ### Description Creates a new reaction. ### Request Body - **kind** (string) - Required - The type of the reaction (e.g., "log"). - **id** (string) - Required - A unique identifier for the reaction. - **queries** (array of strings) - Required - A list of query IDs to subscribe to. ### Request Example ```json { "kind": "log", "id": "logger", "queries": ["active-items"] } ``` ## Start a source POST /api/v1/sources/{sourceId}/start ### Description Starts a specific source. ### Parameters #### Path Parameters - **sourceId** (string) - Required - The ID of the source to start. ## Start a query POST /api/v1/queries/{queryId}/start ### Description Starts a specific query. ### Parameters #### Path Parameters - **queryId** (string) - Required - The ID of the query to start. ## Start a reaction POST /api/v1/reactions/{reactionId}/start ### Description Starts a specific reaction. ### Parameters #### Path Parameters - **reactionId** (string) - Required - The ID of the reaction to start. ``` -------------------------------- ### Example Query Container Configuration Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/configure-query-containers/_index.md This is a complete example of a Query Container configuration. It demonstrates setting the query host count, default store, and configuring memory, Redis, and RocksDB storage profiles, along with MongoDB for results. ```yaml apiVersion: query.reactive-graph.io/v1 kind: QueryContainer metadata: name: default spec: queryHostCount: 3 defaultStore: rocks storage: memory: kind: memory enableArchive: false redis: kind: redis connectionString: redis://rg-redis:6379 rocks: kind: rocksDb storageClass: azurefile-csi-premium enableArchive: false directIo: false results: MONGO_URI: mongodb://rg-mongo:27017 MONGO_RESULT_STORE_DB_NAME: ReactiveGraph MONGO_RESULT_STORE_COLL_NAME: Results ``` -------------------------------- ### Run Curbside Pickup Tutorial Setup Script (macOS/Linux) Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/curbside-pickup/_index.md Execute this script on macOS or Linux to set up the curbside pickup tutorial environment. It deploys databases, applications, and configures ingress routes. ```bash cd tutorial/curbside-pickup ./scripts/setup-tutorial.sh ``` -------------------------------- ### Run Curbside Pickup Tutorial Setup Script (Windows PowerShell) Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/curbside-pickup/_index.md Execute this script on Windows using PowerShell to set up the curbside pickup tutorial environment. It deploys databases, applications, and configures ingress routes. ```powershell cd tutorial\curbside-pickup .\scripts\setup-tutorial.ps1 ``` -------------------------------- ### Drasi Docker Installation Output Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/installation/install-on-docker/_index.md This is an example of the expected output after a successful Drasi installation into a Docker container. It confirms the creation and startup of the container, Dapr installation, and the readiness of various Drasi components. ```text Installing Drasi with version 0.2.0 from registry ghcr.io ✓ Container 37951820a0d4a810cc3abd6ad9ef4ede4e075ad18f5708814da9cfe0cc23fb36 created ✓ Container 37951820a0d4a810cc3abd6ad9ef4ede4e075ad18f5708814da9cfe0cc23fb36 started ℹ Dapr not installed ✓ Dapr installed successfully ✓ Infrastructure deployed ✓ app=rg-redis is online ✓ app=rg-mongo is online ✓ Control plane is online ✓ drasi/infra=api is online ✓ drasi/infra=resource-provider is online ✓ Query container created ✓ Apply: QueryContainer/default: complete ✓ Wait QueryContainer/default online ✓ Default source providers created ✓ Apply: SourceProvider/PostgreSQL: complete ✓ Apply: SourceProvider/SQLServer: complete ✓ Apply: SourceProvider/CosmosGremlin: complete ✓ Default reaction providers created ✓ Apply: ReactionProvider/Debug: complete ✓ Apply: ReactionProvider/Debezium: complete ✓ Apply: ReactionProvider/EventGrid: complete ✓ Apply: ReactionProvider/Gremlin: complete ✓ Apply: ReactionProvider/Result: complete ✓ Apply: ReactionProvider/SignalR: complete ✓ Apply: ReactionProvider/StorageQueue: complete ✓ Apply: ReactionProvider/StoredProc: complete ``` -------------------------------- ### Example: Use Existing NGINX Ingress Controller Source: https://github.com/drasi-project/docs/blob/main/docs/shared-content/ingress/ingress-init.md An example of configuring Drasi to use an existing NGINX ingress controller with specific service details. ```bash drasi ingress init --use-existing --ingress-service-name ingress-nginx-controller --ingress-namespace ingress-nginx --ingress-class-name nginx ``` -------------------------------- ### Initializing Configuration Interactively Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-drasi-server/_index.md Run the init command to launch a wizard that generates a configuration file. ```bash drasi-server init --output config/server.yaml ``` -------------------------------- ### Successful Drasi Installation Output Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/installation/install-on-aks/_index.md This is an example of the expected output upon a successful Drasi installation. It indicates the status of Dapr, infrastructure components, control plane, query container, and various source and reaction providers. ```text Installing Drasi with version 0.1.3 from registry ghcr.io ℹ Dapr not installed ✓ Dapr installed successfully ✓ Infrastructure deployed ✓ app=drasi-redis is online ✓ app=drasi-mongo is online ✓ Control plane is online ✓ drasi/infra=api is online ✓ drasi/infra=resource-provider is online ✓ Query container created ✓ Apply: QueryContainer/default: complete ✓ Wait QueryContainer/default online ✓ Default source providers created ✓ Apply: SourceProvider/PostgreSQL: complete ✓ Apply: SourceProvider/SQLServer: complete ✓ Apply: SourceProvider/CosmosGremlin: complete ✓ Default reaction providers created ✓ Apply: ReactionProvider/Debug: complete ✓ Apply: ReactionProvider/Debezium: complete ✓ Apply: ReactionProvider/EventGrid: complete ✓ Apply: ReactionProvider/Gremlin: complete ✓ Apply: ReactionProvider/Result: complete ✓ Apply: ReactionProvider/SignalR: complete ✓ Apply: ReactionProvider/StorageQueue: complete ✓ Apply: ReactionProvider/StoredProc: complete ``` -------------------------------- ### Start Reaction Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/rest-api/_index.md Activate a specified reaction. ```http POST /api/v1/reactions/{id}/start ``` -------------------------------- ### Docker Compose for Drasi Server and gRPC Processor Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-reactions/configure-grpc-reaction/_index.md Example Docker Compose setup for running Drasi Server and a gRPC processor service. It defines services, ports, volumes, and dependencies. ```yaml version: '3.8' services: drasi-server: image: ghcr.io/drasi-project/drasi-server:latest ports: - "8080:8080" volumes: - ./config:/config:ro depends_on: - event-processor event-processor: image: your-grpc-processor:latest ports: - "50052:50052" ``` -------------------------------- ### Configure PostgreSQL Bootstrap Provider in Drasi Server Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-bootstrap-providers/configure-postgres-bootstrap-provider/_index.md Example Drasi Server configuration demonstrating the setup for a PostgreSQL bootstrap provider. Ensure bootstrap provider keys are camelCase and the discriminator field is `bootstrapProvider.kind`. ```yaml sources: - kind: postgres id: orders-db autoStart: true host: ${PGHOST:-localhost} port: ${PGPORT:-5432} database: ${PGDATABASE:-mydb} user: ${PGUSER:-drasi_user} password: ${PGPASSWORD} publicationName: drasi_publication slotName: drasi_slot # Optional: used for bootstrap scope and key overrides tables: - public.orders - public.customers bootstrapProvider: kind: postgres ``` -------------------------------- ### Create Configuration File Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/installation/install-with-docker/_index.md Create a minimal server.yaml configuration file in a local directory. ```bash mkdir -p config cat > config/server.yaml << 'EOF' id: my-drasi-server port: 8080 sources: [] queries: [] reactions: [] EOF ``` -------------------------------- ### Drasi Server MySQL Source Configuration Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-sources/configure-mysql-source/_index.md Configure the MySQL source to stream changes from a MySQL database. This example shows basic connection details, tables to monitor, optional table key overrides, binlog start position, and a bootstrap provider. ```yaml sources: - kind: mysql id: orders-db autoStart: true host: ${MYSQL_HOST:-localhost} port: ${MYSQL_PORT:-3306} database: ${MYSQL_DATABASE:-mydb} user: ${MYSQL_USER:-drasi_user} password: ${MYSQL_PASSWORD} # Tables to monitor tables: - orders - customers # Optional: override key columns for tables without primary keys tableKeys: - table: order_items keyColumns: [order_id, product_id] # Optional: where to start reading the binlog startPosition: from_end # Optional: preload initial state for newly-subscribed queries bootstrapProvider: kind: mysql ``` -------------------------------- ### Preview documentation with local tutorials Source: https://github.com/drasi-project/docs/blob/main/readme.md Commands to preview documentation using a local checkout of the learning-drasi-server repository. ```bash make preview-docs ``` ```bash make preview-docs TUTORIALS_LOCAL=/absolute/path/to/learning-drasi-server ``` -------------------------------- ### Verify Dapr Installation Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/installation/install-using-manifests/_index.md Check if Dapr is installed and running in the `dapr-system` namespace by listing the pods. This is a prerequisite for installing Drasi. ```bash kubectl get pods -n dapr-system ``` -------------------------------- ### Start Reaction Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/rest-api/_index.md Starts a specific reaction by its ID. ```APIDOC ## POST /api/v1/reactions/{id}/start ### Description Starts a specific reaction. ### Method POST ### Endpoint /api/v1/reactions/{id}/start ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the reaction to start. ``` -------------------------------- ### Start Query Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/rest-api/_index.md Starts a specific query by its ID. ```APIDOC ## POST /api/v1/queries/{id}/start ### Description Starts a specific query. ### Method POST ### Endpoint /api/v1/queries/{id}/start ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the query to start. ``` -------------------------------- ### Initialize Drasi Server Configuration Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/create-config-with-wizard/_index.md Run this command from the repository root to start the interactive configuration wizard. ```bash ./bin/drasi-server init --output getting-started.yaml ``` -------------------------------- ### Minimal server configuration Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/configuration/_index.md A basic configuration example defining a mock source, a query, and a log reaction. ```yaml # Smallest useful config - mock source with log output host: 0.0.0.0 port: 8080 sources: - kind: mock id: test dataType: sensor_reading queries: - id: all-data query: "MATCH (n) RETURN n" sources: - sourceId: test autoStart: true reactions: - kind: log id: console queries: [all-data] autoStart: true ``` -------------------------------- ### Start Source Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/rest-api/_index.md Starts a specific data source by its ID. ```APIDOC ## POST /api/v1/sources/{id}/start ### Description Starts a specific data source. ### Method POST ### Endpoint /api/v1/sources/{id}/start ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the source to start. ### Response #### Success Response (200) - **status** (string) - The status of the operation (e.g., "success"). - **message** (string) - A message indicating the result (e.g., "Source started"). ``` -------------------------------- ### Production-ready server configuration Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/configuration/_index.md A comprehensive configuration example utilizing environment variable interpolation and advanced settings. ```yaml # Complete production-ready configuration id: production-server host: 0.0.0.0 port: ${PORT:-8080} logLevel: ${LOG_LEVEL:-info} persistConfig: true persistIndex: true stateStore: kind: redb path: ${DATA_DIR:-./data}/state.redb defaultPriorityQueueCapacity: 50000 defaultDispatchBufferCapacity: 5000 sources: - kind: postgres id: orders-db autoStart: true host: ${DB_HOST} port: ${DB_PORT:-5432} database: ${DB_NAME} user: ${DB_USER} password: ${DB_PASSWORD} tables: - public.orders - public.customers bootstrapProvider: kind: postgres queries: - id: pending-orders autoStart: true query: | MATCH (o:orders) WHERE o.status = 'pending' RETURN o.id, o.total, o.customer_id sources: - sourceId: orders-db reactions: - kind: http id: webhook queries: [pending-orders] autoStart: true baseUrl: ${WEBHOOK_URL} token: ${WEBHOOK_TOKEN} routes: pending-orders: added: url: /orders/new method: POST ``` -------------------------------- ### Verify Docker Installation Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/installation/install-with-docker/_index.md Check that Docker is installed and accessible on the system. ```bash docker --version ``` -------------------------------- ### Install Gremlinpython and Load Graph Data Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/install-sample-applications/building-comfort/_index.md Install the gremlinpython package if it's not already installed, then run the load_graph.py script to populate the Cosmos DB graph with sample data. ```bash pip install gremlinpython # If you don't already have the gremlinpython package installed python load_graph.py ``` -------------------------------- ### Start Source Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/rest-api/_index.md Initiate the data collection process for a specified source. ```http POST /api/v1/sources/{id}/start ``` -------------------------------- ### Install Docsy dependencies Source: https://github.com/drasi-project/docs/blob/main/readme.md Install required Node.js dependencies for the Docsy theme. ```bash npm install ``` -------------------------------- ### Initialize Drasi Server Configuration Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/installation/build-from-source/_index.md Generate a starter configuration file for Drasi Server using the `init` command. Specify the output path for the configuration file. ```bash cargo run --release -- init --output config/server.yaml ``` -------------------------------- ### Verify Rust Installation Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/installation/build-from-source/_index.md Check if Rust and Cargo are installed and accessible in your environment. ```bash rustc --version cargo --version ``` -------------------------------- ### Install Vue SignalR Package Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/configure-reactions/configure-signalr-reaction/_index.md Install the @drasi/signalr-vue package using npm. ```bash npm install --save @drasi/signalr-vue ``` -------------------------------- ### Create k3d Cluster for Drasi Tutorial Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/building-comfort/_index.md Create a k3d cluster named 'drasi-tutorial' with port mapping for the load balancer. This command is used for the local setup of the tutorial. ```bash # Create k3d cluster with port mapping k3d cluster create drasi-tutorial -p '8123:80@loadbalancer' ``` -------------------------------- ### Verify Drasi Server Installation Source: https://github.com/drasi-project/docs/blob/main/docs/shared-content/installation/drasi-server/download-binary.md Command to check the installed version of the Drasi Server binary. ```bash ./bin/drasi-server --version ``` -------------------------------- ### Install Bootstrap from Registry Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/create-config-with-wizard/_index.md Interface for searching and selecting a bootstrap plugin from the registry. ```text > Select bootstraps (space to select, enter to confirm): ⬇ Install a bootstrap from a registry > Plugin source (registry URL or local directory path): ghcr.io/drasi-project Searching ghcr.io/drasi-project... ? Select bootstraps to install: ^ [ ] bootstrap/mysql (latest: 0.2.0) [ ] bootstrap/open511 (latest: 0.1.0) [ ] bootstrap/oracle (latest: 0.1.0) [ ] bootstrap/sqlite (latest: 0.1.0) [ ] bootstrap/sui-deepbook (latest: 0.1.0) > [ ] bootstrap/cloudflare-radar (latest: 0.1.0) [ ] bootstrap/here-traffic (latest: 0.1.0) [↑↓ to move, space to select one, → to all, ← to none, type to filter] ``` -------------------------------- ### Verify Drasi Installation Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/installation/install-using-manifests/_index.md Check that all Drasi components, specifically the query container, are running after installation. ```bash drasi list querycontainer ``` -------------------------------- ### Complete HTTP Reaction Configuration Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-reactions/configure-http-reaction/_index.md A full configuration example including source, query, and HTTP reaction definitions with custom output templates. ```yaml host: 0.0.0.0 port: 8080 logLevel: info sources: - kind: postgres id: orders-db host: ${DB_HOST} database: ecommerce user: ${DB_USER} password: ${DB_PASSWORD} tables: - public.orders queries: - id: high-value-orders query: | MATCH (o:orders) WHERE o.total > 500 RETURN o.id, o.customer_id, o.total, o.status sources: - sourceId: orders-db reactions: - kind: http id: order-notifications queries: [high-value-orders] baseUrl: ${WEBHOOK_URL} token: ${WEBHOOK_TOKEN} timeoutMs: 10000 outputTemplates: routes: high-value-orders: added: url: /orders/high-value method: POST template: | { "event": "high_value_order", "order_id": "{{after.id}}", "customer_id": "{{after.customer_id}}", "total": {{after.total}} } headers: Content-Type: application/json updated: url: /orders/{{after.id}}/status method: PUT template: | { "status": "{{after.status}}", "previous_status": "{{before.status}}" } headers: Content-Type: application/json ``` -------------------------------- ### Install Drasi with Default Settings Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/installation/install-on-aks/_index.md Install Drasi on the AKS cluster using all default configurations. This command installs the Drasi version matching the CLI, creates the 'drasi-system' namespace if it doesn't exist, and pulls images from 'ghcr.io'. ```text drasi init ``` -------------------------------- ### Install Contour with Custom Annotations Source: https://github.com/drasi-project/docs/blob/main/docs/shared-content/ingress/ingress-init.md Install Contour with custom annotations by specifying them with the --ingress-annotation flag. ```bash drasi ingress init --ingress-annotation "=" --ingress-annotation "=" ``` -------------------------------- ### Install aspell for Spellchecking Source: https://github.com/drasi-project/docs/blob/main/CONTRIBUTING.md Install the aspell spellchecker using Homebrew. This is a prerequisite for running the local spellchecker. ```bash brew install aspell ``` -------------------------------- ### substring(original, start, length) Source: https://github.com/drasi-project/docs/blob/main/docs/content/reference/query-language/gql.md Returns a substring from the given string, beginning with a 0-based index start. ```APIDOC ## substring(original, start, length) ### Description The `substring` function returns a substring from the given string, beginning with a 0-based index start. ### Syntax `substring(original, start, length)` ### Arguments - **original** (STRING) - The string to be shortened - **start** (INTEGER) - The start position of the new string - **length** (INTEGER) - Optional. Length of the new string ### Returns A STRING. ``` -------------------------------- ### Deploy Drasi Sources with CLI Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/drasi-for-dapr/_index.md Apply all Drasi source configurations and wait for them to become available. This is the initial step for setting up data sources. ```bash drasi apply -f drasi/sources/* drasi wait -f drasi/sources/* ``` -------------------------------- ### Install Drasi CLI on macOS Source: https://github.com/drasi-project/docs/blob/main/docs/shared-content/installation/drasi-cli/cli-installation.md Use this command to download and execute the installation script for the Drasi CLI on macOS. ```bash curl -fsSL https://raw.githubusercontent.com/drasi-project/drasi-platform/main/cli/installers/install-drasi-cli.sh | /bin/bash ``` -------------------------------- ### Deploy PostgreSQL and Create Table Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/risky-containers/_index.md Apply the PostgreSQL resource definition and wait for the pod to be ready. This command also creates the necessary table and data for the tutorial. ```shell kubectl apply -f ./resources/postgres.yaml kubectl wait --for=condition=ready pod -l app=postgres --timeout=60s ``` -------------------------------- ### Verify Dapr Installation with kubectl Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/installation/install-on-aks/_index.md Check the status of Dapr pods in the `dapr-system` namespace to confirm successful installation. ```bash kubectl get pods -n dapr-system ``` ```text NAME READY STATUS RESTARTS AGE dapr-dashboard-5cc65d985f-qzqbg 1/1 Running 0 10m dapr-operator-5d98f57c86-kspwk 1/1 Running 0 10m dapr-placement-server-0 1/1 Running 0 10m dapr-sentry-697bdc6cc4-xprww 1/1 Running 0 10m dapr-sidecar-injector-56c4c4b485-n48bg 1/1 Running 0 10m ``` -------------------------------- ### Common Configuration Error Examples Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-drasi-server/_index.md Examples of configuration keys and values that commonly cause errors in Drasi Server. ```yaml logLevel ``` ```yaml kind: postgres ``` ```yaml ${VAR:-default} ``` ```yaml logLevel: debug ``` -------------------------------- ### Cleanup Local Tutorial Resources Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/absence-of-change/_index.md Use these commands to remove tutorial resources created locally. Ensure you have the Drasi CLI and kubectl installed. ```sh drasi delete -f freezer-query.yaml drasi delete -f source.yaml kubectl delete -f postgres.yaml ``` -------------------------------- ### Example Event Hub Message Payload Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/configure-sources/configure-azure-eventhub-source/_index.md An example JSON payload for a message received from an Azure Event Hub. ```json { "vehicleId": "truck-001", "speed": 65, "location": { "lat": 47.6062, "lng": -122.3321 }, "timestamp": "2024-01-15T10:30:00Z" } ``` -------------------------------- ### Get Redis Stream Length using redis-cli Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-reactions/configure-platform-reaction/_index.md Command to get the current number of messages in a Redis Stream. ```bash redis-cli XLEN my-query-results ``` -------------------------------- ### Apply Reaction Provider Configuration Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/how-to-guides/configure-reactions/configure-sync-dapr-statestore-reaction/_index.md Apply the `reaction-provider.yaml` file to register the SyncDaprStateStore reaction provider. ```bash drasi apply -f reaction-provider.yaml ``` -------------------------------- ### JSONL File Structure Example Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-bootstrap-providers/configure-scriptfile-bootstrap-provider/_index.md Demonstrates the required file structure for JSONL bootstrap files, including a 'Header' as the first record and 'Finish' as the last. ```jsonl {"kind":"Header","start_time":"2024-01-01T00:00:00Z","description":"Initial products"} {"kind":"Node","id":"prod-1","labels":["Product"],"properties":{"name":"Widget","price":9.99,"stock":100}} {"kind":"Node","id":"prod-2","labels":["Product"],"properties":{"name":"Gadget","price":19.99,"stock":50}} {"kind":"Finish","description":"Done"} ``` -------------------------------- ### Start Vue Development Server Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/connecting-frontends/vue/index.md Launches the Vue.js development server. Access the application via the provided local URL. ```shell npm run dev ``` -------------------------------- ### Install Contour Ingress Controller for AKS/EKS Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/getting-started/_index.md Run this command to install the Contour ingress controller on AKS or EKS clusters. ```bash drasi ingress init ``` -------------------------------- ### Server Settings Wizard Output Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/create-config-with-wizard/_index.md Example of the terminal output after completing the server settings section of the configuration wizard. ```text IP address to bind to (0.0.0.0 for all interfaces) > Server host: 0.0.0.0 Port for the REST API > Server port: ${SERVER_PORT:-8080} Logging verbosity > Log level: info Persists query index data to disk. Use for production workloads. > Enable persistent indexing (RocksDB)? No Allows plugins to persist runtime state that survives restarts > State store (for plugin state persistence): None - In-memory state (lost on restart) Default registry for downloading plugins > Plugin registry (OCI URL or local path): ghcr.io/drasi-project Verify cosign signatures on downloaded plugins for supply-chain security > Enable plugin signature verification (cosign)? No Automatically download missing plugins when the server starts > Auto-install plugins from registry on startup? No Automatically detect and reload plugins when files change on disk > Enable hot-reload for plugins? No ``` -------------------------------- ### Start Drasi Server on Different Port Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/reference/cli/_index.md Starts the Drasi Server and overrides the default port specified in the configuration file. ```bash drasi-server --config config/server.yaml --port 9090 ``` -------------------------------- ### Cleanup Tutorial Resources (macOS/Linux) Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-kubernetes/tutorials/building-comfort/_index.md Execute this script to clean up tutorial resources, optionally uninstall Drasi, and delete the k3d cluster. ```shell ./scripts/cleanup-tutorial.sh ``` -------------------------------- ### Profiler Configuration for Development Source: https://github.com/drasi-project/docs/blob/main/docs/content/drasi-server/how-to-guides/configuration/configure-reactions/configure-profiler-reaction/_index.md Example configuration for development profiling, using a small `windowSize` and a short `reportIntervalSecs` for quick feedback. ```yaml reactions: - kind: profiler id: dev-profiler queries: [test-query] windowSize: 50 reportIntervalSecs: 10 ```