device-simulation-dotnet/WebService/appsettings.ini

455 строки
18 KiB
INI

#
# DEVELOPMENT NOTE:
#
# While developing the solution, you can override the settings below using a temporary/secondary file,
# so you don't need to modify the default configuration stored here.
#
# To do so, create an INI file, anywhere in your system, preferably outside the project to avoid
# the risk of checking the file into the repository. Name the file anything you like, e.g.
# "my-settings.ini", "simulation-dev-settings.ini" etc.
#
# Add to the file only the settings you need to override, i.e. you don't need to enter all the settings.
# Just make sure that each setting is under the right section, e.g. "[DeviceSimulationService:Logging]"
#
# Then, create an environment variable with name "PCS_DEV_APPSETTINGS" and put the complete file path in it.
# For instance "d:\temp\my_settings.ini" or "/tmp/dev-settings.ini".
#
[DeviceSimulationService]
# TCP port where to listen for web service requests. 9003 by default.
webservice_port = 9003
# Template (name) to be used for solution seeding
# e.g. multiple-simulations-template corresponds to multiple-simulations-template.json
seed_template_name = "${?PCS_SEED_TEMPLATE}"
# Folder where templates are located
seed_template_folder = ./data/templates/
# Folder where stock device models JSON files are located
# Note: when running the service with Docker, the content of the folder can be
# overridden using "volumes", e.g. to inject custom models and scripts.
device_models_folder = ./data/devicemodels/
# Folder where stock device model behavior scripts are located
device_models_scripts_folder = ./data/devicemodels/scripts/
# Folder where the service will store the custom connection string, if provided
iothub_data_folder = ./data/iothub/
[DeviceSimulationService:IoTHub]
# Azure IoT Hub connection string
# Format: HostName=_____.azure-devices.net;SharedAccessKeyName=_____;SharedAccessKey=_____
iothub_connstring = "${PCS_IOTHUB_CONNSTRING}"
# Connection string for the Azure storage account used to create and delete devices in bulk
# Format: DefaultEndpointsProtocol=https;AccountName=_____;AccountKey=_____;EndpointSuffix=core.windows.net
import_storage_account_connstring = "${PCS_AZURE_STORAGE_ACCOUNT}"
# Timeout for the SDK client. By default the SDK uses 4 minutes (240000 msecs).
sdk_device_client_timeout = 20000
# The user-agent string is used to identify the application to Azure IoT Hub.
user_agent = "${?PCS_SOLUTION_TYPE}"
# Disable device twin read/writes, to reduce the number of threads and open connections
# Default: true
device_twin_enabled = "${?PCS_TWIN_READ_WRITE_ENABLED}"
# Disable device methods, to reduce the number of threads and open connections
# Default: true
c2d_methods_enabled = "${?PCS_C2D_METHODS_ENABLED}"
[StorageAdapterService]
# URL where the storage adapter is available, e.g. http://localhost:9022/v1 on local dev environments
webservice_url = "${PCS_STORAGEADAPTER_WEBSERVICE_URL}"
# Max time allowed for requests to the storage adapter before reporting an error
webservice_timeout = 10000
[AzureManagementService]
# URL where the azure management api is available.
webservice_url = "https://management.azure.com"
# Max time allowed for requests to the azure management service before reporting an error.
# Value in milliseconds
webservice_timeout = 10000
# Api version
api_version = "2015-11-01"
[DeviceSimulationService:AzureActiveDirectory]
# Azure Active Directory Id
tenant_id = "${?PCS_WEBUI_AUTH_AAD_TENANT}"
# AAD application id.
app_id = "${?PCS_AUTH_AUDIENCE}"
# AAD application key.
app_secret = "${?PCS_AAD_SECRET}"
# Service principal id.
client_sp_id = "${?PCS_AAD_CLIENT_SP_ID}"
# URL used to fetch AAD token.
access_token_url = "https://login.microsoftonline.com"
[DeviceSimulationService:Storage:Main]
# Type of storage used to store this data
# Possible values (not case sensitive): CosmosDbSql, TableStorage
type = "CosmosDbSql"
# Cosmos DB SQL (prev. known as DocumentDb) connection string,
# Format: AccountEndpoint=https://_____.documents.azure.com:443/;AccountKey=_____;
cosmosdbsql_connstring = "${PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING}"
cosmosdbsql_database = "devicesimulation"
cosmosdbsql_collection = "main"
# CosmosDb throughput, see https://docs.microsoft.com/azure/cosmos-db/request-units
# Default: 400
cosmosdbsql_collection_throughput = 400
# Max number of concurrent requests when running tasks in parallel
# The default value is 25
max_pending_storage_tasks = 25
[DeviceSimulationService:Storage:Nodes]
# Type of storage used to store this data
# Possible values (not case sensitive): CosmosDbSql, TableStorage
type = "CosmosDbSql"
# Cosmos DB SQL (prev. known as DocumentDb) connection string,
# Format: AccountEndpoint=https://_____.documents.azure.com:443/;AccountKey=_____;
cosmosdbsql_connstring = "${PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING}"
cosmosdbsql_database = "devicesimulation"
cosmosdbsql_collection = "nodes"
# CosmosDb throughput, see https://docs.microsoft.com/azure/cosmos-db/request-units
# Default: 400
cosmosdbsql_collection_throughput = 400
# Max number of concurrent requests when running tasks in parallel
# Default: 25
max_pending_storage_tasks = 25
[DeviceSimulationService:Storage:Simulations]
# Type of storage used to store this data
# Possible values (not case sensitive): CosmosDbSql, TableStorage
type = "CosmosDbSql"
# Cosmos DB SQL (prev. known as DocumentDb) connection string,
# Format: AccountEndpoint=https://_____.documents.azure.com:443/;AccountKey=_____;
cosmosdbsql_connstring = "${PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING}"
cosmosdbsql_database = "devicesimulation"
cosmosdbsql_collection = "simulations"
# CosmosDb throughput, see https://docs.microsoft.com/azure/cosmos-db/request-units
# Default: 400
cosmosdbsql_collection_throughput = 400
# Max number of concurrent requests when running tasks in parallel
# Default: 25
max_pending_storage_tasks = 25
[DeviceSimulationService:Storage:Devices]
# Type of storage used to store this data
# Possible values (not case sensitive): CosmosDbSql, TableStorage
type = "CosmosDbSql"
# Cosmos DB SQL (prev. known as DocumentDb) connection string,
# Format: AccountEndpoint=https://_____.documents.azure.com:443/;AccountKey=_____;
cosmosdbsql_connstring = "${PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING}"
cosmosdbsql_database = "devicesimulation"
cosmosdbsql_collection = "devices"
# CosmosDb throughput, see https://docs.microsoft.com/azure/cosmos-db/request-units
# Default: 400, Recommended: 2500
cosmosdbsql_collection_throughput = 2500
# Max number of concurrent requests when running tasks in parallel
# Default: 25
max_pending_storage_tasks = 25
[DeviceSimulationService:Storage:Partitions]
# Type of storage used to store this data
# Possible values (not case sensitive): CosmosDbSql, TableStorage
type = "TableStorage"
# Azure Storage Account connection string,
# Format: DefaultEndpointsProtocol=https;AccountName=_____;AccountKey=_____;EndpointSuffix=core.windows.net
azuretablestorage_connstring = "${PCS_AZURE_STORAGE_ACCOUNT}"
azuretablestorage_table = "partitions"
# Max number of concurrent requests when running tasks in parallel
# Default: 25
max_pending_storage_tasks = 25
[DeviceSimulationService:Storage:Statistics]
# Type of storage used to store this data
# Possible values (not case sensitive): CosmosDbSql, TableStorage
type = "CosmosDbSql"
# Cosmos DB SQL (prev. known as DocumentDb) connection string,
# Format: AccountEndpoint=https://_____.documents.azure.com:443/;AccountKey=_____;
cosmosdbsql_connstring = "${PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING}"
cosmosdbsql_database = "devicesimulation"
cosmosdbsql_collection = "statistics"
# CosmosDb throughput, see https://docs.microsoft.com/azure/cosmos-db/request-units
# Default: 400, Recommended: 2500
cosmosdbsql_collection_throughput = 2500
# Max number of concurrent requests when running tasks in parallel
# Default: 25
max_pending_storage_tasks = 25
[DeviceSimulationService:Storage:ReplayFiles]
# Type of storage used to store this data
# Possible values (not case sensitive): CosmosDbSql, TableStorage
type = "CosmosDbSql"
# Cosmos DB SQL (prev. known as DocumentDb) connection string,
# Format: AccountEndpoint=https://_____.documents.azure.com:443/;AccountKey=_____;
cosmosdbsql_connstring = "${PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING}"
cosmosdbsql_database = "devicesimulation"
cosmosdbsql_collection = "replayFiles"
# CosmosDb throughput, see https://docs.microsoft.com/azure/cosmos-db/request-units
# Default: 400, Recommended: 2500
cosmosdbsql_collection_throughput = 2500
# Max number of concurrent requests when running tasks in parallel
# Default: 25
max_pending_storage_tasks = 25
[DeviceSimulationService:Deployment]
# AAD Domain of the Azure subscription where the Azure IoT Hub is deployed.
# The value is optional because the service can be deployed without a hub.
# The info is used to create a URL taking to the IoT Hub metrics in the Azure portal.
azure_subscription_domain = "${?PCS_SUBSCRIPTION_DOMAIN}"
# Azure subscription where the Azure IoT Hub is deployed, e.g. "mytest.onmicrosoft.com".
# The value is optional because the service can be deployed without a hub.
# The value is used to create a URL taking to the IoT Hub metrics in the Azure portal.
azure_subscription_id = "${?PCS_SUBSCRIPTION_ID}"
# Azure resource group where the Azure IoT Hub is deployed, e.g. "abcd1234-5678-1234-abcd-abcd5678abcd".
# The value is optional because the service can be deployed without a hub.
# The value is used to create a URL taking to the IoT Hub metrics in the Azure portal.
azure_resource_group = "${?PCS_RESOURCE_GROUP}"
# IoT Hub name, e.g. "mytest3507e89".
# The value is optional because the service can be deployed without a hub.
# The value is used to create a URL taking to the IoT Hub metrics in the Azure portal.
azure_iothub_name = "${?PCS_IOHUB_NAME}"
# Location where azure resource group is deployed, e.g "East US".
# The value is used to update auto scale settings on vmss on simulation start and stop.
azure_resource_group_location = "${?PCS_RESOURCE_GROUP_LOCATION}"
# Name of VMSS resource. E.g "test_vmss"
# The value is used to update auto scale settings on vmss on simulation start and stop.
azure_vmss_name = "${?PCS_VMSS_NAME}"
[DeviceSimulationService:Logging]
# Application log levels: Debug, Info, Warn, Error
# Default: Warn
LogLevel = "${?PCS_LOG_LEVEL}"
# Whether to log the ProcessId, true by default
IncludeProcessId = true
# How to format the datetime in the logs
# example: DateFormat = "yyyy-MM-dd HH:mm:ss.fff"
DateFormat = "yyyy-MM-dd HH:mm:ss.fff"
# Comma separated list of files and methods to ignore, i.e. discard logs from. Not case sensitive.
# Example: BlackListSources = "DeviceClient.cs,HttpClient.cs:DeleteAsync"
BlackListSources = ""
# Comma separated list of files and methods to include, i.e. discard everything else. Not case sensitive.
# Example: WhiteListSources = "DeviceMethods.cs,Simulations.cs:InsertAsync"
WhiteListSources = ""
# Whether to generate extra log files to diagnose the simulation. This is disk I/O intensive
# and most likely affects the simulation performance. Enable this option only for development
# to get detailed information about the state of each actor and each device.
# Default: false
ExtraDiagnostics = false
# Folder to store the extra diagnostics. Logging is disabled if the folder cannot
# be created or is not writable.
ExtraDiagnosticsPath = "/tmp/sim/"
# Path to the diagnostics back end where all telemetry data is to be directed
diagnostics_endpoint_url = "${?PCS_DIAGNOSTICS_WEBSERVICE_URL}/diagnosticsevents"
[DeviceSimulationService:RateLimits]
# S3: 5000/min/unit (= 83.3/sec/unit)
# S2: 100/min/unit (= 1.67/sec/unit)
# S1: 100/min/unit (= 1.67/sec/unit)
# F1: 100/min (= 1.67/sec)
registry_operations_per_minute = 100
# S3: 6000/sec/unit
# S2: 120/sec/unit
# S1: higher of 100/sec or 12/sec/unit
# F1: 100/sec
device_connections_per_second = 120
# S3: 6000/sec/unit
# S2: 120/sec/unit
# S1: higher of 100/sec or 12/sec/unit
# F1: 100/sec
device_to_cloud_messages_per_second = 120
# S3: 50/sec/unit
# S2: higher of 10/sec or 1/sec/unit
# S1: 10/sec
# F1: 10/sec
twin_reads_per_second = 10
# S3: 50/sec/unit
# S2: higher of 10/sec or 1/sec/unit
# S1: 10/sec
# F1: 10/sec
twin_writes_per_second = 10
[DeviceSimulationService:SimulationConcurrency]
# How many threads to use to send telemetry.
# A value too high (e.g. > 10) can decrease the overall throughput due to context switching.
# A value too low (e.g. < 2) can decrease the overall throughput due to the time required to
# loop through all the devices, when managing several thousands of devices.
# Default: 4
telemetry_threads = 4
# While connecting all the devices, limit the number of connections waiting to be
# established. A low number will slow down the time required to connect all the devices.
# A number too high will increase the number of threads, overloading the CPU.
# Default: 200
max_pending_connections = 200
# While sending telemetry, limit the number of messages waiting to be delivered.
# A low number will slow down the simulation.
# A number too high will increase the number of threads, overloading the CPU.
# Value in milliseconds - Default: 1000
max_pending_telemetry_messages = 1000
# While writing device twins, limit the number of pending operations waiting to be completed.
# Default: 50
max_pending_twin_writes = 50
# When simulating behavior for all the devices in a thread, slow down if the loop through
# all the devices takes fewer than N msecs. This is also the minimum time between two
# state changes for the same device.
# Value in milliseconds - Default: 1000
min_device_state_loop_duration = 1000
# When connecting the devices, slow down if the loop through all the devices takes fewer
# than N msecs.
# Value in milliseconds - Default: 1000
min_device_connection_loop_duration = 1000
# When sending telemetry for all the devices in a thread, slow down if the loop through
# all the devices takes fewer than N msecs. This is also the minimum time between two
# messages from the same device.
# Value in milliseconds - Default: 500
min_device_telemetry_loop_duration = 500
# When writing device twins for all the devices in a thread, slow down if the loop through
# all the devices takes fewer than N msecs.
# Value in milliseconds - Default: 2000
min_device_properties_loop_duration = 2000
[DeviceSimulationService:Clustering]
# How often to:
# - refresh the nodes collection to keep the node alive
# - (as a master node) remove stale nodes from the cluster
# - (as a master node) check for new simulations and devices to create
# - (as a master node) check for new simulations and partitions to create
# Value in milliseconds - Default: 10000, Min: 1000, Max: 300000
check_interval = 10000
# When a node record is older than this value, the node is considered dead and removed
# from the list of known nodes. The value should be at least twice that of `check_interval`.
# Value in milliseconds - Default: 60000, Min: 10000, Max: 600000
node_record_max_age = 60000
# When a node is elected to master via a lock, the max age of the lock before it expires,
# allowing another node to become master in case the current master crashes
# Value in milliseconds - Default: 120000, Min: 10000, Max: 300000
master_lock_duration = 120000
# Each partition contains up to 1000 devices by default (ignoring deletions)
# Note that a number bigger than ~10000 can cause errors when storing partitions
# in Azure Tables due to the records size limit of 1MB.
# Default: 1000, Min: 1, Max: 10000
max_partition_size = 3000
# Limit the amount of devices per node
# Default: 20000, Min: 1, Max: 1000000
max_devices_per_node = 20000
[DeviceSimulationService:ClientAuth]
# Current auth type, only "JWT" is currently supported.
auth_type = "JWT"
# This can be changed to false, for example during development,
# to allow invalid/missing authorizations.
# Default: true
auth_required = "${?PCS_AUTH_REQUIRED}"
# Can be used when running services on multiple hostnames and/or ports
# e.g. "{ 'origins': ['*'], 'methods': ['*'], 'headers': ['*'] }" to allow everything.
# Comment it or leave it empty to disable CORS.
# Default: empty
cors_whitelist = "${?PCS_CORS_WHITELIST}"
[DeviceSimulationService:ClientAuth:JWT]
# Trusted algorithms
# Default: RS256, RS384, RS512
allowed_algorithms = "RS256"
# Identifies the security token service (STS) that constructs and returns the token.
# In the tokens that Azure AD returns, the issuer is sts.windows.net. The GUID in
# the Issuer claim value is the tenant ID of the Azure AD directory. The tenant ID
# is an immutable and reliable identifier of the directory.
# Used to verify that tokens are issued by Azure AD.
# When using Azure Active Directory, the format of the Issuer is:
# https://sts.windows.net/<tenant Id>/
# example: issuer="https://sts.windows.net/fa01ade2-2365-4dd1-a084-a6ef027090fc/"
issuer = "${?PCS_AUTH_ISSUER}"
# Used to verify that tokens are issued to be given to this service
# Also referenced as "Application Id" and "Resource Id"
# example: audience="2814e709-6a0e-4861-9594-d3b6e2b81331"
audience = "${?PCS_AUTH_AUDIENCE}"
# When validating the token expiration, allows some clock skew
# Default: 2 minutes
clock_skew_seconds = 300
# Use this section to disable parts of the application while debugging or developing
# new features. It's recommended to enable these using "appsettings.dev.ini" instead
# of using this file. See the note at the top of this file.
[DeviceSimulationService:Debugging]
# In development mode the application executes some extra correctness checks at runtime,
# using more memory and reducing the overall performance. Do not use it in Production.
# Default: false
development_mode = false
# Default: false
disable_simulation_agent = false
# Default: false
disable_partitioning_agent = false
# Default: false
disable_seed_by_template = false
# For more information about ASP.NET logging see
# https://docs.microsoft.com/aspnet/core/fundamentals/logging
# This configuration block is used only to capture
# internal logs generated by ASP.NET
# ASP.NET log levels: Trace, Debug, Information, Warning, Error, Critical
[Logging]
IncludeScopes = true
LogLevel:Default = "Warning"
LogLevel:System = "Warning"
LogLevel:Microsoft = "Warning"