From 33d87610fd3f521f40f315e197867bfe10d3e4a1 Mon Sep 17 00:00:00 2001 From: charithabandi Date: Mon, 3 Mar 2025 10:32:04 -0600 Subject: [PATCH] configs to skip runtime dependency checks and configurable postgres client paths --- app/node/build.go | 18 ++++++++++++------ config/config.go | 8 ++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/node/build.go b/app/node/build.go index 15548ef46..b1369262e 100644 --- a/app/node/build.go +++ b/app/node/build.go @@ -700,15 +700,21 @@ func buildJRPCAdminServer(d *coreDependencies) *rpcserver.Server { // All nodes in the network must have 16.x version to produce consistent and deterministic snapshots. // - psql: required for state-sync to restore the state from a snapshot. Required version is 16.x. func verifyDependencies(d *coreDependencies) { - // Check if pg_dump is installed, which is necessary for snapshotting during migrations and when snapshots are enabled. Ensure that the version is 16.x - if err := checkVersion("pg_dump", 16); err != nil { - failBuild(err, "pg_dump version is not 16.x. Please install the correct version.") + if d.cfg.SkipDependencyVerification { + d.logger.Warn("Skipping runtime dependency verification of pg_dump and psql binaries") + return + } + + // Check if pg_dump is installed, which is necessary for snapshotting during migrations + // and when snapshots are enabled. Ensure that the version is 16.x + if err := checkVersion(d.cfg.PGDumpPath, 16); err != nil { + failBuild(err, "pg_dump version check failure. Please ensure that 16.x version is installed") } if d.cfg.StateSync.Enable { // Check if psql is installed and is on version 16.x, which is required for state-sync - if err := checkVersion("psql", 16); err != nil { - failBuild(err, "psql version is not 16.x. Please install the correct version.") + if err := checkVersion(d.cfg.StateSync.PsqlPath, 16); err != nil { + failBuild(err, "psql version check failure. Please ensure that 16.x version is installed") } } } @@ -781,7 +787,7 @@ func tlsConfig(d *coreDependencies, withTransportClientAuth bool) *tls.Config { } d.logger.Info("generated admin service client CAs file", "file", clientsFile) } else { - d.logger.Info("No admin client CAs file. Use 'kwild admin gen-auth-key' to generate.") + d.logger.Info("No admin client CAs file. Use 'kwild admin gen-auth-key' to generate") } if len(clientsCerts) > 0 && !caCertPool.AppendCertsFromPEM(clientsCerts) { diff --git a/config/config.go b/config/config.go index 40a349f28..dd5cac09c 100644 --- a/config/config.go +++ b/config/config.go @@ -314,6 +314,7 @@ func DefaultConfig() *Config { Enable: false, DiscoveryTimeout: types.Duration(15 * time.Second), MaxRetries: 3, + PsqlPath: "psql", }, Extensions: make(map[string]map[string]string), Checkpoint: Checkpoint{ @@ -325,6 +326,8 @@ func DefaultConfig() *Config { BlockSyncChuckSize: make(map[string]string), Signer: make(map[string]string), }, + SkipDependencyVerification: false, + PGDumpPath: "pg_dump", } } @@ -353,6 +356,10 @@ type Config struct { Migrations MigrationConfig `toml:"migrations" comment:"zero downtime migration configuration"` Checkpoint Checkpoint `toml:"checkpoint" comment:"checkpoint info for the leader to sync to before proposing a new block"` Erc20Bridge ERC20BridgeConfig `toml:"erc20_bridge" comment:"ERC20 bridge configuration"` + + SkipDependencyVerification bool `toml:"skip_dependency_verification" comment:"skip runtime dependency verification (the pg_dump and psql binaries)"` + // PGDump: used by the snapshot and the migration module for producing snapshots. + PGDumpPath string `toml:"pg_dump_path" comment:"path to the pg_dump binary for taking snapshots"` } type Telemetry struct { @@ -458,6 +465,7 @@ type StateSyncConfig struct { DiscoveryTimeout types.Duration `toml:"discovery_time" comment:"how long to discover snapshots before selecting one to use"` MaxRetries uint64 `toml:"max_retries" comment:"how many times to try after failing to apply a snapshot before switching to blocksync"` + PsqlPath string `toml:"psql_path" comment:"path to the PSQL binary for applying snapshots"` } type MigrationConfig struct {