af9f6e5ca0
* feat(db): add SQL query wrapper for PostgreSQL placeholder conversion - Created query_wrapper module with functions to automatically convert SQLite ? placeholders to PostgreSQL $1, $2, ... format - Updated build.rs to handle mutually exclusive feature flags - Modified one query in mixnodes.rs as proof of concept - Added type conversions for PostgreSQL compatibility (u32->i64, u16->i32) This is a checkpoint commit before converting all queries to use the wrapper. * feat(nym-node-status-api): add PostgreSQL database support via feature flags Implement dual database support for SQLite and PostgreSQL through Cargo feature flags. The implementation uses a query wrapper that automatically converts SQLite-style ? placeholders to PostgreSQL-style $1, $2, ... placeholders at runtime. Key changes: - Add query wrapper functions that handle placeholder conversion - Convert all sqlx::query\! macros to use wrapper functions - Handle type conversions between databases (i64 vs i32) - Add feature-gated implementations for database-specific SQL syntax - Update Makefile with clippy targets for both database features - Document database support in README * feat(nym-node-status-agent): add multi-API support with random selection Agents can now connect to multiple APIs and randomly select one for each testrun: - Accept multiple --server arguments in format "address:port:auth_key" - Randomly shuffle server list before attempting connections - Try each server until a testrun is obtained - Submit results back only to the API that provided the testrun - Continue to next server if one is down or has no testruns available * feat(nym-node-status): implement primary/secondary server architecture - Agent now requests testruns only from primary server (first in list) - Results are submitted to all configured servers in parallel - Secondary servers accept external testruns via new v2 endpoint - Added auto-creation of gateway and testrun records on secondary servers - New database queries: get_or_create_gateway, insert_external_testrun - Client library enhanced with submit_results_with_context method * Bump Node status API version * Fix build workdir * Bump to 3.1.4 * Fix types and queries * 3.1.6 * Fix gateway perf, bump 3.1.7 * NodeId -> i32, 3.1.8 * Bump agent version * i64 -> i32 * Use image yq * Migration and more types * Update remaining JSONB columns * Simplify server config * Update build path * Change delimiter * bump agent * Split up pg and sqlite builds * More typing fixes, build-and-push script * Fix Dockerfile-pg * Bump node-status-api * TYping * Agent build script * More logging around testruns * Fail loudly on read errors * Cleanup * Debug get gateways query * Fix get_gateways query * Use pg cert, 3.1.16 * Submit regular results to primary server * Bump freshenss cutoff * Update Cargo.lock * fix: resolve rebase conflicts and compilation errors After rebasing onto develop, fixed several issues: - Fixed borrowed data escapes error by using sqlx::query directly in transaction functions - Removed unused imports and cleaned up code - Maintained database-specific implementations for transaction functions * fmt * Make PG default to make lives easier * Performance improvements for Explorer v2 * Fix sqlite build * Fix PG migration * Tests round 1 * DB tests * More tests * And some more tests * And some more, more tests * cargo fmt * Fix some failing lints * Fix lioness version problems * Clippy in tests --------- Co-authored-by: dynco-nym <173912580+dynco-nym@users.noreply.github.com>
101 lines
4.6 KiB
TOML
101 lines
4.6 KiB
TOML
# Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
[package]
|
|
name = "nym-node-status-api"
|
|
version = "3.2.2"
|
|
authors.workspace = true
|
|
repository.workspace = true
|
|
homepage.workspace = true
|
|
documentation.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
|
|
[dependencies]
|
|
ammonia = { workspace = true }
|
|
anyhow = { workspace = true }
|
|
axum = { workspace = true, features = ["tokio", "macros"] }
|
|
bip39 = { workspace = true }
|
|
celes = { workspace = true }
|
|
clap = { workspace = true, features = ["cargo", "derive", "env", "string"] }
|
|
cosmwasm-std = { workspace = true }
|
|
envy = { workspace = true }
|
|
futures-util = { workspace = true }
|
|
itertools = { workspace = true }
|
|
moka = { workspace = true, features = ["future"] }
|
|
# TODO dz had to switch to cheddar versions because develop is ahead of current
|
|
# Nym API: revert after Cheddar is out
|
|
nym-contracts-common = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar" }
|
|
nym-mixnet-contract-common = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar" }
|
|
nym-bin-common = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar", features = [
|
|
"openapi",
|
|
] }
|
|
nym-node-status-client = { path = "../nym-node-status-client" }
|
|
nym-crypto = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar" }
|
|
nym-http-api-client = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar" }
|
|
nym-http-api-common = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar", features = [
|
|
"middleware",
|
|
] }
|
|
nym-network-defaults = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar" }
|
|
nym-serde-helpers = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar" }
|
|
nym-statistics-common = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar" }
|
|
# nym-contracts-common = { path = "../../common/cosmwasm-smart-contracts/contracts-common" }
|
|
# nym-mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract", features = ["utoipa"] }
|
|
# nym-bin-common = { path = "../../common/bin-common", features = ["models"] }
|
|
# nym-node-status-client = { path = "../nym-node-status-client" }
|
|
# nym-crypto = { path = "../../common/crypto", features = ["asymmetric", "serde"] }
|
|
# nym-http-api-client = { path = "../../common/http-api-client" }
|
|
# nym-http-api-common = { path = "../../common/http-api-common", features = ["middleware"]}
|
|
# nym-network-defaults = { path = "../../common/network-defaults" }
|
|
# nym-serde-helpers = { path = "../../common/serde-helpers" }
|
|
# nym-statistics-common = { path = "../../common/statistics" }
|
|
# nym-validator-client = { path = "../../common/client-libs/validator-client" }
|
|
nym-validator-client = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar" }
|
|
# nym-task = { path = "../../common/task" }
|
|
# nym-node-requests = { path = "../../nym-node/nym-node-requests", features = ["openapi"] }
|
|
nym-task = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar" }
|
|
nym-node-requests = { git = "https://github.com/nymtech/nym.git", branch = "release/2025.11-cheddar" }
|
|
rand = { workspace = true }
|
|
rand_chacha = { workspace = true }
|
|
regex = { workspace = true }
|
|
reqwest = { workspace = true }
|
|
semver = { workspace = true }
|
|
serde = { workspace = true, features = ["derive"] }
|
|
serde_json = { workspace = true }
|
|
serde_json_path = { workspace = true }
|
|
strum = { workspace = true }
|
|
strum_macros = { workspace = true }
|
|
sqlx = { workspace = true, features = ["runtime-tokio-rustls", "time"] }
|
|
thiserror = { workspace = true }
|
|
time = { workspace = true, features = ["formatting"] }
|
|
tokio = { workspace = true, features = ["rt-multi-thread"] }
|
|
tokio-util = { workspace = true }
|
|
tracing = { workspace = true }
|
|
tracing-subscriber = { workspace = true, features = ["env-filter"] }
|
|
tracing-log = { workspace = true }
|
|
tower-http = { workspace = true, features = ["cors", "trace"] }
|
|
utoipa = { workspace = true, features = ["axum_extras", "time"] }
|
|
utoipa-swagger-ui = { workspace = true, features = ["axum"] }
|
|
utoipauto = { workspace = true }
|
|
|
|
nym-node-metrics = { path = "../../nym-node/nym-node-metrics" }
|
|
|
|
[features]
|
|
default = ["pg"]
|
|
sqlite = ["sqlx/sqlite"]
|
|
pg = ["sqlx/postgres"]
|
|
|
|
[build-dependencies]
|
|
anyhow = { workspace = true }
|
|
tokio = { workspace = true, features = ["macros"] }
|
|
sqlx = { workspace = true, features = [
|
|
"runtime-tokio-rustls",
|
|
"macros",
|
|
"migrate",
|
|
] }
|
|
|
|
[dev-dependencies]
|
|
axum-test = "17.3.0"
|
|
time = { workspace = true, features = ["macros"] }
|