Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run OCRv1 on devspace #11417

Merged
merged 3 commits into from
Nov 29, 2023
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
6 changes: 5 additions & 1 deletion charts/chainlink-cluster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ apiVersion: v1
name: chainlink-cluster
description: Chainlink nodes cluster
version: 0.1.3
appVersion: '2.6.0'
appVersion: '2.6.0'
dependencies:
- name: "killgrave"
version: "1.0.1"
repository: "https://charts.deliveryhero.io/"
10 changes: 3 additions & 7 deletions charts/chainlink-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,15 @@ Destroy the cluster
devspace purge
```

If you need to run some system level tests inside k8s use `runner` profile:
```
devspace dev -p runner
```
## Running load tests
Check this [doc](../../integration-tests/load/ocr/README.md)

If you used `devspace dev ...` always use `devspace reset pods` to switch the pods back

## Debug existing cluster
If you need to debug CL node that is already deployed change `dev.app.container` and `dev.app.labelSelector` in [devspace.yaml](devspace.yaml) if they are not default and run:
```
devspace dev -p node
or
devspace dev -p runner
```

## Automatic file sync
Expand All @@ -85,7 +81,7 @@ helm install -f values-raw-helm.yaml cl-cluster .
```
Forward all apps (in another terminal)
```
sudo kubefwd svc
sudo kubefwd svc -n cl-cluster
```
Then you can connect and run your tests

