Skip to content
Merged
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
2 changes: 2 additions & 0 deletions framework/.changeset/v0.10.16.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Use volumes for user's home directory and `config` folder for the CL node
- Store cached config on absolute path if the relative doesn't work
19 changes: 19 additions & 0 deletions framework/components/clnode/clnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const (
TmpImageName = "chainlink-tmp:latest"
CustomPortSeparator = ":"
DefaultCapabilitiesDir = "/usr/local/bin"
ConfigVolumeName = "clnode-config"
HomeVolumeName = "clnode-home"
)

var (
Expand Down Expand Up @@ -253,6 +255,23 @@ func newNode(in *Input, pgOut *postgres.Output) (*NodeOut, error) {
WithPort(DefaultHTTPPort).
WithStartupTimeout(3 * time.Minute).
WithPollInterval(200 * time.Millisecond),
Mounts: tc.ContainerMounts{
{
// various configuration files
Source: tc.GenericVolumeMountSource{
Name: ConfigVolumeName + "-" + in.Node.Name,
},
Target: "/config",
},
{
// kv store of the OCR jobs and other state files are stored
// in the user's home instead of the DB
Source: tc.GenericVolumeMountSource{
Name: HomeVolumeName + "-" + in.Node.Name,
},
Target: "/home/chainlink",
},
},
}
if in.Node.HTTPPort != 0 && in.Node.P2PPort != 0 {
req.HostConfigModifier = func(h *container.HostConfig) {
Expand Down
12 changes: 11 additions & 1 deletion framework/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,17 @@ func Store[T any](cfg *T) error {
if err != nil {
return err
}
return os.WriteFile(filepath.Join(DefaultConfigDir, cachedOutName), d, 0600)

writePath := filepath.Join(DefaultConfigDir, cachedOutName)
if _, err := os.Stat(writePath); err != nil {
var absErr error
writePath, absErr = filepath.Abs(cachedOutName)
if absErr != nil {
return fmt.Errorf("error getting absolute path for config file %s: %w", cachedOutName, absErr)
}
}

return os.WriteFile(writePath, d, 0600)
}

// JSONStrDuration is JSON friendly duration that can be parsed from "1h2m0s" Go format
Expand Down
Loading