@streamr/node 100.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/LICENSE +78 -0
  2. package/README.md +54 -0
  3. package/bin/broker.ts +36 -0
  4. package/bin/config-wizard.js +4 -0
  5. package/bin/config-wizard.ts +17 -0
  6. package/bin/delete-expired-data.ts +41 -0
  7. package/bin/entry-point.ts +27 -0
  8. package/configs/development-1.env.json +68 -0
  9. package/configs/development-2.env.json +53 -0
  10. package/configs/development-3.env.json +53 -0
  11. package/configs/development-prod-resend.env.json +21 -0
  12. package/configs/docker-1.env.json +72 -0
  13. package/configs/docker-2.env.json +58 -0
  14. package/configs/docker-3.env.json +58 -0
  15. package/configuration.md +38 -0
  16. package/dist/bin/broker.d.ts +2 -0
  17. package/dist/bin/broker.js +42 -0
  18. package/dist/bin/broker.js.map +1 -0
  19. package/dist/bin/config-wizard.d.ts +2 -0
  20. package/dist/bin/config-wizard.js +22 -0
  21. package/dist/bin/config-wizard.js.map +1 -0
  22. package/dist/bin/delete-expired-data.d.ts +2 -0
  23. package/dist/bin/delete-expired-data.js +44 -0
  24. package/dist/bin/delete-expired-data.js.map +1 -0
  25. package/dist/bin/entry-point.d.ts +2 -0
  26. package/dist/bin/entry-point.js +28 -0
  27. package/dist/bin/entry-point.js.map +1 -0
  28. package/dist/package.json +78 -0
  29. package/dist/src/Plugin.d.ts +33 -0
  30. package/dist/src/Plugin.js +43 -0
  31. package/dist/src/Plugin.js.map +1 -0
  32. package/dist/src/apiAuthentication.d.ts +4 -0
  33. package/dist/src/apiAuthentication.js +16 -0
  34. package/dist/src/apiAuthentication.js.map +1 -0
  35. package/dist/src/broker.d.ts +8 -0
  36. package/dist/src/broker.js +69 -0
  37. package/dist/src/broker.js.map +1 -0
  38. package/dist/src/config/ConfigWizard.d.ts +5 -0
  39. package/dist/src/config/ConfigWizard.js +466 -0
  40. package/dist/src/config/ConfigWizard.js.map +1 -0
  41. package/dist/src/config/config.d.ts +26 -0
  42. package/dist/src/config/config.js +92 -0
  43. package/dist/src/config/config.js.map +1 -0
  44. package/dist/src/config/config.schema.json +86 -0
  45. package/dist/src/config/definitions.schema.json +35 -0
  46. package/dist/src/config/migration.d.ts +6 -0
  47. package/dist/src/config/migration.js +210 -0
  48. package/dist/src/config/migration.js.map +1 -0
  49. package/dist/src/config/validateConfig.d.ts +4 -0
  50. package/dist/src/config/validateConfig.js +40 -0
  51. package/dist/src/config/validateConfig.js.map +1 -0
  52. package/dist/src/exports.d.ts +3 -0
  53. package/dist/src/exports.js +6 -0
  54. package/dist/src/exports.js.map +1 -0
  55. package/dist/src/helpers/PayloadFormat.d.ts +19 -0
  56. package/dist/src/helpers/PayloadFormat.js +85 -0
  57. package/dist/src/helpers/PayloadFormat.js.map +1 -0
  58. package/dist/src/helpers/applyPluginClientConfigs.d.ts +3 -0
  59. package/dist/src/helpers/applyPluginClientConfigs.js +29 -0
  60. package/dist/src/helpers/applyPluginClientConfigs.js.map +1 -0
  61. package/dist/src/helpers/fetchOrThrow.d.ts +2 -0
  62. package/dist/src/helpers/fetchOrThrow.js +20 -0
  63. package/dist/src/helpers/fetchOrThrow.js.map +1 -0
  64. package/dist/src/helpers/generateMnemonicFromAddress.d.ts +5 -0
  65. package/dist/src/helpers/generateMnemonicFromAddress.js +16 -0
  66. package/dist/src/helpers/generateMnemonicFromAddress.js.map +1 -0
  67. package/dist/src/helpers/multiply.d.ts +1 -0
  68. package/dist/src/helpers/multiply.js +10 -0
  69. package/dist/src/helpers/multiply.js.map +1 -0
  70. package/dist/src/helpers/parser.d.ts +9 -0
  71. package/dist/src/helpers/parser.js +62 -0
  72. package/dist/src/helpers/parser.js.map +1 -0
  73. package/dist/src/helpers/partitions.d.ts +8 -0
  74. package/dist/src/helpers/partitions.js +32 -0
  75. package/dist/src/helpers/partitions.js.map +1 -0
  76. package/dist/src/helpers/weightedSample.d.ts +16 -0
  77. package/dist/src/helpers/weightedSample.js +35 -0
  78. package/dist/src/helpers/weightedSample.js.map +1 -0
  79. package/dist/src/httpServer.d.ts +16 -0
  80. package/dist/src/httpServer.js +71 -0
  81. package/dist/src/httpServer.js.map +1 -0
  82. package/dist/src/pluginRegistry.d.ts +3 -0
  83. package/dist/src/pluginRegistry.js +35 -0
  84. package/dist/src/pluginRegistry.js.map +1 -0
  85. package/dist/src/plugins/consoleMetrics/ConsoleMetricsPlugin.d.ts +12 -0
  86. package/dist/src/plugins/consoleMetrics/ConsoleMetricsPlugin.js +36 -0
  87. package/dist/src/plugins/consoleMetrics/ConsoleMetricsPlugin.js.map +1 -0
  88. package/dist/src/plugins/consoleMetrics/config.schema.json +18 -0
  89. package/dist/src/plugins/http/HttpPlugin.d.ts +8 -0
  90. package/dist/src/plugins/http/HttpPlugin.js +23 -0
  91. package/dist/src/plugins/http/HttpPlugin.js.map +1 -0
  92. package/dist/src/plugins/http/config.schema.json +12 -0
  93. package/dist/src/plugins/http/publishEndpoint.d.ts +3 -0
  94. package/dist/src/plugins/http/publishEndpoint.js +72 -0
  95. package/dist/src/plugins/http/publishEndpoint.js.map +1 -0
  96. package/dist/src/plugins/info/InfoPlugin.d.ts +9 -0
  97. package/dist/src/plugins/info/InfoPlugin.js +31 -0
  98. package/dist/src/plugins/info/InfoPlugin.js.map +1 -0
  99. package/dist/src/plugins/info/config.schema.json +12 -0
  100. package/dist/src/plugins/mqtt/Bridge.d.ts +40 -0
  101. package/dist/src/plugins/mqtt/Bridge.js +136 -0
  102. package/dist/src/plugins/mqtt/Bridge.js.map +1 -0
  103. package/dist/src/plugins/mqtt/MqttPlugin.d.ts +14 -0
  104. package/dist/src/plugins/mqtt/MqttPlugin.js +30 -0
  105. package/dist/src/plugins/mqtt/MqttPlugin.js.map +1 -0
  106. package/dist/src/plugins/mqtt/MqttServer.d.ts +22 -0
  107. package/dist/src/plugins/mqtt/MqttServer.js +109 -0
  108. package/dist/src/plugins/mqtt/MqttServer.js.map +1 -0
  109. package/dist/src/plugins/mqtt/config.schema.json +26 -0
  110. package/dist/src/plugins/operator/ConsistentHashRing.d.ts +20 -0
  111. package/dist/src/plugins/operator/ConsistentHashRing.js +64 -0
  112. package/dist/src/plugins/operator/ConsistentHashRing.js.map +1 -0
  113. package/dist/src/plugins/operator/ContractFacade.d.ts +80 -0
  114. package/dist/src/plugins/operator/ContractFacade.js +364 -0
  115. package/dist/src/plugins/operator/ContractFacade.js.map +1 -0
  116. package/dist/src/plugins/operator/MaintainTopologyHelper.d.ts +23 -0
  117. package/dist/src/plugins/operator/MaintainTopologyHelper.js +75 -0
  118. package/dist/src/plugins/operator/MaintainTopologyHelper.js.map +1 -0
  119. package/dist/src/plugins/operator/MaintainTopologyService.d.ts +11 -0
  120. package/dist/src/plugins/operator/MaintainTopologyService.js +57 -0
  121. package/dist/src/plugins/operator/MaintainTopologyService.js.map +1 -0
  122. package/dist/src/plugins/operator/OperatorFleetState.d.ts +33 -0
  123. package/dist/src/plugins/operator/OperatorFleetState.js +112 -0
  124. package/dist/src/plugins/operator/OperatorFleetState.js.map +1 -0
  125. package/dist/src/plugins/operator/OperatorPlugin.d.ts +50 -0
  126. package/dist/src/plugins/operator/OperatorPlugin.js +159 -0
  127. package/dist/src/plugins/operator/OperatorPlugin.js.map +1 -0
  128. package/dist/src/plugins/operator/StreamPartAssignments.d.ts +28 -0
  129. package/dist/src/plugins/operator/StreamPartAssignments.js +104 -0
  130. package/dist/src/plugins/operator/StreamPartAssignments.js.map +1 -0
  131. package/dist/src/plugins/operator/announceNodeToContract.d.ts +3 -0
  132. package/dist/src/plugins/operator/announceNodeToContract.js +39 -0
  133. package/dist/src/plugins/operator/announceNodeToContract.js.map +1 -0
  134. package/dist/src/plugins/operator/announceNodeToStream.d.ts +3 -0
  135. package/dist/src/plugins/operator/announceNodeToStream.js +25 -0
  136. package/dist/src/plugins/operator/announceNodeToStream.js.map +1 -0
  137. package/dist/src/plugins/operator/checkOperatorValueBreach.d.ts +2 -0
  138. package/dist/src/plugins/operator/checkOperatorValueBreach.js +21 -0
  139. package/dist/src/plugins/operator/checkOperatorValueBreach.js.map +1 -0
  140. package/dist/src/plugins/operator/closeExpiredFlags.d.ts +3 -0
  141. package/dist/src/plugins/operator/closeExpiredFlags.js +24 -0
  142. package/dist/src/plugins/operator/closeExpiredFlags.js.map +1 -0
  143. package/dist/src/plugins/operator/config.schema.json +152 -0
  144. package/dist/src/plugins/operator/createIsLeaderFn.d.ts +4 -0
  145. package/dist/src/plugins/operator/createIsLeaderFn.js +14 -0
  146. package/dist/src/plugins/operator/createIsLeaderFn.js.map +1 -0
  147. package/dist/src/plugins/operator/fetchRedundancyFactor.d.ts +2 -0
  148. package/dist/src/plugins/operator/fetchRedundancyFactor.js +43 -0
  149. package/dist/src/plugins/operator/fetchRedundancyFactor.js.map +1 -0
  150. package/dist/src/plugins/operator/formCoordinationStreamId.d.ts +3 -0
  151. package/dist/src/plugins/operator/formCoordinationStreamId.js +9 -0
  152. package/dist/src/plugins/operator/formCoordinationStreamId.js.map +1 -0
  153. package/dist/src/plugins/operator/heartbeatUtils.d.ts +67 -0
  154. package/dist/src/plugins/operator/heartbeatUtils.js +26 -0
  155. package/dist/src/plugins/operator/heartbeatUtils.js.map +1 -0
  156. package/dist/src/plugins/operator/inspectOverTime.d.ts +22 -0
  157. package/dist/src/plugins/operator/inspectOverTime.js +146 -0
  158. package/dist/src/plugins/operator/inspectOverTime.js.map +1 -0
  159. package/dist/src/plugins/operator/inspectRandomNode.d.ts +8 -0
  160. package/dist/src/plugins/operator/inspectRandomNode.js +44 -0
  161. package/dist/src/plugins/operator/inspectRandomNode.js.map +1 -0
  162. package/dist/src/plugins/operator/inspectionUtils.d.ts +23 -0
  163. package/dist/src/plugins/operator/inspectionUtils.js +120 -0
  164. package/dist/src/plugins/operator/inspectionUtils.js.map +1 -0
  165. package/dist/src/plugins/operator/maintainOperatorValue.d.ts +2 -0
  166. package/dist/src/plugins/operator/maintainOperatorValue.js +21 -0
  167. package/dist/src/plugins/operator/maintainOperatorValue.js.map +1 -0
  168. package/dist/src/plugins/operator/reviewSuspectNode.d.ts +24 -0
  169. package/dist/src/plugins/operator/reviewSuspectNode.js +56 -0
  170. package/dist/src/plugins/operator/reviewSuspectNode.js.map +1 -0
  171. package/dist/src/plugins/storage/Batch.d.ts +51 -0
  172. package/dist/src/plugins/storage/Batch.js +121 -0
  173. package/dist/src/plugins/storage/Batch.js.map +1 -0
  174. package/dist/src/plugins/storage/BatchManager.d.ts +27 -0
  175. package/dist/src/plugins/storage/BatchManager.js +117 -0
  176. package/dist/src/plugins/storage/BatchManager.js.map +1 -0
  177. package/dist/src/plugins/storage/Bucket.d.ts +23 -0
  178. package/dist/src/plugins/storage/Bucket.js +90 -0
  179. package/dist/src/plugins/storage/Bucket.js.map +1 -0
  180. package/dist/src/plugins/storage/BucketManager.d.ts +56 -0
  181. package/dist/src/plugins/storage/BucketManager.js +306 -0
  182. package/dist/src/plugins/storage/BucketManager.js.map +1 -0
  183. package/dist/src/plugins/storage/DataQueryFormat.d.ts +10 -0
  184. package/dist/src/plugins/storage/DataQueryFormat.js +51 -0
  185. package/dist/src/plugins/storage/DataQueryFormat.js.map +1 -0
  186. package/dist/src/plugins/storage/DeleteExpiredCmd.d.ts +28 -0
  187. package/dist/src/plugins/storage/DeleteExpiredCmd.js +155 -0
  188. package/dist/src/plugins/storage/DeleteExpiredCmd.js.map +1 -0
  189. package/dist/src/plugins/storage/SetMembershipSynchronizer.d.ts +33 -0
  190. package/dist/src/plugins/storage/SetMembershipSynchronizer.js +102 -0
  191. package/dist/src/plugins/storage/SetMembershipSynchronizer.js.map +1 -0
  192. package/dist/src/plugins/storage/Storage.d.ts +47 -0
  193. package/dist/src/plugins/storage/Storage.js +459 -0
  194. package/dist/src/plugins/storage/Storage.js.map +1 -0
  195. package/dist/src/plugins/storage/StorageConfig.d.ts +43 -0
  196. package/dist/src/plugins/storage/StorageConfig.js +83 -0
  197. package/dist/src/plugins/storage/StorageConfig.js.map +1 -0
  198. package/dist/src/plugins/storage/StorageEventListener.d.ts +17 -0
  199. package/dist/src/plugins/storage/StorageEventListener.js +46 -0
  200. package/dist/src/plugins/storage/StorageEventListener.js.map +1 -0
  201. package/dist/src/plugins/storage/StoragePlugin.d.ts +32 -0
  202. package/dist/src/plugins/storage/StoragePlugin.js +103 -0
  203. package/dist/src/plugins/storage/StoragePlugin.js.map +1 -0
  204. package/dist/src/plugins/storage/StoragePoller.d.ts +15 -0
  205. package/dist/src/plugins/storage/StoragePoller.js +47 -0
  206. package/dist/src/plugins/storage/StoragePoller.js.map +1 -0
  207. package/dist/src/plugins/storage/config.schema.json +88 -0
  208. package/dist/src/plugins/storage/dataMetadataEndpoint.d.ts +3 -0
  209. package/dist/src/plugins/storage/dataMetadataEndpoint.js +35 -0
  210. package/dist/src/plugins/storage/dataMetadataEndpoint.js.map +1 -0
  211. package/dist/src/plugins/storage/dataQueryEndpoint.d.ts +6 -0
  212. package/dist/src/plugins/storage/dataQueryEndpoint.js +181 -0
  213. package/dist/src/plugins/storage/dataQueryEndpoint.js.map +1 -0
  214. package/dist/src/plugins/storage/storageConfigEndpoint.d.ts +3 -0
  215. package/dist/src/plugins/storage/storageConfigEndpoint.js +31 -0
  216. package/dist/src/plugins/storage/storageConfigEndpoint.js.map +1 -0
  217. package/dist/src/plugins/subscriber/SubscriberPlugin.d.ts +16 -0
  218. package/dist/src/plugins/subscriber/SubscriberPlugin.js +22 -0
  219. package/dist/src/plugins/subscriber/SubscriberPlugin.js.map +1 -0
  220. package/dist/src/plugins/subscriber/config.schema.json +31 -0
  221. package/dist/src/plugins/websocket/Connection.d.ts +9 -0
  222. package/dist/src/plugins/websocket/Connection.js +45 -0
  223. package/dist/src/plugins/websocket/Connection.js.map +1 -0
  224. package/dist/src/plugins/websocket/PublishConnection.d.ts +12 -0
  225. package/dist/src/plugins/websocket/PublishConnection.js +46 -0
  226. package/dist/src/plugins/websocket/PublishConnection.js.map +1 -0
  227. package/dist/src/plugins/websocket/SubscribeConnection.d.ts +13 -0
  228. package/dist/src/plugins/websocket/SubscribeConnection.js +50 -0
  229. package/dist/src/plugins/websocket/SubscribeConnection.js.map +1 -0
  230. package/dist/src/plugins/websocket/WebsocketPlugin.d.ts +19 -0
  231. package/dist/src/plugins/websocket/WebsocketPlugin.js +26 -0
  232. package/dist/src/plugins/websocket/WebsocketPlugin.js.map +1 -0
  233. package/dist/src/plugins/websocket/WebsocketServer.d.ts +16 -0
  234. package/dist/src/plugins/websocket/WebsocketServer.js +132 -0
  235. package/dist/src/plugins/websocket/WebsocketServer.js.map +1 -0
  236. package/dist/src/plugins/websocket/config.schema.json +51 -0
  237. package/package.json +78 -0
  238. package/plugins.md +318 -0
