mirror of
https://github.com/DeBrosOfficial/network.git
synced 2025-10-06 18:19:08 +00:00
Fix RQLite join address for regular nodes
- Regular nodes now join actual bootstrap nodes instead of localhost:4001 - Extract IP from bootstrap peer multiaddrs for RQLite join address - Add fallback to first known bootstrap node (57.129.81.31:4001) - This fixes the 'fatal: http://localhost:4001 is an invalid join address' error Regular nodes will now properly join the RQLite cluster of bootstrap nodes instead of trying to join themselves, which was causing startup failures.
This commit is contained in:
parent
3975b5a59d
commit
480354267a
@ -88,24 +88,40 @@ func main() {
|
|||||||
cfg.Database.RQLiteJoinAddress = ""
|
cfg.Database.RQLiteJoinAddress = ""
|
||||||
logger.Printf("Bootstrap node - starting new RQLite cluster")
|
logger.Printf("Bootstrap node - starting new RQLite cluster")
|
||||||
} else {
|
} else {
|
||||||
// Regular nodes join the bootstrap node's RQLite cluster
|
|
||||||
cfg.Database.RQLiteJoinAddress = "http://localhost:4001"
|
|
||||||
|
|
||||||
// Configure bootstrap peers for P2P discovery
|
// Configure bootstrap peers for P2P discovery
|
||||||
|
var rqliteJoinAddr string
|
||||||
if *bootstrap != "" {
|
if *bootstrap != "" {
|
||||||
// Use command line bootstrap if provided
|
// Use command line bootstrap if provided
|
||||||
cfg.Discovery.BootstrapPeers = []string{*bootstrap}
|
cfg.Discovery.BootstrapPeers = []string{*bootstrap}
|
||||||
|
// Extract IP from bootstrap peer for RQLite join
|
||||||
|
bootstrapHost := parseHostFromMultiaddr(*bootstrap)
|
||||||
|
if bootstrapHost != "" {
|
||||||
|
rqliteJoinAddr = fmt.Sprintf("http://%s:4001", bootstrapHost)
|
||||||
|
} else {
|
||||||
|
rqliteJoinAddr = "http://57.129.81.31:4001" // Default fallback
|
||||||
|
}
|
||||||
logger.Printf("Using command line bootstrap peer: %s", *bootstrap)
|
logger.Printf("Using command line bootstrap peer: %s", *bootstrap)
|
||||||
} else {
|
} else {
|
||||||
// Use environment-configured bootstrap peers
|
// Use environment-configured bootstrap peers
|
||||||
bootstrapPeers := constants.GetBootstrapPeers()
|
bootstrapPeers := constants.GetBootstrapPeers()
|
||||||
if len(bootstrapPeers) > 0 {
|
if len(bootstrapPeers) > 0 {
|
||||||
cfg.Discovery.BootstrapPeers = bootstrapPeers
|
cfg.Discovery.BootstrapPeers = bootstrapPeers
|
||||||
|
// Use the first bootstrap peer for RQLite join
|
||||||
|
bootstrapHost := parseHostFromMultiaddr(bootstrapPeers[0])
|
||||||
|
if bootstrapHost != "" {
|
||||||
|
rqliteJoinAddr = fmt.Sprintf("http://%s:4001", bootstrapHost)
|
||||||
|
} else {
|
||||||
|
rqliteJoinAddr = "http://57.129.81.31:4001" // Default fallback
|
||||||
|
}
|
||||||
logger.Printf("Using environment bootstrap peers: %v", bootstrapPeers)
|
logger.Printf("Using environment bootstrap peers: %v", bootstrapPeers)
|
||||||
} else {
|
} else {
|
||||||
logger.Printf("Warning: No bootstrap peers configured")
|
logger.Printf("Warning: No bootstrap peers configured")
|
||||||
|
rqliteJoinAddr = "http://57.129.81.31:4001" // Default fallback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Regular nodes join the bootstrap node's RQLite cluster
|
||||||
|
cfg.Database.RQLiteJoinAddress = rqliteJoinAddr
|
||||||
logger.Printf("Regular node - joining RQLite cluster at: %s", cfg.Database.RQLiteJoinAddress)
|
logger.Printf("Regular node - joining RQLite cluster at: %s", cfg.Database.RQLiteJoinAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user