forked from Azure/device-simulation-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appsettings.ini
454 lines (366 loc) · 17.9 KB
/
appsettings.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
#
# 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 = 5000
# 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"