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
3 changes: 3 additions & 0 deletions CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,9 @@ Start a Local Linera Network
* `--with-block-exporter` — Whether to start a block exporter for each validator

Default value: `false`
* `--num-block-exporters <NUM_BLOCK_EXPORTERS>` — The number of block exporters to start

Default value: `1`
* `--exporter-address <EXPORTER_ADDRESS>` — The address of the block exporter

Default value: `localhost`
Expand Down
33 changes: 5 additions & 28 deletions docker/Dockerfile.indexer-test → docker/Dockerfile.indexer
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ARG binaries=
ARG copy=${binaries:+_copy}
# ARG build_flag=--release
ARG build_folder=debug
ARG build_features=metrics
ARG build_features=scylladb,metrics
ARG rustflags="-C force-frame-pointers=yes"

FROM rust:1.74-slim-bookworm AS builder
Expand Down Expand Up @@ -63,7 +63,7 @@ COPY linera-persistent linera-persistent
COPY linera-version linera-version
COPY linera-views linera-views
COPY linera-views-derive linera-views-derive
COPY linera-web linera-web
COPY web web
COPY linera-witty linera-witty
COPY linera-witty-macros linera-witty-macros
COPY scripts scripts
Expand All @@ -73,22 +73,11 @@ ENV GIT_COMMIT=${git_commit}
ENV RUSTFLAGS=${rustflags}


# Build linera core binaries (no database features needed)
RUN cargo build ${build_flag:+"$build_flag"} \
--bin linera \
--bin linera-proxy \
--bin linera-server \
--features $build_features

# Build storage service (memory storage, no database features)
RUN cargo build ${build_flag:+"$build_flag"} \
-p linera-storage-service

# Build block exporter with metrics feature only
# Build block exporter with scylladb and metrics features
RUN cargo build ${build_flag:+"$build_flag"} \
-p linera-service \
--bin linera-exporter \
--features metrics
--features $build_features

# Build indexer binaries (no scylladb needed for testing)
RUN cargo build ${build_flag:+"$build_flag"} \
Expand All @@ -97,10 +86,6 @@ RUN cargo build ${build_flag:+"$build_flag"} \

# Move binaries to avoid directory conflicts and clean up to save space
RUN mv \
target/"$build_folder"/linera \
target/"$build_folder"/linera-proxy \
target/"$build_folder"/linera-server \
target/"$build_folder"/linera-storage-server \
target/"$build_folder"/linera-exporter \
target/"$build_folder"/linera-indexer-grpc \
./
Expand All @@ -109,10 +94,6 @@ RUN mv \
FROM scratch AS builder_copy
ARG binaries
COPY \
"$binaries"/linera \
"$binaries"/linera-server \
"$binaries"/linera-proxy \
"$binaries"/linera-storage-server \
"$binaries"/linera-exporter \
"$binaries"/linera-indexer-grpc \
./
Expand Down Expand Up @@ -140,12 +121,8 @@ RUN update-ca-certificates

ARG target

# Copy pre-built binaries for non-indexer services
# Copy only indexer and exporter binaries
COPY --from=binaries \
linera \
linera-proxy \
linera-server \
linera-storage-server \
linera-indexer-grpc \
linera-exporter \
./
29 changes: 29 additions & 0 deletions kubernetes/linera-validator/exporter-config.toml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
id = {{ .exporterId }}

metrics_port = {{ .Values.blockExporter.metricsPort }}

[service_config]
host = "0.0.0.0"
port = {{ .Values.blockExporter.port }}

[destination_config]
committee_destination = true

[[destination_config.destinations]]
file_name = "/data/linera-exporter.log"
kind = "Logging"

[[destination_config.destinations]]
kind = "Indexer"
tls = "ClearText"
port = {{ .Values.indexer.port }}
endpoint = "linera-indexer"
Copy link
Contributor

@deuszx deuszx Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works only in docker-compose. In real deployment this will have to be an address of an actual indexer endpoint.

Copy link
Contributor Author

@ndr-ds ndr-ds Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually on kubernetes this will be the actual internal hostname of the indexer endpoint :) so this works


