Skip to content

Commit

Permalink
feat: add networks/config api that returns all config details (#555)
Browse files Browse the repository at this point in the history
feat: add mastodon related config details (#556)


feat: change rss to object and add default network endpoint url (#557)


feat: add title and key in config detail (#558)


chore: reorder the worker configs (#559)

fix: change mastodon endpoint type to string (#560)


feat: add default value and type for worker endpoint config
  • Loading branch information
pseudoyu authored and kallydev committed Oct 12, 2024
1 parent e76695a commit d50a812
Show file tree
Hide file tree
Showing 8 changed files with 441 additions and 215 deletions.
12 changes: 12 additions & 0 deletions deploy/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ redis:
# - Blockchain networks require RPC endpoints,
# - Arweave requires a gateway endpoint,
# - Farcaster requires a Hubble.
# - Mastodon requires a mastodon instance.
endpoints:
vsl:
url: https://rpc.rss3.io
arweave:
url: https://arweave.net
mastodon:
url: your-kafka-ip:9092

# `component` is used to split different types of networks.
component:
Expand Down Expand Up @@ -86,3 +89,12 @@ component:
parameters:
# `concurrent_block_requests` is used to specify the number of concurrent block requests.
concurrent_block_requests: 2
# `federated` network type includes workers indexing data from federated networks such as ActivityPub.
federated:
# mastodon
- id: mastodon-core
network: mastodon
worker: mastodon
endpoint: mastodon
parameters:
kafka_topic: activitypub_events
195 changes: 169 additions & 26 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,16 +349,16 @@
}
}
},
"/networks/endpoint_config": {
"/networks/config": {
"get": {
"summary": "Get Endpoint config options",
"description": "Retrieve endpoint config options and descriptions.",
"summary": "Get worker config options",
"description": "Retrieve worker config options and descriptions.",
"tags": [
"Info"
],
"responses": {
"200": {
"$ref": "#/components/responses/EndpointConfigResponse"
"$ref": "#/components/responses/NetworkConfigResponse"
},
"400": {
"$ref": "#/components/responses/BadRequest"
Expand Down Expand Up @@ -827,10 +827,10 @@
},
"type": "object"
},
"EndpointConfigResponse": {
"NetworkConfigResponse": {
"properties": {
"data": {
"$ref": "#/components/schemas/EndpointConfig"
"$ref": "#/components/schemas/NetworkConfig"
}
},
"type": "object",
Expand Down Expand Up @@ -1125,6 +1125,55 @@
"federated": null
}
},
"NetworkConfig": {
"description": "The worker config details by source.",
"type": "object",
"properties": {
"rss": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"endpoint_configs": {
"$ref": "#/components/schemas/Endpoint"
},
"worker_configs": {
"$ref": "#/components/schemas/WorkerConfig"
}
}
},
"decentralized": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NetworkConfigDetail"
}
},
"federated": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NetworkConfigDetail"
}
}
}
},
"NetworkConfigDetail": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"endpoint_configs": {
"$ref": "#/components/schemas/EndpointConfig"
},
"worker_configs": {
"type": "array",
"items": {
"$ref": "#/components/schemas/WorkerConfig"
}
}
}
},
"EndpointConfig": {
"description": "The endpoint options and config details of the worker.",
"properties": {
Expand All @@ -1140,6 +1189,118 @@
},
"type": "object"
},
"WorkerConfig": {
"type": "object",
"properties": {
"id": {
"$ref": "#/components/schemas/ConfigDetail"
},
"network": {
"$ref": "#/components/schemas/ConfigDetail"
},
"worker": {
"$ref": "#/components/schemas/ConfigDetail"
},
"endpoint": {
"$ref": "#/components/schemas/ConfigDetail"
},
"ipfs_gateways": {
"$ref": "#/components/schemas/ConfigDetail"
},
"parameters": {
"$ref": "#/components/schemas/Parameters"
},
"minimum_resource": {
"$ref": "#/components/schemas/MinimumResource"
}
}
},
"Parameters": {
"type": "object",
"properties": {
"block_start": {
"$ref": "#/components/schemas/ConfigDetail"
},
"block_target": {
"$ref": "#/components/schemas/ConfigDetail"
},
"concurrent_block_requests": {
"$ref": "#/components/schemas/ConfigDetail"
},
"block_batch_size": {
"$ref": "#/components/schemas/ConfigDetail"
},
"receipts_batch_size": {
"$ref": "#/components/schemas/ConfigDetail"
},
"block_receipts_batch_size": {
"$ref": "#/components/schemas/ConfigDetail"
},
"api_key": {
"$ref": "#/components/schemas/ConfigDetail"
},
"authentication": {
"$ref": "#/components/schemas/Authentication"
},
"kafka_topic": {
"$ref": "#/components/schemas/ConfigDetail"
}
}
},
"Authentication": {
"type": "object",
"properties": {
"access_key": {
"$ref": "#/components/schemas/ConfigDetail"
}
}
},
"MinimumResource": {
"type": "object",
"properties": {
"cpu_core": {
"type": "number",
"format": "float"
},
"memory_in_gb": {
"type": "number",
"format": "float"
},
"disk_space_in_gb": {
"type": "integer"
},
"title": {
"type": "string"
},
"key": {
"type": "string"
}
}
},
"ConfigDetail": {
"type": "object",
"required": ["is_required", "type", "value", "description"],
"properties": {
"is_required": {
"type": "boolean"
},
"type": {
"type": "string"
},
"value": {
"type": "string"
},
"description": {
"type": "string"
},
"title": {
"type": "string"
},
"key": {
"type": "string"
}
}
},
"WorkerStatus": {
"description": "The status of the worker.",
"properties": {
Expand Down Expand Up @@ -1185,24 +1346,6 @@
},
"type": "object"
},
"ConfigDetail": {
"type": "object",
"required": ["is_required", "type", "value", "description"],
"properties": {
"is_required": {
"type": "boolean"
},
"type": {
"type": "string"
},
"value": {
"type": "string"
},
"description": {
"type": "string"
}
}
},
"Calldata": {
"description": "Represents the call data associated with an activity.",
"properties": {
Expand Down Expand Up @@ -1400,12 +1543,12 @@
}
}
},
"EndpointConfigResponse": {
"NetworkConfigResponse": {
"description": "The request was successful.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EndpointConfigResponse"
"$ref": "#/components/schemas/NetworkConfigResponse"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rss3-network/protocol-go v0.5.8 h1:w3XCFrqvNTXGHVCKM50rdmhgnj7BxY0+7FSGVvGCJeY=
github.com/rss3-network/protocol-go v0.5.8/go.mod h1:npcyduWt86uVbIi77xQaYk8eqltI9XNjk1FMGpjyIq0=
github.com/rss3-network/protocol-go v0.5.9 h1:PGIpC5XlmQu5JA94go5dmHOsf/JRd/iW4ajxtnTi6uA=
github.com/rss3-network/protocol-go v0.5.9/go.mod h1:npcyduWt86uVbIi77xQaYk8eqltI9XNjk1FMGpjyIq0=
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand Down
6 changes: 1 addition & 5 deletions internal/node/component/info/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ func NewComponent(_ context.Context, apiServer *echo.Echo, config *config.File,
apiServer.GET("/workers_status", c.GetWorkersStatus)

networks := apiServer.Group("/networks")

networks.GET("", c.GetNetworksHandler)
networks.GET("/endpoint_config", c.GetEndpointConfig)
networks.GET("/:network/list_workers", c.GetWorkersByNetwork)
networks.GET("/:network/workers/:worker", c.GetWorkerConfig)
networks.GET("/config", c.GetNetworkConfig)

if err := c.InitMeter(); err != nil {
panic(err)
Expand Down
Loading

0 comments on commit d50a812

Please sign in to comment.