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's and BCD tezos indexers #166

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
42a174d
add Nomadic's and BCD tezos indexers
nicolasochem Mar 24, 2021
0e5dbc8
Merge branch 'master' into indexer_new
nicolasochem Mar 25, 2021
9ff649e
restore to upstream version of bcd in anticipation for the release
nicolasochem Mar 25, 2021
7ea5e98
Merge branch 'master' into indexer_new
nicolasochem Mar 25, 2021
c1b17c5
remove dep for now
nicolasochem Mar 25, 2021
3910c59
bump bcdhub version
nicolasochem Mar 25, 2021
8181980
make storage size parametrizable
nicolasochem Mar 25, 2021
c8d25de
Merge branch 'size_param' into indexer_new
nicolasochem Mar 25, 2021
c60057d
hardcode space requirements for indexing mainnet for now
nicolasochem Mar 25, 2021
2e8697e
postgres does not want data folder to be an entire mount point:
nicolasochem Mar 26, 2021
eee2ac1
after last bcd release, it's no longer needed to rebuild
nicolasochem Apr 1, 2021
d243424
Merge branch 'master' into indexer_new
nicolasochem Apr 6, 2021
9ce5ebc
templatize and remove hardcoding
nicolasochem Apr 6, 2021
14e0491
hardcode v9.0-rc1 for edo2
nicolasochem Apr 6, 2021
15d255b
name rpc port
nicolasochem Apr 8, 2021
4053ca5
target node for rpc service
nicolasochem Apr 8, 2021
29a2013
set uid/gid to 1000 to make elastic work on eks
nicolasochem Apr 9, 2021
56989c5
fix rabbit perm issue on eks
nicolasochem Apr 9, 2021
02a4bb3
bump bcd to latest version 3.5.2
nicolasochem Apr 9, 2021
f2723a6
Revert "bump bcd to latest version 3.5.2"
nicolasochem Apr 9, 2021
bd1c8cf
Make serviceName of indexer yamls empty str
harryttd Apr 9, 2021
5643fe3
Don't create statefulsets and headless svc if replicas = 0
harryttd Apr 9, 2021
a0b8984
Merge pull request #2 from tqtezos/indexer-updates
nicolasochem Apr 13, 2021
1dda418
Expose bcd api port
harryttd Apr 20, 2021
d85ebf9
Add bcd metrics container to indexer pod
harryttd Apr 20, 2021
3a7a7b2
Create a shared volume used by some bcd indexer containers
harryttd Apr 20, 2021
fe9b4f8
Remove unused configmap
harryttd Apr 20, 2021
6994b50
Change naming of indexer props in values.yaml
harryttd Apr 20, 2021
cca2e0b
Make default indexer bcd
harryttd Apr 22, 2021
6ef7354
Remove appType label from indexer statefulsets
harryttd Apr 20, 2021
c8420ac
Make rpc service select on appType=tezos-node
harryttd Apr 20, 2021
c38bc06
Add imagePullPolicy=IfNotPresent to some containers
harryttd Apr 22, 2021
02c674e
Update template functions that determine which indexer to deploy
harryttd Apr 22, 2021
2fc5ff8
Add bcd service
harryttd Apr 22, 2021
9d58717
Merge pull request #3 from tqtezos/bcd-indexer-updates
nicolasochem Apr 22, 2021
79019bb
Templatize storageClassName for bcd indexer
harryttd Apr 23, 2021
03f587e
Merge pull request #4 from tqtezos/bcd-storage-class
nicolasochem Apr 23, 2021
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: 1 addition & 1 deletion baker-endorser/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tezos/tezos:v8-release
FROM tezos/tezos:v9.0-rc1
RUN sudo apk add jq bash
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
Expand Down
2 changes: 1 addition & 1 deletion chain-initiator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tezos/tezos:v8-release
FROM tezos/tezos:v9.0-rc1
RUN sudo apk add jq
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
Expand Down
6 changes: 0 additions & 6 deletions charts/tezos/Chart.lock

This file was deleted.

4 changes: 0 additions & 4 deletions charts/tezos/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ keywords:
- tezos
- blockchain
home: https://github.com/tqtezos/tezos-k8s
dependencies:
- name: authenticated-rpc-tezos-chain
repository: file://../rpc-auth
condition: rpc_auth
14 changes: 14 additions & 0 deletions charts/tezos/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,17 @@
{{- "" }}
{{- end }}
{{- end }}