[limits]
persistence_period_ms = 299000
work_queue_size = 256
blob_cache_weight_mb = 1024
blob_cache_items_capacity = 8192
block_cache_weight_mb = 1024
block_cache_items_capacity = 8192
auxiliary_cache_size_mb = 1024
139 changes: 139 additions & 0 deletions kubernetes/linera-validator/templates/block-exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{{- if .Values.blockExporter.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: block-exporter-config
data:
{{- range $i := until (int .Values.blockExporter.replicas) }}
exporter-config-{{ $i }}.toml: |
{{ tpl ($.Files.Get "exporter-config.toml.tpl") (dict "exporterId" $i "Values" $.Values) | indent 4 }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: linera-block-exporter
labels:
app: linera-block-exporter
spec:
clusterIP: None
ports:
- port: {{ .Values.blockExporter.port }}
name: http
- port: {{ .Values.blockExporter.metricsPort }}
name: metrics
selector:
app: linera-block-exporter
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: linera-block-exporter
spec:
serviceName: linera-block-exporter
replicas: {{ .Values.blockExporter.replicas }}
selector:
matchLabels:
app: linera-block-exporter
template:
metadata:
labels:
app: linera-block-exporter
spec:
{{- if eq .Values.environment "GCP" }}
nodeSelector:
workload: system
tolerations:
- key: system
value: "true"
effect: NoSchedule
{{- end }}
initContainers:
- name: config-selector
image: busybox
command:
- sh
- -c
- |
ORDINAL=$(echo $HOSTNAME | sed 's/.*-//')
cp /configmap/exporter-config-${ORDINAL}.toml /config/exporter-config.toml
volumeMounts:
- name: configmap
mountPath: /configmap
- name: config
mountPath: /config
containers:
- name: linera-block-exporter
image: {{ .Values.indexer.image }}
imagePullPolicy: {{ .Values.indexer.imagePullPolicy }}
command:
- "./linera-exporter"
- "--storage"
- "{{ .Values.storage }}"
- "--config-path"
- "/config/exporter-config.toml"
- "--metrics-port"
- "{{ .Values.blockExporter.metricsPort }}"
ports:
- containerPort: {{ .Values.blockExporter.port }}
name: http
- containerPort: {{ .Values.blockExporter.metricsPort }}
name: metrics
env:
- name: RUST_LOG
value: {{ .Values.blockExporter.logLevel }}
- name: RUST_BACKTRACE
value: "1"
volumeMounts:
- name: config
mountPath: /config
readOnly: true
- name: exporter-data
mountPath: /data
livenessProbe:
tcpSocket:
port: {{ .Values.blockExporter.port }}
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
tcpSocket:
port: {{ .Values.blockExporter.port }}
initialDelaySeconds: 5
periodSeconds: 5
volumes:
- name: configmap
configMap:
name: block-exporter-config
- name: config
emptyDir: {}
- name: exporter-data
persistentVolumeClaim:
claimName: exporter-data
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: exporter-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.blockExporter.storageSize }}
{{- if .Values.blockExporter.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: linera-block-exporter
labels:
app: linera-block-exporter
spec:
selector:
matchLabels:
app: linera-block-exporter
endpoints:
- port: metrics
path: /metrics
{{- end }}
{{- end }}
118 changes: 118 additions & 0 deletions kubernetes/linera-validator/templates/explorer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{{- if .Values.explorer.enabled }}
apiVersion: v1
kind: Service
metadata:
name: linera-explorer
labels:
app: linera-explorer
spec:
ports:
- port: {{ .Values.explorer.frontendPort }}
name: frontend
- port: {{ .Values.explorer.apiPort }}
name: api
selector:
app: linera-explorer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: linera-explorer
spec:
replicas: 1
selector:
matchLabels:
app: linera-explorer
template:
metadata:
labels:
app: linera-explorer
spec:
{{- if eq .Values.environment "GCP" }}
nodeSelector:
workload: system
tolerations:
- key: system
value: "true"
effect: NoSchedule
{{- end }}
containers:
- name: linera-explorer
image: {{ .Values.explorer.image }}
imagePullPolicy: {{ .Values.explorer.imagePullPolicy }}
ports:
- containerPort: {{ .Values.explorer.frontendPort }}
name: frontend
- containerPort: {{ .Values.explorer.apiPort }}
name: api
env:
- name: NODE_ENV
value: "production"
- name: DB_PATH
value: "/data/indexer.db"
- name: EXPLORER_FRONTEND_PORT
value: "{{ .Values.explorer.frontendPort }}"
- name: EXPLORER_API_PORT
value: "{{ .Values.explorer.apiPort }}"
- name: LOG_LEVEL
value: {{ .Values.explorer.logLevel }}
volumeMounts:
- name: indexer-data
mountPath: /data
readOnly: true
livenessProbe:
httpGet:
path: /api/health
port: {{ .Values.explorer.apiPort }}
initialDelaySeconds: 30
periodSeconds: 30
readinessProbe:
httpGet:
path: /api/health
port: {{ .Values.explorer.apiPort }}
initialDelaySeconds: 10
periodSeconds: 10
volumes:
- name: indexer-data
persistentVolumeClaim:
claimName: indexer-data
{{- if .Values.explorer.ingress.enabled }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: linera-explorer
labels:
app: linera-explorer
{{- with .Values.explorer.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.explorer.ingress.tls }}
tls:
{{- range .Values.explorer.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.explorer.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
backend:
service:
name: linera-explorer
port:
number: {{ $.Values.explorer.frontendPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Loading
Loading