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

add nomadic indexer, following the model of tzkt #202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions charts/tezos/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,21 @@
{{- "" }}
{{- end }}
{{- end }}
{{- end }}


{{/*
Should deploy nomadic indexer?
*/}}
{{- define "tezos.shouldDeployNomadicIndexer" -}}

{{- $indexers := .Values.indexers | default dict }}
{{- if $indexers.nomadic }}
{{- $nomadic_config := $indexers.nomadic.config | default dict }}
{{- if $nomadic_config.rpc_url }}
{{- "true" }}
{{- else }}
{{- "" }}
{{- end }}
{{- end }}
{{- end }}
68 changes: 68 additions & 0 deletions charts/tezos/templates/nomadic_indexer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{- if (include "tezos.shouldDeployNomadicIndexer" .) }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Values.nomadic_indexer_statefulset.name }}
namespace: {{ .Release.Namespace }}
spec:
podManagementPolicy: Parallel
replicas: 1
selector:
matchLabels:
app: {{ .Values.nomadic_indexer_statefulset.name }}
serviceName: ""
template:
metadata:
labels:
app: {{ .Values.nomadic_indexer_statefulset.name }}
spec:
initContainers:
- image: registry.gitlab.com/nomadic-labs/tezos-indexer/tezos-indexer:v9.2.3
command: ["/bin/bash","-c"]
args: [ "/home/tezos/tezos-indexer --db-schema | tee /docker-entrypoint-initdb.d/tezos-indexer-schema.sql" ]
name: schema-extractor
volumeMounts:
- mountPath: /docker-entrypoint-initdb.d/
name: schema-volume
containers:
- image: registry.gitlab.com/nomadic-labs/tezos-indexer/tezos-indexer:v9.2.3
name: tezos-indexer
args:
- --debug
- --verbosity=1
- --no-contract-balances
- --db=postgresql://localhost/tezos
- --tezos-url={{ .Values.indexers.nomadic.config.rpc_url }}
- image: postgres:alpine
name: postgres
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /docker-entrypoint-initdb.d/
name: schema-volume
- mountPath: /var/lib/postgresql/data
name: indexer-db
envFrom:
- configMapRef:
name: db-creds
volumes:
- emptyDir: {}
name: schema-volume
volumeClaimTemplates:
- metadata:
name: indexer-db
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "5Gi"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: db-creds
data:
POSTGRES_USER: tezos
POSTGRES_PASSWORD: tezosrocks
POSTGRES_DB: tezos
{{- end }}
14 changes: 14 additions & 0 deletions charts/tezos/templates/static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,17 @@ spec:
app: {{ .Values.tzkt_indexer_statefulset.name }}
type: NodePort
{{- end }}
{{- if (include "tezos.shouldDeployNomadicIndexer" .) }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.nomadic_indexer_statefulset.name }}
namespace: {{ .Release.Namespace }}
spec:
ports:
- port: 5000
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this svc is needed. No nomadic container is being exposed. Not sure if a container should be exposed.

selector:
app: {{ .Values.nomadic_indexer_statefulset.name }}
type: NodePort
{{- end }}
10 changes: 10 additions & 0 deletions charts/tezos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ regular_node_statefulset: # charts/tezos/templates/node.yaml
tzkt_indexer_statefulset:
name: tzkt-indexer
storageClassName: ""
nomadic_indexer_statefulset:
name: nomadic-indexer
storageClassName: ""

# For non-public chains the defualt mutez given to an account if the
# account is not explicitly set below.
Expand Down Expand Up @@ -188,6 +191,7 @@ protocols:
# contents in a database for efficient indexing. Most dapps need it.
# Supported indexers:
# * tzkt https://github.com/baking-bad/tzkt
# * nomadic https://gitlab.com/nomadic-labs/tezos-indexer
#
# Templatized indexer configuration values go in the config field.
#
Expand All @@ -207,3 +211,9 @@ protocols:
# db_password: bar
# # api_log_level: Debug
# # indexer_log_level: Debug
#
# nomadic:
# # Configurable nomadic fields
# config:
# # url of the archive node to index
# rpc_url: http://tezos-node-0.tezos-node:8732