Skip to content

Commit

Permalink
feat(api-history): add hyperion to load history
Browse files Browse the repository at this point in the history
  • Loading branch information
leisterfrancisco committed Aug 24, 2023
1 parent 4e885fa commit aaaf204
Show file tree
Hide file tree
Showing 8 changed files with 416 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ source run.sh start_network bp 5
./scripts/contracts.sh
```

5. Start Hyperion

```sh
source run.sh start_api_history
```

## File structure

```text title="./libre-local"
Expand Down
3 changes: 3 additions & 0 deletions api-history/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
ship/
ca.crt
6 changes: 6 additions & 0 deletions api-history/hyperion/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:20
RUN npm install pm2 -g
RUN git clone https://github.com/eosrio/hyperion-history-api.git
WORKDIR /hyperion-history-api
RUN git checkout main
RUN npm install
136 changes: 136 additions & 0 deletions api-history/hyperion/config/chains/local.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"api": {
"enabled": true,
"pm2_scaling": 1,
"node_max_old_space_size": 1024,
"chain_name": "Local Chain",
"server_addr": "0.0.0.0",
"server_port": 7000,
"stream_port": 1234,
"server_name": "localhost: 7000",
"provider_name": "Example Provider",
"provider_url": "https://example.com",
"chain_api": "",
"push_api": "",
"chain_logo_url": "",
"enable_caching": true,
"cache_life": 1,
"limits": {
"get_actions": 1000,
"get_voters": 100,
"get_links": 1000,
"get_deltas": 1000,
"get_trx_actions": 200
},
"access_log": false,
"chain_api_error_log": false,
"custom_core_token": "",
"enable_export_action": false,
"disable_rate_limit": false,
"rate_limit_rpm": 1000,
"rate_limit_allow": [],
"disable_tx_cache": false,
"tx_cache_expiration_sec": 3600,
"v1_chain_cache": [
{
"path": "get_block",
"ttl": 3000
},
{
"path": "get_info",
"ttl": 500
}
]
},
"indexer": {
"enabled": true,
"node_max_old_space_size": 4096,
"start_on": 0,
"stop_on": 0,
"rewrite": false,
"purge_queues": false,
"live_reader": true,
"live_only_mode": false,
"abi_scan_mode": false,
"fetch_block": true,
"fetch_traces": true,
"disable_reading": false,
"disable_indexing": false,
"process_deltas": true,
"disable_delta_rm": true
},
"settings": {
"preview": false,
"chain": "local",
"eosio_alias": "eosio",
"parser": "3.2",
"auto_stop": 0,
"index_version": "v1",
"debug": false,
"bp_logs": false,
"bp_monitoring": false,
"ipc_debug_rate": 60000,
"allow_custom_abi": false,
"rate_monitoring": true,
"max_ws_payload_mb": 256,
"ds_profiling": false,
"auto_mode_switch": false,
"hot_warm_policy": false,
"custom_policy": "",
"use_global_agent": false,
"index_partition_size": 10000000,
"es_replicas": 0
},
"blacklists": {
"actions": [],
"deltas": []
},
"whitelists": {
"actions": [],
"deltas": [],
"max_depth": 10,
"root_only": false
},
"scaling": {
"readers": 1,
"ds_queues": 1,
"ds_threads": 1,
"ds_pool_size": 1,
"indexing_queues": 1,
"ad_idx_queues": 1,
"dyn_idx_queues": 1,
"max_autoscale": 4,
"batch_size": 5000,
"resume_trigger": 5000,
"auto_scale_trigger": 20000,
"block_queue_limit": 10000,
"max_queue_limit": 100000,
"routing_mode": "round_robin",
"polling_interval": 10000
},
"features": {
"streaming": {
"enable": true,
"traces": true,
"deltas": true
},
"tables": {
"proposals": true,
"accounts": true,
"voters": true
},
"index_deltas": true,
"index_transfer_memo": true,
"index_all_deltas": true,
"deferred_trx": false,
"failed_trx": false,
"resource_limits": false,
"resource_usage": false
},
"prefetch": {
"read": 50,
"block": 100,
"index": 500
},
"plugins": {}
}
34 changes: 34 additions & 0 deletions api-history/hyperion/config/connections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"amqp": {
"host": "rabbitmq:5672",
"api": "rabbitmq:15672",
"protocol": "http",
"user": "rabbitmq",
"pass": "rabbitmq",
"vhost": "hyperion",
"frameMax": "0x10000"
},
"elasticsearch": {
"protocol": "https",
"host": "es01:9200",
"ingest_nodes": [
"es01:9200"
],
"user": "elastic",
"pass": "changeme123"
},
"redis": {
"host": "redis",
"port": "6379"
},
"chains": {
"local": {
"name": "Libre Local",
"chain_id": "f7a3fe6bf7dc0b011e25cee41ed9526b70a9702ca74599692852304cb36fdb2b",
"http": "http://genesis:8888",
"ship": "ws://genesis:8080",
"WS_ROUTER_PORT": 7001,
"WS_ROUTER_HOST": "127.0.0.1"
}
}
}
28 changes: 28 additions & 0 deletions api-history/hyperion/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3.8"
services:
indexer:
build: .
# restart: on-failure
volumes:
- ./config/connections.json:/hyperion-history-api/connections.json
- ./config/chains/:/hyperion-history-api/chains/
networks:
- libre-network
command: ./run.sh local-indexer

api:
build: .
ports:
- "7000:7000"
depends_on:
- indexer
volumes:
- ./config/connections.json:/hyperion-history-api/connections.json
- ./config/chains/:/hyperion-history-api/chains/
networks:
- libre-network
command: ./run.sh local-api

networks:
libre-network:
external: true
Loading

0 comments on commit aaaf204

Please sign in to comment.