Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add go-core volume #15

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ build-postgres:
# Builds, (re)creates, starts, and attaches to containers for a service
# This runs the additional go-core container
sync-local-postgres:
GO_CORE_FLAGS="$(GO_CORE_FLAGS)" CORE_ETL_FLAGS="-r ws://localhost:8546 --storage postgres-storage -p postgres://etl_user:etl_password@localhost:5432/etl_database" CORE_ETL_EXPORT_FLAGS="$(CORE_ETL_EXPORT_FLAGS)" docker-compose -f ./docker-compose/docker-compose-local-postgres.yml up -d
GO_CORE_FLAGS="$(GO_CORE_FLAGS)" CORE_ETL_FLAGS="-r ws://localhost:8546 --storage postgres -p postgres://etl_user:etl_password@localhost:5432/etl_database" CORE_ETL_EXPORT_FLAGS="$(CORE_ETL_EXPORT_FLAGS)" docker-compose -f ./docker-compose/docker-compose-local-postgres.yml up -d

# Builds, (re)creates, starts, and attaches to containers for a service
# This runs the additional go-core container
sync-remote-postgres:
CORE_ETL_FLAGS="-n mainnet --storage postgres-storage -p postgres://etl_user:etl_password@localhost:5432/etl_database" CORE_ETL_EXPORT_FLAGS="$(CORE_ETL_EXPORT_FLAGS)" docker-compose -f ./docker-compose/docker-compose-remote-postgres.yml up -d
CORE_ETL_FLAGS="-n mainnet --storage postgres -p postgres://etl_user:etl_password@localhost:5432/etl_database" CORE_ETL_EXPORT_FLAGS="$(CORE_ETL_EXPORT_FLAGS)" docker-compose -f ./docker-compose/docker-compose-remote-postgres.yml up -d

# Stops and removes containers, networks, volumes, and images created by docker-compose up
down-postgres:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Flag | Description | Environment Variable | Default Value
---| --- | --- | ---
`-r, --rpc-url <RPC_URL>` | URL of the RPC node that provides the blockchain data. | `RPC_URL` | wss://xcbws.coreblockchain.net
`-n, --network <NETWORK>` | Network to sync data from (e.g., mainnet, devin, private). | `NETWORK` | Mainnet
`--storage <STORAGE>` | Storage type for saving blockchain data (e.g., sqlite3-storage, postgres-storage). | `STORAGE` | sqlite3-storage
`--storage <STORAGE>` | Storage type for saving blockchain data (e.g., sqlite3, postgres). | `STORAGE` | sqlite3
`-s, --sqlite3-path <SQLITE3_PATH>` | Path to SQLite3 file where the blockchain data is saved. | `SQLITE3_PATH` | None
`-p, --postgres-db-dsn <POSTGRES_DB_DSN>` | Postgres database DSN where the blockchain data is saved. | `POSTGRES_DB_DSN` | None
`-t, --tables-prefix <TABLES_PREFIX>` | Prefix for the tables in the database. Useful when running multiple instances. | `TABLES_PREFIX` | etl
Expand Down Expand Up @@ -173,7 +173,7 @@ You can configure `core-etl` using environment variables or command-line flags.

```bash
export NETWORK="mainnet"
export STORAGE="sqlite3-storage"
export STORAGE="sqlite3"
export SQLITE3_PATH="/path/to/your/sqlite3.db"
export TABLES_PREFIX="etl"
export MODULES="blocks,transactions,token_transfers"
Expand All @@ -182,7 +182,7 @@ export MODULES="blocks,transactions,token_transfers"
### Command-Line Flags

```bash
./core-etl -n mainnet --storage sqlite3-storage -s /path/to/your/sqlite3.db -t etl -m blocks,transactions,token_transfers export
./core-etl -n mainnet --storage sqlite3 -s /path/to/your/sqlite3.db -t etl -m blocks,transactions,token_transfers export
```

## Examples
Expand All @@ -204,7 +204,7 @@ Export only transaction data for the Devin network to SQLite3 storage, using 10
Export transactions and CTN transfers to Postgres with a cleanup interval of 1 hour and retention period of 24 hours:

```bash
./core-etl --storage postgres-storage -p postgres://user:password@localhost:5432/dbname -m transactions,token_transfers export -w "ctn" -r 86400 -c 3600
./core-etl --storage postgres -p postgres://user:password@localhost:5432/dbname -m transactions,token_transfers export -w "ctn" -r 86400 -c 3600
```

Export blocks and transactions using a local node, with the `filtered_etl` table prefix. Do not sync data until the node is synced. Also, filter transactions by address `cb22as..21`:
Expand Down
4 changes: 3 additions & 1 deletion docker-compose/docker-compose-local-libsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ services:
entrypoint: [ "sh", "-c", "gocore ${GO_CORE_FLAGS}" ]
depends_on:
- libsql-server
volumes:
- ./go-core_data:/root/.core # Persist data
restart: always

core-etl:
image: ghcr.io/core-coin/core-cli:latest
image: ghcr.io/core-coin/core-etl:latest
container_name: core-etl
depends_on:
- go-core
Expand Down
4 changes: 3 additions & 1 deletion docker-compose/docker-compose-local-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ services:
entrypoint: [ "sh", "-c", "gocore ${GO_CORE_FLAGS}" ]
depends_on:
- etl-postgres
volumes:
- ./go-core_data:/root/.core # Persist data
restart: always

core-etl:
image: ghcr.io/core-coin/core-cli:latest
image: ghcr.io/core-coin/core-etl:latest
container_name: core-etl
depends_on:
- go-core
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/docker-compose-remote-libsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
restart: always

core-etl:
image: ghcr.io/core-coin/core-cli:latest
image: ghcr.io/core-coin/core-etl:latest
container_name: core-etl
depends_on:
- libsql-server
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/docker-compose-remote-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
restart: always

core-etl:
image: ghcr.io/core-coin/core-cli:latest
image: ghcr.io/core-coin/core-etl:latest
container_name: core-etl
depends_on:
- etl-postgres
Expand Down
Loading