{{/*
Checks if indexer config has an indexer type and target set.
This is to make helm linter happy.
Returns the indexer type or empty string which is falsey.
*/}}
{{- define "tezos.indexer" -}}
{{- $index_config := .Values.index | default dict }}
{{- if $index_config.indexer }}
{{- $index_config.indexer }}
{{- else }}
{{- "" }}
{{- end }}
{{- end }}
129 changes: 129 additions & 0 deletions charts/tezos/templates/bcd_indexer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{{- if eq (include "tezos.indexer" .) "bcd" }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Values.bcd_indexer_statefulset.name }}
namespace: {{ .Release.Namespace }}
spec:
podManagementPolicy: Parallel
selector:
matchLabels:
app: {{ .Values.bcd_indexer_statefulset.name }}
serviceName: {{ .Values.bcd_indexer_statefulset.name }}
template:
metadata:
labels:
app: {{ .Values.bcd_indexer_statefulset.name }}
appType: tezos
spec:
securityContext:
fsGroup: 1000
containers:
- image: bakingbad/bcdhub-api:3.5
name: api
envFrom:
- configMapRef:
name: bcd-env
- configMapRef:
name: db-creds
- image: bakingbad/bcdhub-indexer:3.5
name: indexer
envFrom:
- configMapRef:
name: bcd-env
- image: postgres:alpine
name: db
volumeMounts:
- mountPath: /var/lib/postgresql/
name: indexer-db
envFrom:
- configMapRef:
name: db-creds
- image: rabbitmq:latest
name: mq
volumeMounts:
- mountPath: /var/lib/rabbitmq/mnesia
name: mq-data
env:
- name: RABBITMQ_DEFAULT_USER
value: guest
- name: RABBITMQ_DEFAULT_PASS
value: guest
- image: bakingbad/bcdhub-elastic:3.5
name: elastic
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: esdata
env:
- name: "bootstrap.memory_lock"
value: "true"
- name: "discovery.type"
value: single-node
- name: ES_JAVA_OPTS
value: "-Xms256m -Xmx256m"
volumeClaimTemplates:
- metadata:
name: esdata
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "300Gi"
- metadata:
name: mq-data
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "5Gi"
- metadata:
name: indexer-db
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "300Gi"
---
apiVersion: v1
kind: ConfigMap
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused configmap

metadata:
name: bcd-config
data:
bcd_config.yml: |-
storage:
uri:
- http://localhost:9200
timeout: 10
rabbitmq:
uri: "amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@localhost:5672/"
timeout: 10
db:
conn_string: "host=127.0.0.1 port=5432 user=${POSTGRES_USER} dbname=${POSTGRES_DB} password=${POSTGRES_PASSWORD} sslmode=disable"
timeout: 10
---
apiVersion: v1
kind: ConfigMap
metadata:
name: bcd-env
data:
BCD_ENV: sandbox
GIN_MODE: debug
ELASTIC_HOSTNAME: localhost
RABBITMQ_HOSTNAME: localhost
DB_HOSTNAME: 127.0.0.1
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
SANDBOX_NODE_URI: "http://{{ .Values.index.target }}:8732"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: db-creds
data:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: bcd
{{- 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 eq (include "tezos.indexer" .) "nomadic" }}
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: {{ .Values.nomadic_indexer_statefulset.name }}
template:
metadata:
labels:
app: {{ .Values.nomadic_indexer_statefulset.name }}
appType: tezos
spec:
initContainers:
- image: registry.gitlab.com/nomadic-labs/tezos-indexer/tezos-indexer:v9.1.0
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.1.0
name: tezos-indexer
args:
- --debug
- --verbosity=1
- --no-contract-balances
- --db=postgresql://localhost/tezos
- --tezos-url=http://{{ .Values.index.target }}:8732
- image: postgres:alpine
name: postgres
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 }}
3 changes: 2 additions & 1 deletion charts/tezos/templates/static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ metadata:
spec:
ports:
- port: 8732
name: rpc
selector:
app: tezos-baking-node
app: tezos-node
Copy link
Collaborator

Choose a reason for hiding this comment

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

what happens if there is only a baker in the cluster and no reg nodes?

