4.0 KiB
Orleans Configuration
This document explains how to configure Orleans usage in the Managing API.
Overview
The Managing API now always runs Orleans for infrastructure, but supports configurable grain execution through the RunOrleansGrains configuration option. This allows you to control whether Orleans grains (bots, timers, reminders) are active during runtime.
Configuration Options
1. Configuration File (appsettings.json)
Add the Orleans grain control parameter to your appsettings file:
{
"RunOrleansGrains": true
}
RunOrleansGrains: Boolean value that controls whether Orleans grains (bots, timers, reminders) are activetrue(default): Grains are active and can run timers/remindersfalse: Grains are inactive, no timers or reminders will execute
Note: Orleans infrastructure is always enabled and configured. This flag only controls grain execution.
2. Environment Variables
You can also control Orleans grain execution through environment variables:
# Enable Orleans grains (bots, timers, reminders)
export RUN_ORLEANS_GRAINS=true
# Disable Orleans grains (infrastructure still runs)
export RUN_ORLEANS_GRAINS=false
Note: Environment variables take precedence over configuration file settings.
Configuration Files
The following configuration files have been updated with Orleans grain control settings:
appsettings.json- Base configuration (RunOrleansGrains: true)appsettings.Development.json- Development configuration (RunOrleansGrains: false)appsettings.Oda.json- Oda environment (RunOrleansGrains: true)appsettings.Oda-docker.json- Oda Docker environment (RunOrleansGrains: true)appsettings.Sandbox.json- Sandbox environment (RunOrleansGrains: true)appsettings.SandboxLocal.json- Local Sandbox environment (RunOrleansGrains: true)appsettings.Production.json- Production environment (RunOrleansGrains: true)
Use Cases
Development Environment
- Set
RunOrleansGrains: falseto run Orleans infrastructure without active grains - Useful for development and testing without bot execution overhead
Testing Environment
- Set
RunOrleansGrains: falseto test Orleans infrastructure without running bots - Useful for integration testing without triggering actual trading operations
Production Environment
- Set
RunOrleansGrains: trueto enable full Orleans grain functionality - Required for production trading bot operations
Docker/Container Environment
- Use environment variables for easy configuration
- Example:
docker run -e RUN_ORLEANS_GRAINS=false ...
Implementation Details
The Orleans configuration is implemented in:
- ApiBootstrap.cs - Orleans configuration logic
- Program.cs - Application startup Orleans configuration
Security Considerations
- Orleans configuration is not sensitive and can be included in configuration files
- Environment variables provide runtime flexibility without code changes
- Default behavior maintains backward compatibility (Orleans enabled by default)
Troubleshooting
Orleans Not Starting
- Orleans infrastructure is always enabled
- Ensure PostgreSQL connection string for Orleans is configured
- Check application logs for connection errors
Grains Not Running
- Check
RunOrleansGrainsconfiguration value - Verify environment variable
RUN_ORLEANS_GRAINSis not set tofalse - Ensure Orleans infrastructure is running properly
Configuration Not Applied
- Verify configuration file syntax
- Check environment variable spelling (
RUN_ORLEANS_GRAINS) - Restart the application after configuration changes
Migration
Existing deployments will continue to work as Orleans grains are enabled by default. To control Orleans grain behavior:
Disable Grains (Keep Orleans Infrastructure)
- Add
"RunOrleansGrains": falseto your appsettings file, or - Set environment variable
RUN_ORLEANS_GRAINS=false
Development/Testing Setup
{
"RunOrleansGrains": false
}
Note: Orleans infrastructure is always enabled and cannot be disabled.