Expand Down
11 changes: 11 additions & 0 deletions charts/chainlink-cluster/connect.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace = "cl-cluster"
network_name = "geth"
network_chain_id = 1337
network_private_key = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
network_ws_url = "ws://geth:8546"
network_http_url = "http://geth:8544"
cl_node_url_template = "http://app-node-%d:6688"
cl_node_internal_dns_record_template = "app-node-%d"
cl_node_user = "[email protected]"
cl_node_password = "fj293fbBnlQ!f9vNs"
mockserver_url = "http://app-mockserver:1080"
7 changes: 2 additions & 5 deletions charts/chainlink-cluster/dashboard/cmd/dashboard_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ func main() {
if ldsn == "" {
panic("DATA_SOURCE_NAME must be provided")
}
os.Setenv("DATA_SOURCE_NAME", ldsn)
pdsn := os.Getenv("PROMETHEUS_DATA_SOURCE_NAME")
if ldsn == "" {
panic("DATA_SOURCE_NAME must be provided")
}
waspDsn := os.Getenv("DATA_SOURCE_NAME")
if waspDsn == "" {
panic("DATA_SOURCE_NAME must be provided, should be the same as LOKI_DATA_SOURCE_NAME")
}
dbf := os.Getenv("DASHBOARD_FOLDER")
if dbf == "" {
panic("DASHBOARD_FOLDER must be provided")
Expand All @@ -37,7 +34,7 @@ func main() {
panic("GRAFANA_TOKEN must be provided")
}
// if you'll use this dashboard base in other projects, you can add your own opts here to extend it
db, err := dashboard.NewCLClusterDashboard(name, ldsn, pdsn, dbf, grafanaURL, grafanaToken, nil)
db, err := dashboard.NewCLClusterDashboard(6, name, ldsn, pdsn, dbf, grafanaURL, grafanaToken, nil)
if err != nil {
panic(err)
}
Expand Down
83 changes: 72 additions & 11 deletions charts/chainlink-cluster/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const (

// CLClusterDashboard is a dashboard for a Chainlink cluster
type CLClusterDashboard struct {
Nodes int
Name string
LokiDataSourceName string
PrometheusDataSourceName string
Expand All @@ -204,8 +205,9 @@ type CLClusterDashboard struct {
}

// NewCLClusterDashboard returns a new dashboard for a Chainlink cluster, can be used as a base for more complex plugin based dashboards
func NewCLClusterDashboard(name, ldsn, pdsn, dbf, grafanaURL, grafanaToken string, opts []dashboard.Option) (*CLClusterDashboard, error) {
func NewCLClusterDashboard(nodes int, name, ldsn, pdsn, dbf, grafanaURL, grafanaToken string, opts []dashboard.Option) (*CLClusterDashboard, error) {
db := &CLClusterDashboard{
Nodes: nodes,
Name: name,
Folder: dbf,
LokiDataSourceName: ldsn,
Expand Down Expand Up @@ -236,6 +238,21 @@ func (m *CLClusterDashboard) logsRowOption(name, q string) row.Option {
)
}

func (m *CLClusterDashboard) logsRowOptionsForNodes(nodes int) []row.Option {
opts := make([]row.Option, 0)
for i := 1; i <= nodes; i++ {
opts = append(opts, row.WithLogs(
fmt.Sprintf("Node %d", i),
logs.DataSource(m.LokiDataSourceName),
logs.Span(12),
logs.Height("300px"),
logs.Transparent(),
logs.WithLokiTarget(fmt.Sprintf(`{namespace="${namespace}", app="app", instance="node-%d", container="node"}`, i)),
))
}
return opts
}

// timeseriesRowOption returns a row option for a timeseries with name, axis unit, query and legend template
func (m *CLClusterDashboard) timeseriesRowOption(name, axisUnit, query, legendTemplate string) row.Option {
var tsq timeseries.Option
Expand Down Expand Up @@ -372,6 +389,8 @@ func (m *CLClusterDashboard) generate() error {
m.logsRowOption("Node 2", `{namespace="${namespace}", app="app", instance="node-2", container="node"}`),
m.logsRowOption("Node 3", `{namespace="${namespace}", app="app", instance="node-3", container="node"}`),
m.logsRowOption("Node 4", `{namespace="${namespace}", app="app", instance="node-4", container="node"}`),
m.logsRowOption("Node 5", `{namespace="${namespace}", app="app", instance="node-5", container="node"}`),
m.logsRowOption("Node 6", `{namespace="${namespace}", app="app", instance="node-6", container="node"}`),
),
// HeadTracker
dashboard.Row("Head tracker",
Expand Down Expand Up @@ -416,13 +435,13 @@ func (m *CLClusterDashboard) generate() error {
"Bridge JSON Parse Values",
"",
`bridge_json_parse_values{namespace="${namespace}"}`,
"{{ pod }}",
"{{ pod }} JobID: {{ job_id }}",
),
m.timeseriesRowOption(
"OCR Median Values",
"",
`ocr_median_values{namespace="${namespace}"}`,
"{{ pod }}",
"{{pod}} JobID: {{ job_id }}",
),
),
dashboard.Row("Relay Config Poller",
Expand Down Expand Up @@ -827,26 +846,26 @@ func (m *CLClusterDashboard) generate() error {
m.timeseriesRowOption(
"Pipeline Task Execution Time",
"Sec",
`pipeline_task_execution_time{namespace="${namespace}"}`,
"{{pod}}",
`pipeline_task_execution_time{namespace="${namespace}"} / 1e6`,
"{{ pod }} JobID: {{ job_id }}",
),
m.timeseriesRowOption(
"Pipeline Run Errors",
"",
`pipeline_run_errors{namespace="${namespace}"}`,
"{{pod}}",
"{{ pod }} JobID: {{ job_id }}",
),
m.timeseriesRowOption(
"Pipeline Run Total Time to Completion",
"Sec",
`pipeline_run_total_time_to_completion{namespace="${namespace}"}`,
"{{pod}}",
`pipeline_run_total_time_to_completion{namespace="${namespace}"} / 1e6`,
"{{ pod }} JobID: {{ job_id }}",
),
m.timeseriesRowOption(
"Pipeline Tasks Total Finished",
"",
`pipeline_tasks_total_finished{namespace="${namespace}"}`,
"{{pod}}",
"{{ pod }} JobID: {{ job_id }}",
),
),
dashboard.Row(
Expand All @@ -865,12 +884,12 @@ func (m *CLClusterDashboard) generate() error {
m.timeseriesRowOption(
"Pipeline Task HTTP Fetch Time",
"Sec",
`pipeline_task_http_fetch_time{namespace="${namespace}"}`,
`pipeline_task_http_fetch_time{namespace="${namespace}"} / 1e6`,
"{{pod}}",
),
m.timeseriesRowOption(
"Pipeline Task HTTP Response Body Size",
"Sec",
"Bytes",
`pipeline_task_http_response_body_size{namespace="${namespace}"}`,
"{{pod}}",
),
Expand Down Expand Up @@ -920,6 +939,48 @@ func (m *CLClusterDashboard) generate() error {
),
),
}
logOptsFinal := make([]row.Option, 0)
logOptsFinal = append(
logOptsFinal,
row.Collapse(),
row.WithTimeSeries(
"Log Counters",
timeseries.Span(12),
timeseries.Height("200px"),
timeseries.DataSource(m.PrometheusDataSourceName),
timeseries.WithPrometheusTarget(
`log_panic_count{namespace="${namespace}"}`,
prometheus.Legend("{{pod}} - panic"),
),
timeseries.WithPrometheusTarget(
`log_fatal_count{namespace="${namespace}"}`,
prometheus.Legend("{{pod}} - fatal"),
),
timeseries.WithPrometheusTarget(
`log_critical_count{namespace="${namespace}"}`,
prometheus.Legend("{{pod}} - critical"),
),
timeseries.WithPrometheusTarget(
`log_warn_count{namespace="${namespace}"}`,
prometheus.Legend("{{pod}} - warn"),
),
timeseries.WithPrometheusTarget(
`log_error_count{namespace="${namespace}"}`,
prometheus.Legend("{{pod}} - error"),
),
),
m.logsRowOption("All errors", `
{namespace="${namespace}", app="app", container="node"}
| json
| level="error"
| line_format "{{ .instance }} {{ .level }} {{ .ts }} {{ .logger }} {{ .caller }} {{ .msg }} {{ .version }} {{ .nodeTier }} {{ .nodeName }} {{ .node }} {{ .evmChainID }} {{ .nodeOrder }} {{ .mode }} {{ .nodeState }} {{ .sentryEventID }} {{ .stacktrace }}"`),
)
logOptsFinal = append(logOptsFinal, m.logsRowOptionsForNodes(m.Nodes)...)
logRowOpts := dashboard.Row(
"Logs",
logOptsFinal...,
)
opts = append(opts, logRowOpts)
opts = append(opts, m.extendedOpts...)
builder, err := dashboard.New(
"Chainlink Cluster Dashboard",
Expand Down
14 changes: 13 additions & 1 deletion charts/chainlink-cluster/devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,17 @@ deployments:
blocktime: 1
mockserver:
port: 1080
mock:
enabled: true
imposters:
path: ""
tag: "0.4.1"
port: 1080
db:
stateful: false
chainlink:
web_port: 6688
p2p_port: 8090
p2p_port: 6690
nodes:
- name: node-1
image: ${DEVSPACE_IMAGE}
Expand All @@ -69,6 +75,12 @@ deployments:
- name: node-4
image: ${DEVSPACE_IMAGE}
version: latest
- name: node-5
image: ${DEVSPACE_IMAGE}
version: latest
- name: node-6
image: ${DEVSPACE_IMAGE}
version: latest
prometheusMonitor: "true"
podAnnotations: { }
nodeSelector: { }
Expand Down
6 changes: 6 additions & 0 deletions charts/chainlink-cluster/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: killgrave
repository: https://charts.deliveryhero.io/
version: 1.0.1
digest: sha256:a8b224810a4fd90c3a26e6eda96de8cf0ece1c58fcb314c4fe5ab9ec9e21fcbb
generated: "2023-11-28T14:38:48.410654+01:00"
12 changes: 11 additions & 1 deletion charts/chainlink-cluster/templates/chainlink-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,25 @@ data:
AllowOrigins = '*'
SecureCookies = false
SessionTimeout = '999h0m0s'
[Feature]
FeedsManager = true
LogPoller = true
UICSAKeys = true
[OCR]
Enabled = true
DefaultTransactionQueueDepth = 0
[P2P]
[P2P.V2]
Enabled = true
ListenAddresses = ["0.0.0.0:6690"]
ListenAddresses = ['0.0.0.0:6690']
AnnounceAddresses = ['0.0.0.0:6690']
DeltaDial = '500ms'
DeltaReconcile = '5s'
[[EVM]]
ChainID = '1337'
MinContractPayment = '0'
AutoCreateKey = true
FinalityDepth = 1
[[EVM.Nodes]]
Name = 'node-0'
WSURL = 'ws://geth:8546'
Expand Down
2 changes: 1 addition & 1 deletion charts/chainlink-cluster/templates/chainlink-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
port: {{ $.Values.chainlink.p2p_port }}
targetPort: {{ $.Values.chainlink.p2p_port }}
selector:
app: {{ $.Release.Name }}
instance: {{ $cfg.name }}
type: ClusterIP
---
{{- end }}
14 changes: 14 additions & 0 deletions charts/chainlink-cluster/templates/mockserver-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{ if (hasKey .Values "mockserver") }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-mockserver
spec:
selector:
app: {{ .Release.Name }}-mockserver
ports:
- name: serviceport
port: {{ default "1080" $.Values.mockserver.port}}
targetPort: serviceport
type: ClusterIP
{{ end }}
3 changes: 2 additions & 1 deletion charts/chainlink-cluster/templates/mockserver.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{ if (hasKey .Values "mockserver") }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-mockserver
labels:
app: {{ .Release.Name }}-mockserver
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Release.Name }}-mockserver
Expand Down Expand Up @@ -57,4 +57,5 @@ spec:
tolerations:
{{ toYaml . | indent 8 }}
{{- end }}
{{- end }}
---
Loading
Loading