chain-init needs to look for a baker, not a reg node. Hmmmm, well chain-init is a job and as of now every pod has all of the keys imported on it (for sk's this should change). So it would likely still activate the chain even if there is only a single reg node.

Shouldn't a baker be a more reliable source for RPC?

We should be able to select multiple apps if desired.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just tried on latest commit 02a4bb3 on branch indexer_new, and in minikube. It breaks bec job can't find the activation key.

>>>>1: http://tezos-node-rpc:8732/chains/main/blocks/genesis/protocols
<<<<1: 200 OK
{ "protocol": "PtYuensgYBb3G3x1hLLbCmcav8ue8Kyd2khADcL5LsT5R1hcXex",
"next_protocol": "PtYuensgYBb3G3x1hLLbCmcav8ue8Kyd2khADcL5LsT5R1hcXex" }
Error:
Erroneous command line argument 9 (tqtezos_baker_0).
no secret_key alias named tqtezos_baker_0
cannot read file (Unix.Unix_error(Unix.ENOENT, "open", "tqtezos_baker_0"))
Error while parsing URI: SK_URI needs a scheme

type: NodePort
---
apiVersion: v1
Expand Down
20 changes: 17 additions & 3 deletions charts/tezos/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rpc_auth: false

# Images not part of the tezos-k8s repo go here
images:
tezos: tezos/tezos:v8-release
tezos: tezos/tezos:v9.0-rc1
# Images that are part of the tezos-k8s repo go here with 'dev' tag
tezos_k8s_images:
baker_endorser: tezos-k8s-baker-endorser:dev
Expand All @@ -30,6 +30,10 @@ regular_node_statefulset: # charts/tezos/templates/node.yaml
name: tezos-node
node_type: regular
storage_size: 15Gi
nomadic_indexer_statefulset:
name: nomadic-indexer
bcd_indexer_statefulset:
name: bcd-indexer

# For non-public chains the defualt mutez given to an account if the
# account is not explicitly set below.
Expand Down Expand Up @@ -134,13 +138,13 @@ expected_proof_of_work: 26
# activation_account_name: tqtezos_baker_0
#
# For joining a public network. The network must be recognized by the
# tezos/tezos:v8-release docker image.
# tezos/tezos:v9.0-rc1 docker image.
node_config_network:
chain_name: mainnet

protocol:
# Set the protocol binary. The protocol must be recognized by the
# tezos/tezos:v8-release docker image.
# tezos/tezos:v9.0-rc1 docker image.
command: 008-PtEdo2Zk

# # Activate a new chain from genesis. Note, this is only for when your chain does
Expand Down Expand Up @@ -179,3 +183,13 @@ protocol:
# initial_endorsers: 1
# delay_per_missing_endorsement: "1"
# baking_reward_per_endorsement: ["200000"]
#

# Deploy an indexer with the chain. An indexer puts the chain
# contents in a database for efficient indexing. Most dapps need it.
# Supports two types of indexers:
# * "nomadic": Tezos nomadic indexer: https://gitlab.com/nomadic-labs/tezos-indexer
# * "bcd": Better Call Dev indexer: https://better-call.dev/
#index:
# indexer: nomadic
# target: tezos-baking-node-0.tezos-baking-node
2 changes: 1 addition & 1 deletion config-generator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tezos/tezos:v8-release
FROM tezos/tezos:v9.0-rc1
ENV PYTHONUNBUFFERED=1

# Note: we install build deps for pip, then remove everything after pip install.
Expand Down
1 change: 1 addition & 0 deletions config-generator/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
# If there are no genesis params, this is a public chain.
THIS_IS_A_PUBLIC_NET = True if not NETWORK_CONFIG.get("genesis") else False


def main():
all_accounts = ACCOUNTS

Expand Down
2 changes: 1 addition & 1 deletion mkchain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ You can explicitly specify some values by:
| | --number-of-nodes | Number of non-baking nodes in the cluster | 0 |
| bootstrap_peers | --bootstrap-peers | Peer ips to connect to | [] |
| expected_proof_of_work | --expected-proof-of-work | Node identity generation difficulty | 0 |
| images.tezos | --tezos-docker-image | Version of the Tezos docker image to run | tezos/tezos:v8-release |
| images.tezos | --tezos-docker-image | Version of the Tezos docker image to run | tezos/tezos:v9.0-rc1 |
| rpc_auth | --rpc-auth | Whether or not an [RPC auth](../rpc-auth/README.md) backend will be spun up | False |
| zerotier_config.zerotier_network | --zerotier-network | Zerotier network id for external chain access | |
| zerotier_config.zerotier_token | --zerotier-token | Zerotier token for external chain access | |
Expand Down
2 changes: 1 addition & 1 deletion mkchain/tqchain/mkchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def get_genesis_vanity_chain_id(docker_image, seed_len=16):
},
"tezos_docker_image": {
"help": "Version of the Tezos docker image",
"default": "tezos/tezos:v8-release",
"default": "tezos/tezos:v9.0-rc1",
},
"rpc_auth": {
"help": "Should spin up an RPC authentication server",
Expand Down
2 changes: 1 addition & 1 deletion rpc-auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ helm upgrade $CHAIN_NAME tqtezos/tezos-chain \

5. Client can then make RPC requests:
- `curl http://192.168.64.51/tezos-node-rpc/ffff3eb3d7dd4f6bbff3f2fd096722ae/chains/main/chain_id`
- As of docker image `tezos/tezos:v8-release`:
- As of docker image `tezos/tezos:v9.0-rc1`:
```shell
tezos-client --endpoint http://192.168.64.51/tezos-node-rpc/ffff3eb3d7dd4f6bbff3f2fd096722ae/ rpc get chains/main/chain_id
```
2 changes: 1 addition & 1 deletion snapshot-downloader/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tezos/tezos:v8-release
FROM tezos/tezos:v9.0-rc1
RUN sudo apk add curl lz4 xz jq
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
Expand Down
2 changes: 1 addition & 1 deletion wait-for-bootstrap/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tezos/tezos:v8-release
FROM tezos/tezos:v9.0-rc1
RUN sudo apk add jq netcat-openbsd
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
Expand Down