Skip to content

Commit

Permalink
dlv from flag, fix promtail logs (#1488)
Browse files Browse the repository at this point in the history
  • Loading branch information
skudasov authored Dec 16, 2024
1 parent 88c6d2e commit ee5df76
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions book/src/framework/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
| CTF_IGNORE_CRITICAL_LOGS | Ignore all logs that has CRIT,FATAL or PANIC levels (Chainlink nodes only!) | `true`, `false` | `false` | 🚫 |
| CTF_CHAINLINK_IMAGE | Flag to override Chainlink Docker image in format $repository:$tag | $repository:$tag | - | 🚫 |
| CTF_JD_IMAGE | Job distributor service image in format $repository:$tag | $repository:$tag | - | 🚫 |
| CTF_CLNODE_DLV | Use debug entrypoint to allow Delve debugger connection, works only with "plugins" image of CL node | `true`, `false` | `false` | 🚫 |
| LOKI_URL | URL to `Loki` push api, should be like`${host}/loki/api/v1/push` | URL | `http://host.docker.internal:3030/loki/api/v1/push` | 🚫 |
| LOKI_TENANT_ID | Streams all components logs to `Loki`, see params below | `string` | `promtail` | 🚫 |
| LOKI_BASIC_AUTH | Basic auth in format $user:$password | `$user:$password` | - | 🚫 |
Expand Down
2 changes: 2 additions & 0 deletions framework/.changeset/v0.3.9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Dlv from original image
- Fix logs for promtail
9 changes: 6 additions & 3 deletions framework/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ func WriteAllContainersLogs(dir string) error {
func BuildImageOnce(once *sync.Once, dctx, dfile, nameAndTag string) error {
var err error
once.Do(func() {
dfilePath := filepath.Join(dctx, dfile)
err = runCommand("docker", "build", "-t", nameAndTag, "-f", dfilePath, dctx)
err = BuildImage(dctx, dfile, nameAndTag)
if err != nil {
err = fmt.Errorf("failed to build Docker image: %w", err)
}
Expand All @@ -275,5 +274,9 @@ func BuildImageOnce(once *sync.Once, dctx, dfile, nameAndTag string) error {

func BuildImage(dctx, dfile, nameAndTag string) error {
dfilePath := filepath.Join(dctx, dfile)
return runCommand("docker", "build", "-t", nameAndTag, "-f", dfilePath, dctx)
if os.Getenv("CTF_CLNODE_DLV") == "true" {
return runCommand("docker", "build", "--build-arg", `GO_GCFLAGS=all=-N -l`, "-t", nameAndTag, "-f", dfilePath, dctx)
} else {
return runCommand("docker", "build", "-t", nameAndTag, "-f", dfilePath, dctx)
}
}
2 changes: 1 addition & 1 deletion framework/promtail.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ scrape_configs:
lokiTenantID := os.Getenv("LOKI_TENANT_ID")

if lokiURL == "" {
lokiURL = "http://host.docker.internal:3100/loki/api/v1/push"
lokiURL = "http://host.docker.internal:3030/loki/api/v1/push"
}
if lokiTenantID == "" {
lokiTenantID = "promtail"
Expand Down

0 comments on commit ee5df76

Please sign in to comment.