Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2004 from LiskHQ/2001-add-support-for-http-api-in…
Browse files Browse the repository at this point in the history
…-connector

Add support for HTTP API in connector
  • Loading branch information
sameersubudhi authored Jan 5, 2024
2 parents d308ade + f8739c3 commit f583a8a
Show file tree
Hide file tree
Showing 23 changed files with 670 additions and 1,033 deletions.
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ services:
- SERVICE_BROKER=nats://nats:4222
- GEOIP_JSON=${GEOIP_JSON}
- LISK_APP_WS=${LISK_APP_WS}
- USE_LISK_HTTP_API=${USE_LISK_HTTP_API}
- LISK_APP_HTTP=${LISK_APP_HTTP}
- SERVICE_BROKER_TIMEOUT=${SERVICE_BROKER_TIMEOUT}
- SERVICE_LOG_CONSOLE=${SERVICE_LOG_CONSOLE}
- SERVICE_LOG_STDOUT=${SERVICE_LOG_STDOUT}
Expand Down Expand Up @@ -208,6 +210,8 @@ services:
- DEVNET_MAINCHAIN_URL=${DEVNET_MAINCHAIN_URL}
- ACCOUNT_BALANCE_UPDATE_BATCH_SIZE=${ACCOUNT_BALANCE_UPDATE_BATCH_SIZE}
- INDEX_BLOCKS_QUEUE_SCHEDULED_JOB_MAX_COUNT=${INDEX_BLOCKS_QUEUE_SCHEDULED_JOB_MAX_COUNT}
- ESTIMATES_BUFFER_BYTES_LENGTH=${ESTIMATES_BUFFER_BYTES_LENGTH}
- INVOKE_ALLOWED_METHODS=${INVOKE_ALLOWED_METHODS}
- JOB_INTERVAL_DELETE_SERIALIZED_EVENTS=${JOB_INTERVAL_DELETE_SERIALIZED_EVENTS}
- JOB_SCHEDULE_DELETE_SERIALIZED_EVENTS=${JOB_SCHEDULE_DELETE_SERIALIZED_EVENTS}
- JOB_INTERVAL_REFRESH_VALIDATORS=${JOB_INTERVAL_REFRESH_VALIDATORS}
Expand All @@ -224,8 +228,6 @@ services:
- JOB_SCHEDULE_DELETE_FINALIZED_CCU_METADATA=${JOB_SCHEDULE_DELETE_FINALIZED_CCU_METADATA}
- JOB_INTERVAL_TRIGGER_ACCOUNT_UPDATES=${JOB_INTERVAL_TRIGGER_ACCOUNT_UPDATES}
- JOB_SCHEDULE_TRIGGER_ACCOUNT_UPDATES=${JOB_SCHEDULE_TRIGGER_ACCOUNT_UPDATES}
- ESTIMATES_BUFFER_BYTES_LENGTH=${ESTIMATES_BUFFER_BYTES_LENGTH}
- INVOKE_ALLOWED_METHODS=${INVOKE_ALLOWED_METHODS}
restart: always

blockchain-coordinator:
Expand Down
44 changes: 36 additions & 8 deletions docker/example.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Common Docker configuration
# ==================================== #
# Common Docker configuration #
# ==================================== #

# Service broker
# SERVICE_BROKER_TIMEOUT=10
Expand All @@ -11,7 +13,10 @@
# SERVICE_LOG_STDOUT=true
# DOCKER_HOST='local'

## Lisk Service Blockchain App Registry

# ==================================== #
# Lisk Service Blockchain App Registry #
# ==================================== #
# ENABLE_REBUILD_INDEX_AT_INIT=false

# Moleculer jobs configuration
Expand All @@ -25,7 +30,10 @@
# GITHUB_APP_REGISTRY_REPO='https://github.com/LiskHQ/app-registry'
# GITHUB_APP_REGISTRY_REPO_BRANCH='main'

## Lisk Service Blockchain Connector

# ==================================== #
# Lisk Service Blockchain Connector #
# ==================================== #

# GENESIS_BLOCK_URL='https://downloads.lisk.com/lisk/mainnet/genesis_block.json.tar.gz'
# CLIENT_ALIVE_ASSUMPTION_TIME=5000
Expand All @@ -47,11 +55,17 @@

# Lisk ecosystem configuration
LISK_APP_WS=ws://host.docker.internal:7887
# USE_LISK_HTTP_API=true
# LISK_APP_HTTP=http://host.docker.internal:7887

# Lisk Service geolocation backend (empty = disabled)
# GEOIP_JSON='https://geoip.lisk.com/json'

## Lisk Service Blockchain Indexer

# ==================================== #
# Lisk Service Blockchain Indexer #
# ==================================== #