package/LICENSE ADDED
@@ -0,0 +1,78 @@
1
+ STREAMR NETWORK OPEN SOURCE LICENSE
2
+ -----------------------------------
3
+
4
+ PREAMBLE
5
+
6
+ This software is licensed under the Streamr Network Open
7
+ Source License. The Streamr Network Open Source License is
8
+ based on the GNU Affero General Public License, version 3
9
+ (19 November 2007), but it contains a few additional
10
+ limitations and requirements.
11
+
12
+ The main addition is the introduction of operating parameters
13
+ which apply to the software. These parameters may induce the
14
+ use of specific cryptographic tokens (such as the Streamr
15
+ DATAcoin) in the operations of the Streamr Network. Doing so
16
+ protects the considerable effort already undertaken by the
17
+ Streamr community.
18
+
19
+ These license terms allow you to create, modify and propagate
20
+ new versions of the Streamr Network software (“Program”). Any
21
+ copy or modified version shall always comply with certain
22
+ network operating parameters, as amended from time to time.
23
+ In a manner to be determined in the future, it is Streamr’s
24
+ intention to decentralize the governance and decision-making
25
+ processes relating to the network operating parameters. The
26
+ Streamr Network is also available under a proprietary
27
+ commercial license pursuant to a dual licensing scheme.
28
+ Please contact Streamr directly at contact@streamr.network if
29
+ you are interested in such a proprietary license.
30
+
31
+ ADDITIONAL TERMS
32
+
33
+ 1. These additional terms (“Additional Terms”) shall be in
34
+ addition to and have precedence over the GNU Affero General
35
+ Public License, Version 3 (“License Terms”). The License Terms
36
+ shall be deemed to be incorporated herein as a material part
37
+ of these Additional Terms. Any capitalized terms herein shall
38
+ have the meaning given to them in the License Terms.
39
+
40
+ 2. Unless explicitly otherwise stated in these Additional
41
+ Terms, the License Terms shall be applicable on and govern
42
+ your use, modification and propagation of the Program.
43
+
44
+ 3. Definitions:
45
+
46
+ a. “Supported Parameters” means the operating parameters
47
+ of the Program that are indicated in the smart contract
48
+ pointed to by Ethereum Name Service (ENS) registry entry
49
+ network-parameters.streamr.eth from time to time.
50
+
51
+ b. “Reference Versions” means the minimum version number
52
+ of the Program that is indicated in the Supported Parameters
53
+ as well as any newer version of the Program (as indicated
54
+ by a higher version number).
55
+
56
+ c. “DATA” means the Streamr DATAcoin cryptographic token,
57
+ in each case as set out in and as supported by the Supported
58
+ Parameters from time to time.
59
+
60
+ 4. Subject to Section 5, any modified version of the Program
61
+ shall incorporate and implement all of, and only operate in
62
+ accordance with, the Supported Parameters, as implemented in
63
+ the Reference Versions. For the avoidance of doubt, as an
64
+ example, if the modified version involves the use of crypto-
65
+ graphic tokens (such as DATA), such tokens must be set out in
66
+ the Supported Parameters. Any breach of this Section 4 is
67
+ considered a material breach of these Additional Terms.
68
+
69
+ 5. Notwithstanding anything to the contrary in Section 4,
70
+ modification and propagation of the Program for development
71
+ and testing purposes (meaning e.g., creation of small-scale
72
+ prototypes or proofs of concept) is allowed without implementing
73
+ the Supported Parameters; provided, however, that the use of
74
+ such modified version shall be limited only to the time period
75
+ necessary for such development or testing purposes.
76
+
77
+ 6. Any violation or breach of these Additional Terms shall be
78
+ deemed a violation or breach of the License Terms.
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ <p align="center">
2
+ <a href="https://streamr.network">
3
+ <img alt="Streamr" src="https://raw.githubusercontent.com/streamr-dev/network-monorepo/main/packages/client/readme-header.png" width="1320" />
4
+ </a>
5
+ </p>
6
+
7
+ # @streamr/node
8
+ Broker nodes are Streamr Network nodes that run external to your application. You start up a broker node locally or on a
9
+ server, and interface with it remotely using one of the supported protocols.
10
+
11
+ The broker node ships with protocol support for HTTP, WebSocket, and MQTT. As libraries for these common protocols exist
12
+ in practically every programming language, you can conveniently publish data to and subscribe to streams in the Streamr Network
13
+ using the programming language of your choice.
14
+
15
+ Broker nodes can also perform other tasks in addition to (or instead of) serving applications, such as mining.
16
+
17
+ ## Table of Contents
18
+ - [Install](#install)
19
+ - [Run](#run)
20
+ - [Configuration](#configuration)
21
+ - [Plugins](#plugins)
22
+
23
+ ## Install
24
+ ```
25
+ npm install -g @streamr/node
26
+ ```
27
+
28
+ For more information on the different ways of setting up a broker node, see
29
+ [setting up a Broker node](https://streamr.network/docs/streamr-network/installing-broker-node).
30
+
31
+ ## Run
32
+
33
+ First [install](#install) the package globally if you have not yet.
34
+
35
+ Create a configuration file with interactive tool:
36
+ ```
37
+ streamr-broker-init
38
+ ```
39
+ Then run the command broker with the desired configuration file:
40
+ ```
41
+ streamr-broker <configFile>
42
+ ```
43
+
44
+ ## Configuration
45
+
46
+ See [configuration](configuration.md) for a description of the configuration options.
47
+
48
+ ## Plugins
49
+
50
+ The broker node ships with a number of plugins that can be enabled and configured selectively to match your specific
51
+ needs. For easy data integration from any programming language environment, plugins for HTTP, WebSocket, and MQTT are
52
+ provided.
53
+
54
+ Read more about available [plugins](plugins.md).
package/bin/broker.ts ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import { program } from 'commander'
3
+ import pkg from '../package.json'
4
+
5
+ import { createBroker } from '../src/broker'
6
+ import { readConfigAndMigrateIfNeeded } from '../src/config/migration'
7
+ import { overrideConfigToEnvVarsIfGiven } from '../src/config/config'
8
+
9
+ program
10
+ .version(pkg.version)
11
+ .name('broker')
12
+ .description('Run broker under environment specified by given configuration file.')
13
+ .arguments('[configFile]')
14
+ .option('--test', 'test the configuration (does not start the broker)')
15
+ .action(async (configFile) => {
16
+ try {
17
+ const config = readConfigAndMigrateIfNeeded(configFile)
18
+ overrideConfigToEnvVarsIfGiven(config)
19
+ const broker = await createBroker(config)
20
+ if (!program.opts().test) {
21
+ await broker.start()
22
+ } else {
23
+ // eslint-disable-next-line no-console
24
+ console.info('the configuration is valid')
25
+ // TODO remove process.exit(0)
26
+ // We should not need explicit exit call if all setTimeouts are cleared.
27
+ // Currently there is only one leaking timeout in PingPongWs (created
28
+ // by NodeClientWsEndpoint from the createNetworkNode() call)
29
+ process.exit(0)
30
+ }
31
+ } catch (err) {
32
+ console.error(err)
33
+ process.exit(1)
34
+ }
35
+ })
36
+ .parse(process.argv)
@@ -0,0 +1,4 @@
1
+ // Placeholder script so we don't have to update docs yet
2
+ // https://streamr.network/docs/streamr-network/installing-broker-node.
3
+ // Remove in next version update
4
+ require('child_process').fork('dist/bin/config-wizard.js')
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { program } from 'commander'
3
+ import pkg from '../package.json'
4
+ import { start } from '../src/config/ConfigWizard'
5
+
6
+ program
7
+ .version(pkg.version)
8
+ .name('broker-config-wizard')
9
+ .description('Run the configuration wizard for the broker')
10
+
11
+ ;(async () => {
12
+ try {
13
+ await start()
14
+ } catch (e) {
15
+ console.error('Streamr Node Config Wizard encountered an error:\n', e)
16
+ }
17
+ })()
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ import { program } from 'commander'
3
+ import pkg from '../package.json'
4
+ import { DeleteExpiredCmd } from '../src/plugins/storage/DeleteExpiredCmd'
5
+
6
+ program
7
+ .version(pkg.version)
8
+ .requiredOption('--cassandra-username <username>')
9
+ .requiredOption('--cassandra-password <password>')
10
+ .requiredOption('--cassandra-hosts <hosts_delimited_by_comma>')
11
+ .requiredOption('--cassandra-datacenter <datacenter>')
12
+ .requiredOption('--cassandra-keyspace <keyspace>')
13
+ .requiredOption('--streamr-base-url <baseUrl>')
14
+ .requiredOption('--bucket-limit <bucketLimit>', 'max number of buckets to fetch')
15
+ .option('--real-run', 'delete data for real', false)
16
+ .description('Delete expired data')
17
+ .parse(process.argv)
18
+
19
+ const deleteExpiredCommand = new DeleteExpiredCmd({
20
+ cassandraUsername: program.opts().cassandraUsername,
21
+ cassandraPassword: program.opts().cassandraPassword,
22
+ cassandraHosts: program.opts().cassandraHosts.split(','),
23
+ cassandraDatacenter: program.opts().cassandraDatacenter,
24
+ cassandraKeyspace: program.opts().cassandraKeyspace,
25
+ streamrBaseUrl: program.opts().streamrBaseUrl,
26
+ bucketLimit: program.opts().bucketLimit,
27
+ dryRun: !program.opts().realRun
28
+ })
29
+
30
+ async function run() {
31
+ try {
32
+ // @ts-expect-error TODO fix
33
+ await deleteExpiredCommand.run()
34
+ return {}
35
+ } catch (err) {
36
+ console.error(err)
37
+ process.exit(1)
38
+ }
39
+ }
40
+
41
+ run()
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ import { config as CHAIN_CONFIG } from '@streamr/config'
3
+ import { DhtAddress, DhtNode, NodeType, getRawFromDhtAddress } from '@streamr/dht'
4
+
5
+ const main = async () => {
6
+ const entryPoint = CHAIN_CONFIG.dev2.entryPoints[0]
7
+ const peerDescriptor = {
8
+ ...entryPoint,
9
+ nodeId: getRawFromDhtAddress(entryPoint.nodeId as DhtAddress),
10
+ type: NodeType.NODEJS // TODO remove this when NET-1070 done
11
+ }
12
+ const dhtNode = new DhtNode({
13
+ nodeId: entryPoint.nodeId as DhtAddress,
14
+ websocketHost: entryPoint.websocket.host,
15
+ websocketPortRange: {
16
+ min: entryPoint.websocket.port,
17
+ max: entryPoint.websocket.port
18
+ },
19
+ websocketServerEnableTls: false,
20
+ entryPoints: [peerDescriptor]
21
+ })
22
+ await dhtNode.start()
23
+ await dhtNode.joinDht([peerDescriptor])
24
+ console.info('Entry point started')
25
+ }
26
+
27
+ main()
@@ -0,0 +1,68 @@
1
+ {
2
+ "$schema": "https://schema.streamr.network/config-v2.schema.json",
3
+ "client": {
4
+ "auth": {
5
+ "privateKey": "0xaa7a3b3bb9b4a662e756e978ad8c6464412e7eef1b871f19e5120d4747bce966"
6
+ },
7
+ "network": {
8
+ "controlLayer": {
9
+ "peerDescriptor": {
10
+ "nodeId": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb1",
11
+ "websocket": {
12
+ "host": "10.200.10.1",
13
+ "port": 40401,
14
+ "tls": false
15
+ }
16
+ },
17
+ "entryPoints": [{
18
+ "nodeId": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
19
+ "websocket": {
20
+ "host": "10.200.10.1",
21
+ "port": 40500,
22
+ "tls": false
23
+ }
24
+ }],
25
+ "iceServers": [],
26
+ "webrtcAllowPrivateAddresses": true,
27
+ "websocketServerEnableTls": false
28
+ },
29
+ "node": {
30
+ "id": "0xde1112f631486CfC759A50196853011528bC5FA0"
31
+ }
32
+ },
33
+ "contracts": {
34
+ "streamRegistryChainAddress": "0xd04af489677001444280366Dd0885B03dAaDe71D",
35
+ "streamStorageRegistryChainAddress": "0xB9372284e0D61607aF3B7EF5f022e7D599Ed2a37",
36
+ "storageNodeRegistryChainAddress": "0xCBAcfA0592B3D809aEc805d527f8ceAe9307D9C0",
37
+ "streamRegistryChainRPCs": {
38
+ "chainId": 8995,
39
+ "rpcs": [
40
+ {
41
+ "url": "http://10.200.10.1:8547"
42
+ }
43
+ ]
44
+ },
45
+ "theGraphUrl": "http://10.200.10.1:8800/subgraphs/name/streamr-dev/network-subgraphs"
46
+ },
47
+ "metrics": false
48
+ },
49
+ "httpServer": {
50
+ "port": 8891
51
+ },
52
+ "plugins": {
53
+ "storage": {
54
+ "cassandra": {
55
+ "hosts": [
56
+ "10.200.10.1"
57
+ ],
58
+ "username": "",
59
+ "password": "",
60
+ "keyspace": "streamr_dev_v2",
61
+ "datacenter": "datacenter1"
62
+ },
63
+ "storageConfig": {
64
+ "refreshInterval": 10000
65
+ }
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://schema.streamr.network/config-v2.schema.json",
3
+ "client": {
4
+ "auth": {
5
+ "privateKey": "0xa51ef2b7a1f160e53cc3a17c5a74ea0563a50030644e9f6e1b1f4a7d0afd088e"
6
+ },
7
+ "network": {
8
+ "controlLayer": {
9
+ "peerDescriptor": {
10
+ "nodeId": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2",
11
+ "websocket": {
12
+ "host": "10.200.10.1",
13
+ "port": 40402,
14
+ "tls": false
15
+ }
16
+ },
17
+ "entryPoints": [{
18
+ "nodeId": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
19
+ "websocket": {
20
+ "host": "10.200.10.1",
21
+ "port": 40500,
22
+ "tls": false
23
+ }
24
+ }],
25
+ "iceServers": [],
26
+ "webrtcAllowPrivateAddresses": true,
27
+ "websocketServerEnableTls": false
28
+ },
29
+ "node": {
30
+ "id": "0xde222E8603FCf641F928E5F66a0CBf4de70d5352"
31
+ }
32
+ },
33
+ "contracts": {
34
+ "streamRegistryChainAddress": "0xd04af489677001444280366Dd0885B03dAaDe71D",
35
+ "streamStorageRegistryChainAddress": "0xB9372284e0D61607aF3B7EF5f022e7D599Ed2a37",
36
+ "storageNodeRegistryChainAddress": "0xCBAcfA0592B3D809aEc805d527f8ceAe9307D9C0",
37
+ "streamRegistryChainRPCs": {
38
+ "chainId": 8995,
39
+ "rpcs": [
40
+ {
41
+ "url": "http://10.200.10.1:8547"
42
+ }
43
+ ]
44
+ },
45
+ "theGraphUrl": "http://10.200.10.1:8800/subgraphs/name/streamr-dev/network-subgraphs"
46
+ },
47
+ "metrics": false
48
+ },
49
+ "httpServer": {
50
+ "port": 8791
51
+ },
52
+ "plugins": {}
53
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://schema.streamr.network/config-v2.schema.json",
3
+ "client": {
4
+ "auth": {
5
+ "privateKey": "0x2ba0e218041e81b8e5c88ee4134995c1e358c2c01664676d975792057c57e333"
6
+ },
7
+ "network": {
8
+ "controlLayer": {
9
+ "peerDescriptor": {
10
+ "nodeId": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb3",
11
+ "websocket": {
12
+ "host": "10.200.10.1",
13
+ "port": 40403,
14
+ "tls": false
15
+ }
16
+ },
17
+ "entryPoints": [{
18
+ "nodeId": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
19
+ "websocket": {
20
+ "host": "10.200.10.1",
21
+ "port": 40500,
22
+ "tls": false
23
+ }
24
+ }],
25
+ "iceServers": [],
26
+ "webrtcAllowPrivateAddresses": true,
27
+ "websocketServerEnableTls": false
28
+ },
29
+ "node": {
30
+ "id": "0xde3331cA6B8B636E0b82Bf08E941F727B8927442"
31
+ }
32
+ },
33
+ "contracts": {
34
+ "streamRegistryChainAddress": "0xd04af489677001444280366Dd0885B03dAaDe71D",
35
+ "streamStorageRegistryChainAddress": "0xB9372284e0D61607aF3B7EF5f022e7D599Ed2a37",
36
+ "storageNodeRegistryChainAddress": "0xCBAcfA0592B3D809aEc805d527f8ceAe9307D9C0",
37
+ "streamRegistryChainRPCs": {
38
+ "chainId": 8995,
39
+ "rpcs": [
40
+ {
41
+ "url": "http://10.200.10.1:8547"
42
+ }
43
+ ]
44
+ },
45
+ "theGraphUrl": "http://10.200.10.1:8800/subgraphs/name/streamr-dev/network-subgraphs"
46
+ },
47
+ "metrics": false
48
+ },
49
+ "httpServer": {
50
+ "port": 8691
51
+ },
52
+ "plugins": {}
53
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://schema.streamr.network/config-v2.schema.json",
3
+ "client": {
4
+ "auth": {
5
+ "privateKey": "0x87ba653d4320abb5231d10a4abfad9ea1371dcbcdc247ab2f961e2754ae781ca"
6
+ },
7
+ "network": {
8
+ "node": {
9
+ "id": "0xa9D6428B05a65053B276AeCc917ED07ACF219aE2"
10
+ },
11
+ "controlLayer": {
12
+ "websocketServerEnableTls": false
13
+ }
14
+ },
15
+ "metrics": false
16
+ },
17
+ "httpServer": {
18
+ "port": 8791
19
+ },
20
+ "plugins": {}
21
+ }
@@ -0,0 +1,72 @@
1
+ {
2
+ "$schema": "https://schema.streamr.network/config-v2.schema.json",
3
+ "client": {
4
+ "auth": {
5
+ "privateKey": "0xaa7a3b3bb9b4a662e756e978ad8c6464412e7eef1b871f19e5120d4747bce966"
6
+ },
7
+ "network": {
8
+ "controlLayer": {
9
+ "peerDescriptor": {
10
+ "nodeId": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb1",
11
+ "websocket": {
12
+ "host": "10.200.10.1",
13
+ "port": 40401,
14
+ "tls": false
15
+ }
16
+ },
17
+ "entryPoints": [{
18
+ "nodeId": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
19
+ "websocket": {
20
+ "host": "10.200.10.1",
21
+ "port": 40500,
22
+ "tls": false
23
+ }
24
+ }],
25
+ "iceServers": [],
26
+ "webrtcAllowPrivateAddresses": true,
27
+ "websocketServerEnableTls": false
28
+ },
29
+ "node": {
30
+ "id": "0xde1112f631486CfC759A50196853011528bC5FA0"
31
+ }
32
+ },
33
+ "contracts": {
34
+ "streamRegistryChainAddress": "0xd04af489677001444280366Dd0885B03dAaDe71D",
35
+ "streamStorageRegistryChainAddress": "0xB9372284e0D61607aF3B7EF5f022e7D599Ed2a37",
36
+ "storageNodeRegistryChainAddress": "0xCBAcfA0592B3D809aEc805d527f8ceAe9307D9C0",
37
+ "streamRegistryChainRPCs": {
38
+ "chainId": 8995,
39
+ "rpcs": [
40
+ {
41
+ "url": "http://10.200.10.1:8547"
42
+ }
43
+ ]
44
+ },
45
+ "theGraphUrl": "http://10.200.10.1:8800/subgraphs/name/streamr-dev/network-subgraphs"
46
+ },
47
+ "metrics": false
48
+ },
49
+ "httpServer": {
50
+ "port": 8891
51
+ },
52
+ "plugins": {
53
+ "consoleMetrics": {
54
+ "interval": 30
55
+ },
56
+ "info": {},
57
+ "storage": {
58
+ "cassandra": {
59
+ "hosts": [
60
+ "cassandra"
61
+ ],
62
+ "username": "",
63
+ "password": "",
64
+ "keyspace": "streamr_dev_v2",
65
+ "datacenter": "datacenter1"
66
+ },
67
+ "storageConfig": {
68
+ "refreshInterval": 10000
69
+ }
70
+ }
71
+ }
72
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "$schema": "https://schema.streamr.network/config-v2.schema.json",
3
+ "client": {
4
+ "auth": {
5
+ "privateKey": "0xa51ef2b7a1f160e53cc3a17c5a74ea0563a50030644e9f6e1b1f4a7d0afd088e"
6
+ },
7
+ "network": {
8
+ "controlLayer": {
9
+ "peerDescriptor": {
10
+ "nodeId": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2",
11
+ "websocket": {
12
+ "host": "10.200.10.1",
13
+ "port": 40402,
14
+ "tls": false
15
+ }
16
+ },
17
+ "entryPoints": [{
18
+ "nodeId": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
19
+ "websocket": {
20
+ "host": "10.200.10.1",
21
+ "port": 40500,
22
+ "tls": false
23
+ }
24
+ }],
25
+ "iceServers": [],
26
+ "webrtcAllowPrivateAddresses": true,
27
+ "websocketServerEnableTls": false
28
+ },
29
+ "node": {
30
+ "id": "0xde222E8603FCf641F928E5F66a0CBf4de70d5352"
31
+ }
32
+ },
33
+ "contracts": {
34
+ "streamRegistryChainAddress": "0xd04af489677001444280366Dd0885B03dAaDe71D",
35
+ "streamStorageRegistryChainAddress": "0xB9372284e0D61607aF3B7EF5f022e7D599Ed2a37",
36
+ "storageNodeRegistryChainAddress": "0xCBAcfA0592B3D809aEc805d527f8ceAe9307D9C0",
37
+ "streamRegistryChainRPCs": {
38
+ "chainId": 8995,
39
+ "rpcs": [
40
+ {
41
+ "url": "http://10.200.10.1:8547"
42
+ }
43
+ ]
44
+ },
45
+ "theGraphUrl": "http://10.200.10.1:8800/subgraphs/name/streamr-dev/network-subgraphs"
46
+ },
47
+ "metrics": false
48
+ },
49
+ "httpServer": {
50
+ "port": 8791
51
+ },
52
+ "plugins": {
53
+ "consoleMetrics": {
54
+ "interval": 30
55
+ },
56
+ "info": {}
57
+ }
58
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "$schema": "https://schema.streamr.network/config-v2.schema.json",
3
+ "client": {
4
+ "auth": {
5
+ "privateKey": "0x2ba0e218041e81b8e5c88ee4134995c1e358c2c01664676d975792057c57e333"
6
+ },
7
+ "network": {
8
+ "controlLayer": {
9
+ "peerDescriptor": {
10
+ "nodeId": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb3",
11
+ "websocket": {
12
+ "host": "10.200.10.1",
13
+ "port": 40403,
14
+ "tls": false
15
+ }
16
+ },
17
+ "entryPoints": [{
18
+ "nodeId": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
19
+ "websocket": {
20
+ "host": "10.200.10.1",
21
+ "port": 40500,
22
+ "tls": false
23
+ }
24
+ }],
25
+ "iceServers": [],
26
+ "webrtcAllowPrivateAddresses": true,
27
+ "websocketServerEnableTls": false
28
+ },
29
+ "node": {
30
+ "id": "0xde3331cA6B8B636E0b82Bf08E941F727B8927442"
31
+ }
32
+ },
33
+ "contracts": {
34
+ "streamRegistryChainAddress": "0xd04af489677001444280366Dd0885B03dAaDe71D",
35
+ "streamStorageRegistryChainAddress": "0xB9372284e0D61607aF3B7EF5f022e7D599Ed2a37",
36
+ "storageNodeRegistryChainAddress": "0xCBAcfA0592B3D809aEc805d527f8ceAe9307D9C0",
37
+ "streamRegistryChainRPCs": {
38
+ "chainId": 8995,
39
+ "rpcs": [
40
+ {
41
+ "url": "http://10.200.10.1:8547"
42
+ }
43
+ ]
44
+ },
45
+ "theGraphUrl": "http://10.200.10.1:8800/subgraphs/name/streamr-dev/network-subgraphs"
46
+ },
47
+ "metrics": false
48
+ },
49
+ "httpServer": {
50
+ "port": 8691
51
+ },
52
+ "plugins": {
53
+ "consoleMetrics": {
54
+ "interval": 30
55
+ },
56
+ "info": {}
57
+ }
58
+ }