From 0cc2200094b9e6fd2e258ec70aa8f4b59a1ea736 Mon Sep 17 00:00:00 2001 From: Bob Ong Date: Tue, 25 Jun 2024 17:52:13 +0800 Subject: [PATCH] [dag inspector] Add README.md for local environment --- docker-compose/README.md | 57 +++++++++++++++++++++++++++--- docker-compose/docker-compose.yaml | 12 +++++++ 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/docker-compose/README.md b/docker-compose/README.md index 2d50be2..8fc417e 100644 --- a/docker-compose/README.md +++ b/docker-compose/README.md @@ -1,10 +1,57 @@ -# 如何构建本地环境 +# How to build local environment -## 1. 安装 Docker -## 2. 安装 Docker Compose -## 3. 运行以下命令 +## 1. Install "Docker" and "Docker Compose" +## 2. Run the command to start the database and components ```bash docker-compose up ``` -## 4. 访问 http://localhost:8080 +## 3. Start starcoin-index project + +### Config the startup environment variable +```dotenv +HOSTS=localhost +NETWORK=halley # select which network to scan +BG_TASK_JOBS=dag_inspector +TXN_OFFSET=0 +BULK_SIZE=100 +STARCOIN_ES_PWD= +STARCOIN_ES_URL=localhost +STARCOIN_ES_PROTOCOL=http +STARCOIN_ES_PORT=9200 +STARCOIN_ES_USER= +SWAP_API_URL=https://swap-api.starswap.xyz +SWAP_CONTRACT_ADDR=0x8c109349c6bd91411d6bc962e080c4a3 +DS_URL=jdbc:postgresql://localhost/starcoin +DB_SCHEMA=halley +DB_USER_NAME=starcoin +DB_PWD=starcoin +PROGRAM_ARGS= +# auto_repair 9411700 +``` + +### Configuration Elasticsearch template +[IMPORTANT!!] Make sure your template has added to Elastic search service before add data, including component template and index template to ES. +Following file: [[es_pipeline.scripts](..%2Fkube%2Fmappings%2Fes_pipeline.scripts)] + +1. Open the 'Kibana' site has been started in the docker-compose environment, usually the url is http://localhost:5601 +2. Navigate to 'Dev Tools' +3. Follow the instructions in the file of giving above to add the template to ES + +## 4. Start starcoin-scan-api project + +### Config the startup enviroment variable +```dotenv +STARCOIN_ES_URL=localhost +STARCOIN_ES_PROTOCOL=http +STARCOIN_ES_PORT=9200 +STARCOIN_ES_USER= +STARCOIN_ES_INDEX_VERSION= +STARCOIN_ES_PWD= +MAIN_DS_URL=jdbc:postgresql://localhost/starcoin?currentSchema=main +BARNARD_DS_URL=jdbc:postgresql://localhost/starcoin?currentSchema=barnard +HALLEY_DS_URL=jdbc:postgresql://localhost/starcoin?currentSchema=halley +DS_URL=jdbc:postgresql://localhost/starcoin +STARCOIN_USER_DS_URL="jdbc:postgresql://localhost/starcoin?currentSchema=starcoin_user" +DB_USER_NAME=starcoin +DB_PWD=starcoin ``` diff --git a/docker-compose/docker-compose.yaml b/docker-compose/docker-compose.yaml index 1670730..160a848 100644 --- a/docker-compose/docker-compose.yaml +++ b/docker-compose/docker-compose.yaml @@ -50,6 +50,18 @@ services: depends_on: - elasticsearch + postgresql: + image: postgres:13.2 + container_name: postgres_db + environment: + POSTGRES_USER: starcoin + POSTGRES_PASSWORD: starcoin + POSTGRES_DB: starcoin + volumes: + - db_data:/var/lib/postgresql/data + ports: + - 5432:5432 + volumes: esdata: driver: local