# ENABLE_DATA_RETRIEVAL_MODE=true
# ENABLE_INDEXING_MODE=true
# ENABLE_PERSIST_EVENTS=false
Expand Down Expand Up @@ -85,7 +99,11 @@ LISK_APP_WS=ws://host.docker.internal:7887
# JOB_INTERVAL_TRIGGER_ACCOUNT_UPDATES=0
# JOB_SCHEDULE_TRIGGER_ACCOUNT_UPDATES='*/15 * * * *'

## Lisk Service Blockchain Coordinator

# ==================================== #
# Lisk Service Blockchain Coordinator #
# ==================================== #

# INDEX_MISSING_BLOCKS_SKIP_THRESHOLD=1000
# INDEX_MISSING_BLOCKS_MAX_SCHEDULE=25000
# JOB_INTERVAL_INDEX_MISSING_BLOCKS=0
Expand All @@ -112,7 +130,10 @@ LISK_APP_WS=ws://host.docker.internal:7887
# JOB_INTERVAL_VERIFY_TRANSACTION_STATS=0
# JOB_SCHEDULE_VERIFY_TRANSACTION_STATS='15 */3 * * *'

## Lisk Service Gateway

# ==================================== #
# Lisk Service Gateway #
# ==================================== #

# PORT=9901
# HOST=0.0.0.0
Expand Down Expand Up @@ -150,7 +171,10 @@ LISK_APP_WS=ws://host.docker.internal:7887
# HTTP_RATE_LIMIT_ENABLE_X_FORWARDED_FOR=false,
# HTTP_RATE_LIMIT_NUM_KNOWN_PROXIES=0,

## Lisk Service Market

# ==================================== #
# Lisk Service Market #
# ==================================== #

# Currency pairs
# SERVICE_MARKET_FIAT_CURRENCIES=EUR,USD,CHF,GBP,RUB,PLN,JPY,AUD,GBP,INR
Expand All @@ -171,7 +195,11 @@ LISK_APP_WS=ws://host.docker.internal:7887
# Exchange Rates API authentication (empty = disabled)
# EXCHANGERATESAPI_IO_API_KEY=

## Lisk Service Export

# ==================================== #
# Lisk Service Export #
# ==================================== #

# SERVICE_EXPORT_PARTIALS='./data/partials'
# EXPORT_S3_BUCKET_NAME_PARTIALS='partials'
# SERVICE_EXPORT_STATIC='./data/static'
Expand Down
14 changes: 13 additions & 1 deletion docs/antora/modules/ROOT/pages/configuration/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,21 @@ module.exports = {

| `LISK_APP_WS`
| string
| URL to connect with the Lisk application node over WebSocket.
| URL to connect with the Lisk application node over WebSocket.
By default, it is set to `ws://127.0.0.1:7887`.
| ws://127.0.0.1:7887

| `LISK_APP_HTTP`
| string
| URL to connect with the Lisk application node over HTTP(s).
By default, it is set to `http://127.0.0.1:7887`.
| http://127.0.0.1:7887

| `USE_LISK_HTTP_API`
| boolean
| Boolean flag to enable HTTP-API based connection to the Lisk application node.
| true

| `USE_LISK_IPC_CLIENT`
| boolean
| Boolean flag to enable IPC-based connection to the Lisk application node.
Expand Down
2 changes: 2 additions & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ module.exports = {
SERVICE_BROKER: 'redis://lisk:password@127.0.0.1:6379/0',
// USE_LISK_IPC_CLIENT: true,
// LISK_APP_DATA_PATH: '~/.lisk/lisk-core',
// USE_LISK_HTTP_API: true,
// LISK_APP_HTTP: 'http://127.0.0.1:7887',
// LISK_APP_WS: 'ws://127.0.0.1:7887',
// GEOIP_JSON: 'https://geoip.lisk.com/json',
// ENABLE_BLOCK_CACHING: true,
Expand Down
3 changes: 2 additions & 1 deletion services/blockchain-app-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"ioredis": "^5.3.2",
"lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/5cb6fc8e9b9798595d1a4652b9148afcbfaaed1f/framework/dist/lisk-service-framework-1.6.11.tgz",
"lodash": "^4.17.21",
"octokit": "^2.0.4",
"node-fetch": "^2.6.1",
"octokit": "^3.1.2",
"tar": "^6.1.11"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Removal or modification of this copyright notice is prohibited.
*
*/
const fetch = require('node-fetch');
const path = require('path');
const BluebirdPromise = require('bluebird');
const { Octokit } = require('octokit');
Expand Down Expand Up @@ -53,7 +54,7 @@ const { FILENAME } = config;

const logger = Logger();

const octokit = new Octokit({ auth: config.gitHub.accessToken });
const octokit = new Octokit({ auth: config.gitHub.accessToken, request: { fetch } });

const GITHUB_FILE_STATUS = Object.freeze({
ADDED: 'added',
Expand Down
Loading

0 comments on commit f583a8a

Please sign in to comment.