### Install Optional Node.js and OpenJDK on macOS Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Installs Node.js and OpenJDK on macOS using Homebrew, which are optional but useful for supporting tools and examples in the Restate project. ```shell brew install node openjdk ``` -------------------------------- ### Install Knative on Kind Kubernetes Environment Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Provides instructions to install Knative on a local Kubernetes environment managed by Kind. It directs users to the official Knative quickstart guide for detailed steps. ```shell # Follow the quickstart guide here: https://knative.dev/docs/install/quickstart-install/ ``` -------------------------------- ### Start Restate Server with Configuration Source: https://context7.com/restatedev/restate/llms.txt This code shows different methods for starting the Restate server. It includes starting the server with a YAML configuration file, using environment variables for configuration, and running the server via a Docker container. These methods provide flexibility in deployment and configuration. ```bash # Start server with config file restate-server --config-file restate.yaml # Or use environment variables RESTATE_CLUSTER_NAME=my-cluster restate-server # Run via Docker docker run --rm -p 8080:8080 -p 9070:9070 -p 9071:9071 \ -v ./restate-data:/restate-data \ docker.restate.dev/restatedev/restate:latest ``` -------------------------------- ### Start Jaeger for Tracing on Linux/macOS Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Starts a Jaeger all-in-one container using Docker for collecting and visualizing traces. It exposes the necessary ports and enables OTLP collection. ```shell docker run --rm -d -p16686:16686 -p4317:4317 -e COLLECTOR_OTLP_ENABLED=true --name jaeger jaegertracing/all-in-one:latest ``` -------------------------------- ### Install Dependencies on Fedora for Restate Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Installs necessary development tools and libraries for building Restate on Fedora systems. This includes compilers, build tools, and database-related packages. ```shell sudo dnf install clang lld lldb libcxx cmake openssl-devel rocksdb-devel protobuf-compiler protobuf-devel just liburing-devel perl ``` -------------------------------- ### Run Example with Cargo Source: https://github.com/restatedev/restate/blob/main/crates/local-cluster-runner/README.md This command executes the `three_nodes` example using Cargo, enabling the capture of output for debugging purposes. ```shell cargo run --example three_nodes -- --nocapture ``` -------------------------------- ### Install Restate CLI using Homebrew or npm Source: https://context7.com/restatedev/restate/llms.txt This code shows how to install the Restate Command Line Interface (CLI). It provides instructions for installation using Homebrew and npm, allowing developers to manage Restate services and deployments from their terminal. ```bash # Install CLI via Homebrew brew install restatedev/tap/restate # Or via npm npm install --global @restatedev/restate ``` -------------------------------- ### Install Dependencies on macOS for Restate Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Installs essential development tools for Restate on macOS using Homebrew. This includes CMake, Protobuf compiler, and the 'just' build tool. ```shell brew install cmake protobuf just ``` -------------------------------- ### Install Knative on Rancher Desktop Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Installs Knative on Rancher Desktop after disabling Traefik and restarting. It uses a script to download and apply the specified Knative version. ```shell KNATIVE_VERSION=1.8.0 curl -sL https://raw.githubusercontent.com/csantanapr/knative-minikube/master/install.sh | bash ``` -------------------------------- ### Link OpenJDK for System-Level Access on macOS Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Creates a symbolic link for OpenJDK installed via Homebrew to make it accessible through system-level Java wrappers. This is necessary for proper integration. ```shell sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk ``` -------------------------------- ### List and Get Restate Deployments via Admin API Source: https://context7.com/restatedev/restate/llms.txt Provides examples for listing all registered deployments and retrieving details of a specific deployment using the Restate Admin API. Useful for monitoring and managing deployed services. Requires a running Restate server. ```bash # List all deployments curl http://localhost:9070/deployments # Response: # { # "deployments": [ # { # "id": "dp_14LsPzGz9HBxXIeBoH5wYg", # "uri": "http://localhost:9080", # "protocolType": "RequestResponse", # "httpVersion": "HTTP/2.0", # "services": [{"name": "greeter", "revision": 1}], # "createdAt": "2024-01-15T10:30:00Z" # } # ] # } # Get specific deployment details curl http://localhost:9070/deployments/dp_14LsPzGz9HBxXIeBoH5wYg # Response includes full service metadata with handlers ``` -------------------------------- ### Run Restate Server with npx Source: https://github.com/restatedev/restate/blob/main/README.md Starts the Restate server using Node Package Execute (npx). This is a convenient way to run the server without a global installation. ```bash npx @restatedev/restate-server ``` -------------------------------- ### Generate REST API Documentation (Shell) Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Generates an OpenAPI JSON file and then builds HTML documentation from it using '@redocly/cli'. Requires 'npx'. Outputs an OpenAPI JSON file and HTML documentation. ```shell cargo xtask generate-rest-api-doc > openapi.json npx @redocly/cli build-docs openapi.json ``` -------------------------------- ### Build Restate Server Binary Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Builds the 'restate-server' binary using the 'just' build tool. The optional '--release' flag can be used for a release build. ```shell just build --bin restate-server [--release] ``` -------------------------------- ### Generate Configuration Documentation (Shell) Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Generates JSON schema and HTML documentation for the Restate configuration. Requires the 'generate-schema-doc' tool. Outputs a JSON schema file and an HTML documentation file. ```shell cargo xtask generate-config-schema > restate_config_schema.json generate-schema-doc --minify restate_config_schema.json restate_config_doc.html ``` -------------------------------- ### Run Restate Unit Tests with Just Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Executes all workspace unit tests using the 'just test' command, which is a convenient wrapper for running tests. ```shell just test ``` -------------------------------- ### Install Restate Server with Homebrew Source: https://github.com/restatedev/restate/blob/main/README.md Installs the Restate server using the Homebrew package manager on macOS. ```bash brew install restatedev/tap/restate-server ``` -------------------------------- ### Install Restate CLI with npm Source: https://github.com/restatedev/restate/blob/main/README.md Installs the Restate CLI globally using npm. This makes the 'restate' command available system-wide. ```bash npm install --global @restatedev/restate ``` -------------------------------- ### Install Dependencies with npm Source: https://github.com/restatedev/restate/blob/main/scripts/loadtest-environment/README.md Installs the necessary dependencies for the CDK project. Ensure you have npm installed and are in the project's root directory. ```bash npm install ``` -------------------------------- ### Build Restate CLI Binary Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Builds the 'restate-cli' binary using the 'just' build tool. The optional '--release' flag can be used for a release build. ```shell just build --bin restate [--release] ``` -------------------------------- ### Restart Invocation as New (Bash) Source: https://context7.com/restatedev/restate/llms.txt Creates a new invocation based on a completed one, with the option to preserve partial journal progress. This is useful for retrying failed invocations or starting from a specific point. You can restart from the beginning, specify a journal entry to start from, or target the latest deployment. ```bash # Restart from beginning (default) curl -X PATCH http://localhost:9070/invocations/inv_1gdJBtdVEcM942vReYBfR2/restart-as-new # Response: {"newInvocationId": "inv_2hdKCtdWFdN..."} # Restart preserving first 5 journal entries curl -X PATCH 'http://localhost:9070/invocations/inv_1gdJBtdVEcM942vReYBfR2/restart-as-new?from=5' # Restart on latest deployment curl -X PATCH 'http://localhost:9070/invocations/inv_1gdJBtdVEcM942vReYBfR2/restart-as-new?deployment=latest' ``` -------------------------------- ### Install Restate CLI with Homebrew Source: https://github.com/restatedev/restate/blob/main/README.md Installs the Restate command-line interface (CLI) using the Homebrew package manager on macOS. ```bash brew install restatedev/tap/restate ``` -------------------------------- ### Install Restate Single-Node Cluster with Helm Source: https://github.com/restatedev/restate/blob/main/charts/restate-helm/README.md Installs the Restate Helm chart for a single-node StatefulSet deployment. This command deploys Restate to the 'restate' namespace, creating it if it doesn't exist. ```bash helm install restate oci://ghcr.io/restatedev/restate-helm --namespace restate --create-namespace ``` -------------------------------- ### Behavioral Change Example: Abort Timeout Default Source: https://github.com/restatedev/restate/blob/main/release-notes/README.md An example of a release note for a behavioral change, illustrating an increase in the default `abort-timeout`. It explains the change, its impact on users, and provides migration guidance with a configuration snippet. ```markdown # Release Notes for Issue #3961: Change abort timeout default ## Behavioral Change ### What Changed The default `abort-timeout` has been increased from 1 minute to 10 minutes. ### Impact on Users - New deployments: Use 10-minute default automatically - Existing deployments: Will adopt new default on upgrade - Services now have more time for graceful shutdown ### Migration Guidance To keep the previous 1-minute timeout: ```toml [worker.invoker] abort-timeout = "1m" ``` ``` -------------------------------- ### Generate Performance Flamegraph (Shell) Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Generates a flamegraph SVG file for performance analysis of the restate-server binary. Requires the 'flamegraph' tool. The output file 'flamegraph.svg' is created in the current directory. ```shell just flamegraph --bin restate-server ``` -------------------------------- ### Run Restate Unit Tests with Cargo Nextest Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Runs all workspace unit tests directly using 'cargo nextest'. This is an alternative to 'just test' and leverages the cargo-nextest runner for enhanced testing capabilities. ```shell cargo nextest run --workspace ``` -------------------------------- ### Admin API - List and Get Deployments Source: https://context7.com/restatedev/restate/llms.txt Retrieves information about registered deployments. You can list all deployments or get details for a specific deployment. ```APIDOC ## GET /deployments ### Description Retrieves a list of all registered deployments. ### Method GET ### Endpoint `/deployments` ### Response #### Success Response (200) - **deployments** (array) - A list of deployment objects, each containing details like ID, URI, services, and creation timestamp. #### Response Example ```json { "deployments": [ { "id": "dp_14LsPzGz9HBxXIeBoH5wYg", "uri": "http://localhost:9080", "protocolType": "RequestResponse", "httpVersion": "HTTP/2.0", "services": [{"name": "greeter", "revision": 1}], "createdAt": "2024-01-15T10:30:00Z" } ] } ``` ## GET /deployments/{deploymentId} ### Description Retrieves detailed information about a specific registered deployment. ### Method GET ### Endpoint `/deployments/{deploymentId}` ### Parameters #### Path Parameters - **deploymentId** (string) - Required - The ID of the deployment to retrieve. ### Response #### Success Response (200) - Returns the full metadata of the specified deployment, including service details and handlers. ``` -------------------------------- ### List and Get Services (Bash) Source: https://context7.com/restatedev/restate/llms.txt Retrieve metadata about registered services, including their type, handlers, and configuration. This allows for inspection of the services deployed in the Restate environment. It also provides endpoints to get a specific service's details or its OpenAPI specification. ```bash # List all services curl http://localhost:9070/services # Response: # { # "services": [ # { # "name": "greeter", # "ty": "service", # "deploymentId": "dp_14LsPzGz9HBxXIeBoH5wYg", # "revision": 1, # "public": true, # "handlers": { # "greet": { # "name": "greet", # "ty": "exclusive", # "inputDescription": "application/json", # "outputDescription": "application/json" # } # } # } # ] # } # Get specific service curl http://localhost:9070/services/greeter # Get service OpenAPI specification curl http://localhost:9070/services/greeter/openapi ``` -------------------------------- ### Restate CLI Table Patterns: Key-Value, List, and Diff Tables (Rust) Source: https://github.com/restatedev/restate/blob/main/crates/cli-util/README.md Provides examples of creating different types of tables for Restate CLI output: key-value tables for detail views, list tables for collection views, and diff tables for comparisons. These utilize the `comfy_table` crate with styling for clarity. ```rust let mut table = Table::new_styled(); table.add_kv_row("Name:", &service.name); table.add_kv_row("Status:", Styled(Style::Success, "running")); table.add_kv_row_if( || deployment.is_some(), "Deployment:", || deployment.unwrap().id, ); c_println!("{}", table); ``` ```rust let mut table = Table::new_styled(); table.set_styled_header(vec!["NAME", "TYPE", "STATUS"]); for service in services { table.add_row(vec![&service.name, &service.ty, &service.status]); } c_println!("{}", table); ``` ```rust // Use green for additions, red for removals table.add_row(vec![ Cell::new("++வுகளை").fg(Color::Green), Cell::new(&new_handler.name).fg(Color::Green), ]); table.add_row(vec![ Cell::new("--").fg(Color::Red), Cell::new(&removed_handler.name).fg(Color::Red), ]); ``` -------------------------------- ### Set Restate Configuration via Environment Variable (Shell) Source: https://github.com/restatedev/restate/blob/main/benchmarks/README.md Demonstrates how to override Restate's default configuration by setting environment variables. This example shows setting the number of partitions for the Restate worker. ```shell RESTATE_WORKER__PARTITIONS=1337 ``` -------------------------------- ### Install Restate Replicated Cluster with Helm Source: https://github.com/restatedev/restate/blob/main/charts/restate-helm/README.md Installs the Restate Helm chart for a 3-node replicated cluster using a specified values file. Ensure the `replicated-values.yaml` file version matches the Helm chart version. ```bash helm install restate oci://ghcr.io/restatedev/restate-helm --namespace restate --create-namespace -f replicated-values.yaml ``` -------------------------------- ### Manage Restate Services using CLI Source: https://context7.com/restatedev/restate/llms.txt This code illustrates how to manage Restate services via the CLI. It includes commands to list all available services and to get detailed descriptions of a specific service. This is useful for understanding the structure and capabilities of your deployed services. ```bash # List services restate services list # Describe a service restate services describe greeter ``` -------------------------------- ### Rust: Module Qualified Names and Re-exports Example Source: https://github.com/restatedev/restate/blob/main/docs/dev/rust-guidelines.md Demonstrates how to use module-qualified names or re-exports to refer to types, avoiding name collisions and improving clarity. This is particularly useful when defining error types within modules. ```rust /// Example of defining an error struct within a module. /// The struct is named `Error` and not `InvokerError` to avoid repetition. struct Error; // When consuming, it should be referred to as `invoker::Error` or imported. // use invoker::Error as InvokerError; ``` -------------------------------- ### Run Restate CLI with npx Source: https://github.com/restatedev/restate/blob/main/README.md Executes the Restate CLI using Node Package Execute (npx). This allows running the CLI without a global installation. ```bash npx @restatedev/restate ``` -------------------------------- ### Manage Restate State using CLI Source: https://context7.com/restatedev/restate/llms.txt This snippet demonstrates how to manage the state of Restate Virtual Objects using the CLI. It includes commands to get the current state of a Virtual Object and to interactively edit its state, providing direct control over persistent data. ```bash # Get state for a Virtual Object restate state get counter my-counter-key # Edit state interactively restate state edit counter my-counter-key ``` -------------------------------- ### Retrieve and Evaluate Restate Server Heap Profile (Shell) Source: https://github.com/restatedev/restate/blob/main/docs/dev/profiling-debugging.md Retrieves the heap profile from the Restate server and evaluates it using the pprof tool. This requires the pprof tool to be installed. For release Docker images, debug symbols may need to be downloaded separately to enhance the profile analysis. ```shell curl localhost:5122/debug/pprof/heap > heap.pb.gz go install github.com/google/pprof@latest pprof heap.pb.gz # For release docker images: curl -sL https://4bafe29d-dd3e-4c65-ba1d-54be833b2b69.debuginfod.polarsignals.com/buildid/$BUILD_ID/debuginfo -o restate-server pprof ./restate-server heap.pb.gz ``` -------------------------------- ### Query System State with Restate Admin API (SQL) Source: https://context7.com/restatedev/restate/llms.txt This snippet shows how to query system state and invocation data using SQL through the Restate Admin API's DataFusion integration. It includes examples for querying running invocations and service state, as well as requesting data in the efficient Arrow stream format. The endpoint for queries is 'http://localhost:9070/query'. ```bash # Query invocations curl -X POST http://localhost:9070/query \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "query": "SELECT id, target, status FROM sys_invocation WHERE status = '\''running'\'' LIMIT 10" }' # Query service state curl -X POST http://localhost:9070/query \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "query": "SELECT service_name, service_key, key, value FROM state WHERE service_name = '\''counter''"' }' # Get Arrow stream format (more efficient for large results) curl -X POST http://localhost:9070/query \ -H 'Content-Type: application/json' \ -H 'Accept: application/vnd.apache.arrow.stream' \ -d '{"query": "SELECT * FROM sys_invocation"}' ``` -------------------------------- ### Initialize and Print Styled Output with Restate CLI Utilities (Rust) Source: https://github.com/restatedev/restate/blob/main/crates/cli-util/README.md Demonstrates how to initialize the CLI context and print various styled outputs like success, error, warnings, and tips using the restate_cli_util crate. It also shows how to create and print styled tables. ```rust use restate_cli_util::{ CliContext, CommonOpts, c_println, c_success, c_error, c_warn, c_tip, c_title, c_indentln, c_indent_table, }; use restate_cli_util::ui::console::{Icon, Styled, StyledTable}; use restate_cli_util::ui::stylesheet::Style; use comfy_table::Table; // Initialize the CLI context (typically done once at startup) let opts = CommonOpts::default(); CliContext::new(opts).set_as_global(); // Print styled output c_success!("Operation completed successfully!"); c_error!("Something went wrong: {}", error_message); c_warn!("This action is destructive!"); c_tip!("You can use --force to skip confirmation"); // Create styled tables let mut table = Table::new_styled(); table.add_kv_row("Name:", "my-service"); table.add_kv_row("Status:", Styled(Style::Success, "running")); c_println!("{}", table); ``` -------------------------------- ### Breaking Change Example: Remove Deprecated API Source: https://github.com/restatedev/restate/blob/main/release-notes/README.md An example of a release note for a breaking change, specifically the removal of a deprecated API endpoint. It details what changed, the impact on users, and migration guidance with a code example. ```markdown # Release Notes for Issue #1234: Remove deprecated API endpoint ## Breaking Change ### What Changed The deprecated `/v1/old-endpoint` API has been removed. ### Impact on Users - Applications using `/v1/old-endpoint` will receive 404 errors - The replacement `/v2/new-endpoint` has been available since v1.5.0 ### Migration Guidance Replace all calls to `/v1/old-endpoint` with `/v2/new-endpoint`: ```bash # Old curl http://localhost:8080/v1/old-endpoint # New curl http://localhost:8080/v2/new-endpoint ``` See [migration guide](https://docs.restate.dev/migrate/v2) for details. ``` -------------------------------- ### List and Get Services Source: https://context7.com/restatedev/restate/llms.txt Retrieve metadata about registered services, including their type, handlers, and configuration. You can list all services or get details for a specific service, including its OpenAPI specification. ```APIDOC ## GET /services ### Description Retrieves metadata for all registered services. ### Method GET ### Endpoint `/services` ### Parameters None ### Request Example ```bash curl http://localhost:9070/services ``` ### Response #### Success Response (200) - **services** (array) - An array of service objects, each containing details like name, type, deployment ID, revision, public status, and handlers. #### Response Example ```json { "services": [ { "name": "greeter", "ty": "service", "deploymentId": "dp_14LsPzGz9HBxXIeBoH5wYg", "revision": 1, "public": true, "handlers": { "greet": { "name": "greet", "ty": "exclusive", "inputDescription": "application/json", "outputDescription": "application/json" } } } ] } ``` ## GET /services/{serviceName} ### Description Retrieves metadata for a specific registered service. ### Method GET ### Endpoint `/services/{serviceName}` ### Parameters #### Path Parameters - **serviceName** (string) - Required - The name of the service to retrieve. ### Request Example ```bash curl http://localhost:9070/services/greeter ``` ### Response #### Success Response (200) - **service** (object) - An object containing the metadata for the specified service. #### Response Example ```json { "name": "greeter", "ty": "service", "deploymentId": "dp_14LsPzGz9HBxXIeBoH5wYg", "revision": 1, "public": true, "handlers": { "greet": { "name": "greet", "ty": "exclusive", "inputDescription": "application/json", "outputDescription": "application/json" } } } ``` ## GET /services/{serviceName}/openapi ### Description Retrieves the OpenAPI specification for a specific service. ### Method GET ### Endpoint `/services/{serviceName}/openapi` ### Parameters #### Path Parameters - **serviceName** (string) - Required - The name of the service to retrieve the OpenAPI specification for. ### Request Example ```bash curl http://localhost:9070/services/greeter/openapi ``` ### Response #### Success Response (200) - **openapi_spec** (object) - The OpenAPI specification for the service. #### Response Example ```json { "openapi_spec": { ... } } ``` ``` -------------------------------- ### Run Restate Server with Docker Source: https://github.com/restatedev/restate/blob/main/README.md Launches the Restate server using a Docker container. This command maps the necessary ports and configures the container to connect to the host gateway. ```bash docker run --rm -p 8080:8080 -p 9070:9070 -p 9071:9071 \ --add-host=host.docker.internal:host-gateway docker.restate.dev/restatedev/restate:latest ``` -------------------------------- ### Manage Restate Deployments using CLI Source: https://context7.com/restatedev/restate/llms.txt This snippet demonstrates how to manage Restate deployments using the CLI. It covers registering a new deployment, listing existing deployments, and describing a specific deployment by its ID. These commands are essential for orchestrating and monitoring deployed services. ```bash # Register a deployment restate deployments register http://localhost:9080 # List deployments restate deployments list # Describe a deployment restate deployments describe dp_14LsPzGz9HBxXIeBoH5wYg ``` -------------------------------- ### Run SQL Queries using Restate CLI Source: https://context7.com/restatedev/restate/llms.txt This snippet shows how to execute SQL queries against the Restate system using the CLI. It allows direct querying of system invocation data, providing a convenient way to inspect and debug running applications without using the Admin API. ```bash # Run SQL queries restate sql "SELECT * FROM sys_invocation WHERE status = 'running'" ``` -------------------------------- ### Evaluate Lua Module in Wireshark Source: https://github.com/restatedev/restate/blob/main/tools/service-protocol-wireshark-dissector/README.md Evaluates a Lua expression within Wireshark to test the loading of a Lua module. This is used to verify if the dissector module has been correctly installed and is accessible by Wireshark. ```lua require('restate_service_protocol_decoder') ``` -------------------------------- ### Troubleshoot Build Errors with Clang (Shell) Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Resolves compilation errors, often related to GCC, by rebuilding the project with Clang. This can be made permanent by configuring Cargo to use Clang by default. ```shell CC=clang cargo build ``` ```shell # cat ~/.cargo/config.toml [env] CC = "clang" CXX = "clang++" ``` -------------------------------- ### Register Restate Service Deployments via Admin API Source: https://context7.com/restatedev/restate/llms.txt Shows how to register new service deployments with the Restate Admin API, supporting HTTP endpoints and AWS Lambda. Includes options for custom headers and forcing re-registration. Requires a running Restate server. ```bash # Register an HTTP deployment curl -X POST http://localhost:9070/deployments \ -H 'Content-Type: application/json' \ -d '{ "uri": "http://localhost:9080" }' # Response: # { # "id": "dp_14LsPzGz9HBxXIeBoH5wYg", # "services": [ # {"name": "greeter", "handlers": [...], "ty": "service"}, # {"name": "counter", "handlers": [...], "ty": "virtual_object"} # ], # "minProtocolVersion": 4, # "maxProtocolVersion": 4 # } # Register an AWS Lambda deployment curl -X POST http://localhost:9070/deployments \ -H 'Content-Type: application/json' \ -d '{ "arn": "arn:aws:lambda:us-east-1:123456789:function:my-service", "assume_role_arn": "arn:aws:iam::123456789:role/lambda-role" }' # Register with custom headers for authentication curl -X POST http://localhost:9070/deployments \ -H 'Content-Type: application/json' \ -d '{ "uri": "http://localhost:9080", "additional_headers": { "Authorization": "Bearer my-secret-token" } }' # Force re-registration (overwrite existing deployment) curl -X POST http://localhost:9070/deployments \ -H 'Content-Type: application/json' \ -d '{ "uri": "http://localhost:9080", "force": true }' ``` -------------------------------- ### Run All Benchmarks (Shell) Source: https://github.com/restatedev/restate/blob/main/benchmarks/README.md Executes all benchmarks defined in the 'restate-benchmarks' package. This command is used to initiate the testing suite for evaluating Restate's performance. ```shell cargo bench --package restate-benchmarks ``` -------------------------------- ### Configure Cargo for M1 Mac Architecture Source: https://github.com/restatedev/restate/blob/main/docs/dev/local-development.md Sets the CMAKE_OSX_ARCHITECTURES environment variable to 'arm64' in the Cargo configuration file. This ensures correct building of librdkafka on M1 Macs by preventing fat binaries. ```toml [env] # Fix architecture to arm64 to make rdkafka build. Without this env var, the # librdkafka build script will generate a fat binary that fails to be linked # on MacOS. See https://github.com/rust-lang/cargo/issues/8875 and # https://github.com/rust-lang/rust/issues/50220#issuecomment-433070637 for # more details. CMAKE_OSX_ARCHITECTURES = "arm64" ``` -------------------------------- ### Create Kafka Subscription (Bash) Source: https://context7.com/restatedev/restate/llms.txt Creates a subscription that connects a Kafka topic to a specific service handler for event processing. This enables asynchronous event-driven workflows where events from Kafka trigger actions within Restate services. The command requires the Kafka topic name and the target service handler. ```bash # Example: Create a subscription for a Kafka topic 'my-topic' to the 'process-event' handler of the 'my-service' service. # Note: The exact command structure might vary based on specific API implementation details not fully provided in the prompt. # curl -X POST http://localhost:9070/subscriptions/kafka \ # -H 'Content-Type: application/json' \ # -d '{ # "topic": "my-topic", # "service": "my-service", # "handler": "process-event" # }' ``` -------------------------------- ### Find Wireshark Lua Module Scan Path Source: https://github.com/restatedev/restate/blob/main/tools/service-protocol-wireshark-dissector/README.md Evaluates a Lua expression in Wireshark to determine the paths where Wireshark searches for Lua modules. This is a debugging step to find the correct directory for installing custom Lua modules. ```lua require('mymodule') ``` -------------------------------- ### POST /query Source: https://context7.com/restatedev/restate/llms.txt Execute SQL queries against Restate's system state and invocation data. ```APIDOC ## Admin API - SQL Query ### Description Query system state and invocation data using SQL through DataFusion. Supports JSON and Arrow stream formats for responses. ### Method POST ### Endpoint /query ### Parameters #### Request Body - **query** (string) - Required - The SQL query to execute. #### Headers - **Content-Type**: application/json - **Accept**: application/json or application/vnd.apache.arrow.stream ### Request Example ```bash # Query invocations curl -X POST http://localhost:9070/query \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "query": "SELECT id, target, status FROM sys_invocation WHERE status = "'"running"'" LIMIT 10" }' # Query service state curl -X POST http://localhost:9070/query \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "query": "SELECT service_name, service_key, key, value FROM state WHERE service_name = "'"counter"'" }' # Get Arrow stream format curl -X POST http://localhost:9070/query \ -H 'Content-Type: application/json' \ -H 'Accept: application/vnd.apache.arrow.stream' \ -d '{"query": "SELECT * FROM sys_invocation"}' ``` ### Response #### Success Response (200) - **rows** (array) - An array of result rows if Accept is application/json. - Arrow stream format if Accept is application/vnd.apache.arrow.stream. #### Response Example (JSON) ```json {"rows": [{"id": "inv_...", "target": "greeter/greet", "status": "running"}]} ``` ``` -------------------------------- ### Provision Restate Replicated Cluster with kubectl Source: https://github.com/restatedev/restate/blob/main/charts/restate-helm/README.md Explicitly provisions a Restate replicated cluster after Helm installation. This command sets the replication factor to 2 and confirms the action with '--yes'. It is executed within the 'restate' namespace on the 'restate-0' pod. ```bash kubectl exec -n restate -it restate-0 -- restatectl provision --replication 2 --yes ```