Skip to content

upstream(indexer): Rework config and cli arguments #6517

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

Merged
merged 8 commits into from
Jun 17, 2025
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
12 changes: 6 additions & 6 deletions crates/iota-graphql-rpc/src/data/pg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ mod tests {
use diesel::QueryDsl;
use iota_framework::BuiltInFramework;
use iota_indexer::{
db::{get_pool_connection, new_connection_pool, reset_database},
db::{ConnectionPoolConfig, get_pool_connection, new_connection_pool, reset_database},
models::objects::StoredObject,
schema::objects,
types::IndexedObject,
Expand All @@ -216,11 +216,11 @@ mod tests {
#[test]
fn test_query_cost() {
let connection_config = ConnectionConfig::default();
let pool = new_connection_pool(
&connection_config.db_url,
Some(connection_config.db_pool_size),
)
.unwrap();
let connection_pool_config = ConnectionPoolConfig {
pool_size: connection_config.db_pool_size,
..Default::default()
};
let pool = new_connection_pool(&connection_config.db_url, &connection_pool_config).unwrap();
let mut conn = get_pool_connection(&pool).unwrap();
reset_database(&mut conn).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion crates/iota-graphql-rpc/src/test_infra/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::{net::SocketAddr, path::PathBuf, sync::Arc, time::Duration};

use iota_graphql_rpc_client::simple_client::SimpleClient;
pub use iota_indexer::handlers::objects_snapshot_handler::SnapshotLagConfig;
pub use iota_indexer::config::SnapshotLagConfig;
use iota_indexer::{
errors::IndexerError,
store::{PgIndexerStore, indexer_store::IndexerStore},
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-indexer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ backoff.workspace = true
bcs.workspace = true
cached.workspace = true
chrono.workspace = true
clap.workspace = true
clap = { workspace = true, features = ["env"] }
diesel = { workspace = true, features = ["chrono", "r2d2", "serde_json", "postgres"] }
diesel_migrations = "2.2.0"
downcast = "0.11.0"
Expand Down
27 changes: 26 additions & 1 deletion crates/iota-indexer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,22 @@ To run the indexer as a standalone service with an existing fullnode, follow the

```sh
# Change the RPC_CLIENT_URL to http://0.0.0.0:9000 to run indexer against local validator & fullnode

# Old CLI
cargo run --bin iota-indexer -- --db-url "postgres://postgres:postgrespw@localhost/iota_indexer" --rpc-client-url "https://api.devnet.iota.cafe:443" --fullnode-sync-worker --reset-db

# New CLI
cargo run --bin iota-indexer -- --db-url "postgres://postgres:postgrespw@localhost/iota_indexer" indexer --rpc-client-url "https://api.devnet.iota.cafe:443" --reset-db
```

- to run indexer as a reader which exposes a JSON RPC service with following [APIs](https://docs.iota.org/iota-api-ref).

```
```sh
# Old CLI
cargo run --bin iota-indexer -- --db-url "postgres://postgres:postgrespw@localhost/iota_indexer" --rpc-client-url "https://api.devnet.iota.cafe:443" --rpc-server-worker

# New CLI
cargo run --bin iota-indexer -- --db-url "postgres://postgres:postgrespw@localhost/iota_indexer" json-rpc-service --rpc-client-url "https://api.devnet.iota.cafe:443"
```

More available flags can be found in this [file](https://github.com/iotaledger/iota/blob/develop/crates/iota-indexer/src/lib.rs).
Expand All @@ -82,6 +91,22 @@ To wipe the database, make sure you are in the `iota/crates/iota-indexer` direct
diesel database reset --database-url="postgres://postgres:postgrespw@localhost/iota_indexer"
```

### CLI Reference

The IOTA Indexer is currently transitioning from the old CLI to a new one.
While both versions are still supported, the old CLI will be deprecated in the future.
Users are encouraged to start using the new CLI.

To view help information for each version:

```sh
# Old CLI
cargo run --bin iota-indexer -- help-deprecated

# New CLI
cargo run --bin iota-indexer -- help
```

### Running tests

To run the tests, a running postgres instance is required.
Expand Down
Loading