GithubHelp home page GithubHelp logo

gostrider / chain-indexing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crypto-com/chain-indexing

0.0 0.0 0.0 32.4 MB

License: Other

Go 99.68% Shell 0.31% Dockerfile 0.01% Makefile 0.01%

chain-indexing's Introduction

Crypto.com Chain Indexing Service

Crypto.com Chain Indexing Service (chain-indexing) is a service to index all publicly available data on Crypto.com chain and persist structured information into storage.

Right now it supports Postgres database and provides RESTful API as query interface.

1. Build

1.1 Build using Docker (Not working yet)

Using Docker is the easiest way to build chain-indexing. The Docker image contains /app/chain-indexing Compiled chain-indexing binary /app/migrate Program to perform migration

docker build -o chain-indexing .

1.2 Build manually

Prerequisite

  • Go compiler
make all

2. How to Run

2.1 Prerequisite

  • Crypto.com Chain full node
  • Postgres Database

2.2 Configuration file

A sample configuration is available under config/config.sample.toml.

Copy it, update configuration based on your setup and rename it as config/config.toml.

Note: Postgres database password is not available in config.toml nor command option. You must provide it as environment variable DB_PASSWORD on start.

2.3 Postgres Database

You can have your Postgres setup locally or remotely.

Run Postgres with Docker

WARNING: The docker files available under docker/ is intended only for development and testing purpose only. Never use them in production setup.

For a local test run. A docker-compose file with Postgres database and PgAdmin console is available via running:

docker-compose --file docker/docker-compose.development.yml up -d

This will start the following docker instances on your local network when you use default credentials:

Docker image Port Username Password Other Config Mounted volume
Postgres 5432 postgres postgres Database Name = postgres; SSL = true ./pgdata-dev
PgAdmin 8080 pgadmin@localhost pgadmin N/A N/A

2.4 Execute Database Migration

for DB_PASSWORD, never use common word such as "postgres" , "admin", "password", choose at least 16 characters including number, special character, capital letters even in testing environment. if you don't use strong password, pgmigrate will stop further processing

Docker (Not working yet)

docker run -it \
    --env DB_USERNAME=postgres \
    --env DB_PASSWORD=your_postgresql_password \
    --env DB_HOST=host.docker.internal \
    --env DB_PORT=5432 \
    --env DB_NAME=postgres \
    --env DB_SCHEMA=public \
    chain-indexing /app/migrate -- -verbose up

Manual Build

./pgmigrate.sh -- -verbose up

2.5 Run the Service

Docker (Not working yet)

docker run \
    -v `pwd`/config:/app/config --read-only \
    -p 28857:28857 \
    --env DB_PASSWORD=your_postgresql_password \
    chain-indexing /app/chain-indexing

Manual build

env DB_PASSWORD=your_postgresql_password ./chain-indexing

3. Test

./test.sh [--install-dependency] [--no-db] [--watch]

Providing --install-dependency will attempt to install test runner Ginkgo if it is not installed before.

4. Lint

Prerequisite

./lint.sh

5. Contributing

Please abide by the Code of Conduct in all interactions, and the contributing guidelines when submitting code.

6. License

Apache 2.0

chain-indexing's People

Contributors

allthatjazzleo avatar calvinaco avatar calvinlauyh avatar cdc-hitesh avatar devashishdxt avatar leejw51crypto avatar yihuang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.