Skip to content

Commit

Permalink
configs to skip runtime dependency checks and configurable postgres c…
Browse files Browse the repository at this point in the history
…lient paths
  • Loading branch information
charithabandi authored and jchappelow committed Mar 3, 2025
1 parent e5f20eb commit 33d8761
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
18 changes: 12 additions & 6 deletions app/node/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
}
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -325,6 +326,8 @@ func DefaultConfig() *Config {
BlockSyncChuckSize: make(map[string]string),
Signer: make(map[string]string),
},
SkipDependencyVerification: false,
PGDumpPath: "pg_dump",
}
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 33d8761

Please sign in to comment.