Skip to content

Commit

Permalink
validator docker file is not generated from templates
Browse files Browse the repository at this point in the history
  • Loading branch information
fighting-dreamer committed Oct 22, 2024
1 parent bdde8c0 commit 0cd790f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
1 change: 1 addition & 0 deletions shared/services/config/stader-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@ func (cfg *StaderConfig) GenerateEnvironmentVariables() map[string]string {
envVars["TX_FEE_CAP_IN_WEI"] = txFeeCapInWei.String()
envVars["TX_FEE_CAP"] = fmt.Sprintf("%d", int64(txFeeCap))
envVars["TX_FEE_CAP_IN_GWEI"] = fmt.Sprintf("%d", int64(txFeeCapInGwei))
envVars["SSV_MODE"] = fmt.Sprintf("%v", cfg.IsSSVMode)
config.AddParametersToEnvVars(cfg.StaderNode.GetParameters(), envVars)
config.AddParametersToEnvVars(cfg.GetParameters(), envVars)

Expand Down
52 changes: 27 additions & 25 deletions shared/services/stader/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1455,19 +1455,20 @@ func (c *Client) deployTemplates(cfg *config.StaderConfig, staderDir string, set
deployedContainers = append(deployedContainers, guardianComposePath)
deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.GuardianContainerName+composeFileSuffix))

// Validator
contents, err = envsubst.ReadFile(filepath.Join(templatesFolder, config.ValidatorContainerName+templateSuffix))
if err != nil {
return []string{}, fmt.Errorf("error reading and substituting validator container template: %w", err)
}
validatorComposePath := filepath.Join(runtimeFolder, config.ValidatorContainerName+composeFileSuffix)
err = ioutil.WriteFile(validatorComposePath, contents, 0664)
if err != nil {
return []string{}, fmt.Errorf("could not write validator container file to %s: %w", validatorComposePath, err)
if !cfg.IsSSVMode {
// Validator
contents, err = envsubst.ReadFile(filepath.Join(templatesFolder, config.ValidatorContainerName+templateSuffix))
if err != nil {
return []string{}, fmt.Errorf("error reading and substituting validator container template: %w", err)
}
validatorComposePath := filepath.Join(runtimeFolder, config.ValidatorContainerName+composeFileSuffix)
err = ioutil.WriteFile(validatorComposePath, contents, 0664)
if err != nil {
return []string{}, fmt.Errorf("could not write validator container file to %s: %w", validatorComposePath, err)
}
deployedContainers = append(deployedContainers, validatorComposePath)
deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.ValidatorContainerName+composeFileSuffix))
}
deployedContainers = append(deployedContainers, validatorComposePath)
deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.ValidatorContainerName+composeFileSuffix))

// Check the EC mode to see if it needs to be deployed
if cfg.ExecutionClientMode.Value.(cfgtypes.Mode) == cfgtypes.Mode_Local {
contents, err = envsubst.ReadFile(filepath.Join(templatesFolder, config.Eth1ContainerName+templateSuffix))
Expand All @@ -1482,20 +1483,21 @@ func (c *Client) deployTemplates(cfg *config.StaderConfig, staderDir string, set
deployedContainers = append(deployedContainers, eth1ComposePath)
deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.Eth1ContainerName+composeFileSuffix))
}

// Check the Consensus mode
if cfg.ConsensusClientMode.Value.(cfgtypes.Mode) == cfgtypes.Mode_Local {
contents, err = envsubst.ReadFile(filepath.Join(templatesFolder, config.Eth2ContainerName+templateSuffix))
if err != nil {
return []string{}, fmt.Errorf("error reading and substituting consensus client container template: %w", err)
}
eth2ComposePath := filepath.Join(runtimeFolder, config.Eth2ContainerName+composeFileSuffix)
err = ioutil.WriteFile(eth2ComposePath, contents, 0664)
if err != nil {
return []string{}, fmt.Errorf("could not write consensus client container file to %s: %w", eth2ComposePath, err)
if !cfg.IsSSVMode {
// Check the Consensus mode
if cfg.ConsensusClientMode.Value.(cfgtypes.Mode) == cfgtypes.Mode_Local {
contents, err = envsubst.ReadFile(filepath.Join(templatesFolder, config.Eth2ContainerName+templateSuffix))
if err != nil {
return []string{}, fmt.Errorf("error reading and substituting consensus client container template: %w", err)
}
eth2ComposePath := filepath.Join(runtimeFolder, config.Eth2ContainerName+composeFileSuffix)
err = ioutil.WriteFile(eth2ComposePath, contents, 0664)
if err != nil {
return []string{}, fmt.Errorf("could not write consensus client container file to %s: %w", eth2ComposePath, err)
}
deployedContainers = append(deployedContainers, eth2ComposePath)
deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.Eth2ContainerName+composeFileSuffix))
}
deployedContainers = append(deployedContainers, eth2ComposePath)
deployedContainers = append(deployedContainers, filepath.Join(overrideFolder, config.Eth2ContainerName+composeFileSuffix))
}

// Check the metrics containers
Expand Down

0 comments on commit 0cd790f

Please sign in to comment.