Skip to content
Open
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
14 changes: 9 additions & 5 deletions cmd/beekeeper/cmd/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,13 @@ func setupBootnodes(ctx context.Context,
nodeName = node.Name
}

bConfig.Bootnodes = fmt.Sprintf(node.Bootnodes, clusterConfig.GetNamespace()) // TODO: improve bootnode management, support more than 2 bootnodes
bootnodesOut = bConfig.Bootnodes
nodeOpts := setupNodeOptions(node, &bConfig)
// each node gets its own config copy, as the bootnode list is
// node-specific and nodes are set up concurrently
nodeConfig := bConfig
bootnodes := fmt.Sprintf(node.Bootnodes, clusterConfig.GetNamespace()) // TODO: improve bootnode management, support more than 2 bootnodes
nodeConfig.Bootnodes = &[]string{bootnodes}
bootnodesOut = bootnodes
nodeOpts := setupNodeOptions(node, &nodeConfig)
nodeCount++
go setupOrAddNode(ctx, startCluster, inCluster, ng, nodeName, nodeOpts, nodeResultChan, orchestration.WithNoOptions())
}
Expand Down Expand Up @@ -299,8 +303,8 @@ func setupNodes(ctx context.Context,
}
bConfig := beeConfig.Export()

if bConfig.Bootnodes == "" {
bConfig.Bootnodes = bootnodesIn
if (bConfig.Bootnodes == nil || len(*bConfig.Bootnodes) == 0) && bootnodesIn != "" {
bConfig.Bootnodes = &[]string{bootnodesIn}
}
ngOptions.BeeConfig = &bConfig

Expand Down
10 changes: 5 additions & 5 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ bee-configs:
block-time: 1
blockchain-rpc-endpoint: "ws://geth-swap.bee-playground.svc.swarm1.local:8546"
bootnode-mode: false
bootnodes: ""
bootnode: []
cache-capacity: 1000000
chequebook-enable: true
cors-allowed-origins: ""
cors-allowed-origins: []
data-dir: "/home/bee/.bee"
db-block-cache-capacity: 33554432
db-disable-seeks-compaction: false
Expand All @@ -117,19 +117,19 @@ bee-configs:
postage-stamp-start-block: 1
price-oracle-address: "0x5aFE06fcC0855a76a15c3544b0886EDBE3294d62"
redistribution-address: "0x09Ad42a7d020244920309FfA14EA376dd2D3b7d5"
resolver-options: ""
resolver-options: []
staking-address: "0xfc28330f1ecE0ef2371B724E0D19c1EE60B728b2"
storage-incentives-enable: true
swap-enable: true
swap-factory-address: "0xdD661f2500bA5831e3d1FEbAc379Ea1bF80773Ac"
swap-initial-deposit: 500000000000000000
tracing-enabled: true
tracing-enable: true
tracing-endpoint: "10.10.11.199:6831"
tracing-service-name: "bee"
verbosity: 5 # 1=error, 2=warn, 3=info, 4=debug, 5=trace
warmup-time: 0s
welcome-message: "Welcome to the Swarm, you are Bee-ing connected!"
withdrawal-addresses-whitelist: "0xec44cb15b1b033e74d55ac5d0e24d861bde54532"
withdrawal-addresses-whitelist: ["0xec44cb15b1b033e74d55ac5d0e24d861bde54532"]
bootnode:
_inherit: "default"
bootnode-mode: true
Expand Down
12 changes: 4 additions & 8 deletions config/local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ bee-configs:
block-time: 1
blockchain-rpc-endpoint: "ws://geth-swap:8546"
bootnode-mode: false
bootnodes: ""
bootnode: []
cache-capacity: 20000
chequebook-enable: true
cors-allowed-origins: ""
cors-allowed-origins: []
data-dir: "/home/bee/.bee"
db-block-cache-capacity: 33554432
db-disable-seeks-compaction: false
Expand All @@ -178,7 +178,7 @@ bee-configs:
postage-stamp-start-block: 1
price-oracle-address: "0x5aFE06fcC0855a76a15c3544b0886EDBE3294d62"
redistribution-address: "0x09Ad42a7d020244920309FfA14EA376dd2D3b7d5"
resolver-options: ""
resolver-options: []
staking-address: "0xfc28330f1ecE0ef2371B724E0D19c1EE60B728b2"
storage-incentives-enable: true
swap-enable: true
Expand All @@ -187,14 +187,13 @@ bee-configs:
verbosity: 5
warmup-time: 0s
welcome-message: "Welcome to the Swarm, this is a local cluster!"
withdrawal-addresses-whitelist: "0xec44cb15b1b033e74d55ac5d0e24d861bde54532"
withdrawal-addresses-whitelist: ["0xec44cb15b1b033e74d55ac5d0e24d861bde54532"]
bootnode-local-dns-autotls:
_inherit: "bee-local-dns"
bootnode-mode: true
p2p-wss-enable: true
bee-local-autotls:
_inherit: "bee-local-dns"
bootnode: /dnsaddr/bootnode-0-headless.local.svc.cluster.local
p2p-wss-enable: true
bee-local-light-autotls:
_inherit: "bee-local-light"
Expand All @@ -209,14 +208,11 @@ bee-configs:
bootnode-mode: true
bee-local-dns:
_inherit: "bee-local"
bootnode: /dnsaddr/localhost
bootnode-local-dns:
_inherit: "bee-local"
bootnode: /dnsaddr/localhost
bootnode-mode: true
bee-local-light:
_inherit: "bee-local"
bootnode: /dnsaddr/localhost
full-node: false
bee-local-gc:
_inherit: "bee-local"
Expand Down
2 changes: 1 addition & 1 deletion config/public-testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ node-groups:
bee-configs:
sepolia:
_inherit: ""
bootnodes: "/dnsaddr/testnet.ethswarm.org"
bootnode: ["/dnsaddr/testnet.ethswarm.org"]
full-node: true

checks:
Expand Down
6 changes: 3 additions & 3 deletions config/staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ clusters:
mode: node
bee-config: staging
config: staging
count: 5
count: 1

# node-groups defines node groups that can be registered in the cluster
# node-groups may inherit it's configuration from already defined node-group and override specific fields from it
Expand All @@ -34,14 +34,14 @@ bee-configs:
_inherit: ""
api-addr: ":1633"
blockchain-rpc-endpoint: http://rpc-sepolia-haproxy.default.svc.swarm1.local
bootnodes: /dnsaddr/testnet.ethswarm.org
bootnode: ["/dnsaddr/testnet.ethswarm.org"]
full-node: true
mainnet: false
network-id: 10
p2p-addr: ":1634"
password: "beekeeper"
swap-enable: true
tracing-enabled: true
tracing-enable: true
tracing-endpoint: "10.10.11.199:6831"
tracing-service-name: "bee"
verbosity: 4
Expand Down
21 changes: 2 additions & 19 deletions config/testnet-bee-playground.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ clusters:
api-insecure-tls: true
api-scheme: http
funding:
eth: 0.1
eth: 0.01
bzz: 3.0
node-groups:
bootnode:
Expand Down Expand Up @@ -44,33 +44,16 @@ bee-configs:
api-addr: :1633
block-time: 12
blockchain-rpc-endpoint: http://rpc-sepolia-haproxy.default.svc.swarm1.local
bootnode-mode: false
bootnodes: # /dnsaddr/testnet.ethswarm.org
cache-capacity: 1000000
# bootnode: [dnsaddr/testnet.ethswarm.org]
chequebook-enable: true
cors-allowed-origins: ""
data-dir: "/home/bee/.bee"
db-block-cache-capacity: 33554432
db-disable-seeks-compaction: true
db-open-files-limit: 200
db-write-buffer-size: 33554432
full-node: true
mainnet: false
nat-addr: ""
network-id: 5
p2p-addr: :1634
p2p-ws-enable: true
password: "beekeeper"
payment-early-percent: 50
payment-threshold: 13500000
payment-tolerance-percent: 25
postage-stamp-start-block: 0
storage-incentives-enable: true
swap-enable: true
swap-initial-deposit: 0
tracing-enabled: false
tracing-endpoint: "10.10.11.199:6831"
tracing-service-name: "bee-playground"
verbosity: 5
warmup-time: 5m0s
welcome-message: Welcome to the bee-playground!
Expand Down
7 changes: 4 additions & 3 deletions pkg/check/autotls/autotls.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,10 @@ func (c *Check) forgeConfig(ctx context.Context, cluster orchestration.Cluster,
continue
}
cfg := node.Config()
forgeDomain = cfg.AutoTLSDomain
if strings.Contains(cfg.AutoTLSCAEndpoint, "pebble") {
mgmtURL := pebbleMgmtURL(cfg.AutoTLSCAEndpoint)
forgeDomain = orchestration.Deref(cfg.AutoTLSDomain)
caEndpoint := orchestration.Deref(cfg.AutoTLSCAEndpoint)
if strings.Contains(caEndpoint, "pebble") {
mgmtURL := pebbleMgmtURL(caEndpoint)
if pebbleMgmtURLOverride != "" {
mgmtURL = pebbleMgmtURLOverride
}
Expand Down
96 changes: 15 additions & 81 deletions pkg/config/bee.go
Original file line number Diff line number Diff line change
@@ -1,69 +1,24 @@
package config

import (
"reflect"
"time"

"github.com/ethersphere/beekeeper/pkg/orchestration"
)

type Inheritable interface {
GetParentName() string
}

// BeeConfig represents Bee configuration
// BeeConfig represents Bee configuration as read from Beekeeper's YAML config.
//
// It embeds orchestration.Config (the Bee flag set), so the flag fields are
// defined in exactly one place and the same yaml tags — the Bee flag names —
// are used both for reading the config here and for rendering the node's
// .bee.yaml. The only thing BeeConfig adds is the config-file-only concern of
// inheritance (_inherit). Export returns just the embedded Config, so neither
// _inherit nor any other config-loading detail can leak into the rendered file.
type BeeConfig struct {
// parent to inherit settings from
*Inherit `yaml:",inline"`
// Bee configuration
AllowPrivateCIDRs *bool `yaml:"allow-private-cidrs"`
APIAddr *string `yaml:"api-addr"`
AutoTLSCAEndpoint *string `yaml:"autotls-ca-endpoint"`
AutoTLSDomain *string `yaml:"autotls-domain"`
AutoTLSRegistrationEndpoint *string `yaml:"autotls-registration-endpoint"`
BlockchainRPCEndpoint *string `yaml:"blockchain-rpc-endpoint"`
BlockTime *uint64 `yaml:"block-time"`
BootnodeMode *bool `yaml:"bootnode-mode"`
Bootnodes *string `yaml:"bootnodes"`
CacheCapacity *uint64 `yaml:"cache-capacity"`
ChequebookEnable *bool `yaml:"chequebook-enable"`
CORSAllowedOrigins *string `yaml:"cors-allowed-origins"`
DataDir *string `yaml:"data-dir"`
DbBlockCacheCapacity *int `yaml:"db-block-cache-capacity"`
DbDisableSeeksCompaction *bool `yaml:"db-disable-seeks-compaction"`
DbOpenFilesLimit *int `yaml:"db-open-files-limit"`
DbWriteBufferSize *int `yaml:"db-write-buffer-size"`
FullNode *bool `yaml:"full-node"`
Mainnet *bool `yaml:"mainnet"`
NATAddr *string `yaml:"nat-addr"`
NATWSSAddr *string `yaml:"nat-wss-addr"`
NetworkID *uint64 `yaml:"network-id"`
P2PAddr *string `yaml:"p2p-addr"`
P2PWSEnable *bool `yaml:"p2p-ws-enable"`
P2PWSSAddr *string `yaml:"p2p-wss-addr"`
P2PWSSEnable *bool `yaml:"p2p-wss-enable"`
Password *string `yaml:"password"`
PaymentEarly *uint64 `yaml:"payment-early-percent"`
PaymentThreshold *uint64 `yaml:"payment-threshold"`
PaymentTolerance *uint64 `yaml:"payment-tolerance-percent"`
PostageContractStartBlock *uint64 `yaml:"postage-stamp-start-block"`
PostageStampAddress *string `yaml:"postage-stamp-address"`
PriceOracleAddress *string `yaml:"price-oracle-address"`
RedistributionAddress *string `yaml:"redistribution-address"`
ResolverOptions *string `yaml:"resolver-options"`
StakingAddress *string `yaml:"staking-address"`
StorageIncentivesEnable *string `yaml:"storage-incentives-enable"`
SwapEnable *bool `yaml:"swap-enable"`
SwapEndpoint *string `yaml:"swap-endpoint"` // deprecated: use blockchain-rpc-endpoint
SwapFactoryAddress *string `yaml:"swap-factory-address"`
SwapInitialDeposit *uint64 `yaml:"swap-initial-deposit"`
TracingEnabled *bool `yaml:"tracing-enabled"`
TracingEndpoint *string `yaml:"tracing-endpoint"`
TracingServiceName *string `yaml:"tracing-service-name"`
Verbosity *uint64 `yaml:"verbosity"`
WarmupTime *time.Duration `yaml:"warmup-time"`
WelcomeMessage *string `yaml:"welcome-message"`
WithdrawAddress *string `yaml:"withdrawal-addresses-whitelist"`
*Inherit `yaml:",inline"`
orchestration.Config `yaml:",inline"`
}

func (b BeeConfig) GetParentName() string {
Expand All @@ -73,30 +28,9 @@ func (b BeeConfig) GetParentName() string {
return ""
}

// Export exports BeeConfig to orchestration.Config
func (b *BeeConfig) Export() (config orchestration.Config) {
localVal := reflect.ValueOf(b).Elem()
localType := reflect.TypeFor[BeeConfig]()
remoteVal := reflect.ValueOf(&config).Elem()

for i := range localVal.NumField() {
localField := localVal.Field(i)
if localField.IsValid() && !localField.IsNil() {
localFieldVal := localVal.Field(i).Elem()
localFieldName := localType.Field(i).Name

remoteFieldVal := remoteVal.FieldByName(localFieldName)
if remoteFieldVal.IsValid() && remoteFieldVal.Type() == localFieldVal.Type() {
remoteFieldVal.Set(localFieldVal)
}
}
}

config = remoteVal.Interface().(orchestration.Config)

if config.BlockchainRPCEndpoint == "" && b.SwapEndpoint != nil {
config.BlockchainRPCEndpoint = *b.SwapEndpoint
}

return config
// Export returns the Bee flag configuration to be rendered into the node's
// .bee.yaml. Inheritance has already been resolved during config loading and is
// not part of the embedded Config.
func (b *BeeConfig) Export() orchestration.Config {
return b.Config
}
Loading
Loading