diff --git a/.github/workflows/update-index.yaml b/.github/workflows/update-index.yaml new file mode 100644 index 0000000..750cab6 --- /dev/null +++ b/.github/workflows/update-index.yaml @@ -0,0 +1,27 @@ +name: Release Charts + +on: + push: + branches: + - main + +jobs: + release: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.6.0 + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..58c8ea6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Ignore macOS system files +.DS_Store \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3a4ad1b --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# Nodeify Helm Charts + +This repository contains Helm charts for Nodeify's tools and services. + +## Available Charts + +- indexer-tools - Tools for blockchain indexing + +## Usage + +```bash +helm repo add nodeify https://nodeify-eth.github.io/helm-charts +helm repo update +helm install indexer-tools nodeify/indexer-tools \ No newline at end of file diff --git a/charts/cosmoshub/Chart.yaml b/charts/cosmoshub/Chart.yaml new file mode 100644 index 0000000..3d54a34 --- /dev/null +++ b/charts/cosmoshub/Chart.yaml @@ -0,0 +1,16 @@ +apiVersion: v2 +name: cosmoshub-rpc +description: A Helm chart for deploying a Cosmoshub node +type: application +version: 1.0.0 +appVersion: v21.0.0 +maintainers: + - name: vince + email: vince@nodeify.net +keywords: + - cosmoshub + - blockchain + - rpc +home: https://nodeify.net +sources: + - https://github.com/cosmos/gaia diff --git a/charts/cosmoshub/README.md b/charts/cosmoshub/README.md new file mode 100644 index 0000000..13891eb --- /dev/null +++ b/charts/cosmoshub/README.md @@ -0,0 +1,63 @@ +# cosmoshub + +![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v21.0.0](https://img.shields.io/badge/AppVersion-v21.0.0-informational?style=flat-square) + +A Helm chart for deploying a Cosmoshub node + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| vince | | | + +## Source Code + +* + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| flags | string | `nil` | | +| fullnameOverride | string | `""` | | +| image.hash | string | `"2998c7af42d7f2f86c0d78cc6b9ffc13d36fb64de8129c5bc6cddec0eaebb889"` | | +| image.name | string | `"ghcr.io/cosmos/gaia"` | | +| image.tag | string | `"v21.0.0"` | | +| imagePullSecrets | list | `[]` | | +| ingress.annotations | object | `{}` | | +| ingress.className | string | `""` | | +| ingress.enabled | bool | `false` | | +| ingress.hosts[0].host | string | `"chart-example.local"` | | +| ingress.hosts[0].paths[0].path | string | `"/"` | | +| ingress.hosts[0].paths[0].pathType | string | `"Prefix"` | | +| ingress.hosts[0].paths[0].servicePort | string | `"rpc"` | | +| ingress.tls | list | `[]` | | +| nameOverride | string | `""` | | +| net | string | `"mainnet"` | | +| nodeSelector | object | `{}` | | +| persistence.accessMode | string | `"ReadWriteOnce"` | | +| persistence.enabled | bool | `true` | | +| persistence.size | string | `"250Gi"` | | +| persistence.storageClass | string | `"-"` | | +| podAnnotations | object | `{}` | | +| podSecurityContext.fsGroup | int | `1000` | | +| pvc.annotations | object | `{}` | | +| replicaCount | int | `1` | | +| resources.limits.memory | string | `"48Gi"` | | +| resources.requests.cpu | int | `4` | | +| resources.requests.memory | string | `"16Gi"` | | +| securityContext | object | `{}` | | +| service.annotations | object | `{}` | | +| service.port.grpc | int | `9090` | | +| service.port.p2p | int | `26656` | | +| service.port.rpc | int | `26657` | | +| service.type | string | `"ClusterIP"` | | +| snapshot.enabled | bool | `true` | | +| snapshot.url | string | `"$(curl -s https://polkachu.com/api/v2/chain_snapshots/cosmos/mainnet | jq -r .snapshot.url)"` | | +| tolerations | list | `[]` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/charts/cosmoshub/templates/_helpers.tpl b/charts/cosmoshub/templates/_helpers.tpl new file mode 100644 index 0000000..8414f3d --- /dev/null +++ b/charts/cosmoshub/templates/_helpers.tpl @@ -0,0 +1,71 @@ +# templates/_helpers.tpl +{{/* +Expand the name of the chart. +*/}} +{{- define "cosmoshub.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +*/}} +{{- define "cosmoshub.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "cosmoshub.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "cosmoshub.labels" -}} +helm.sh/chart: {{ include "cosmoshub.chart" . }} +{{ include "cosmoshub.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "cosmoshub.selectorLabels" -}} +app.kubernetes.io/name: {{ include "cosmoshub.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Define RPC port +*/}} +{{- define "cosmoshub.rpc" -}} +{{- .Values.service.port.rpc }} +{{- end }} + +{{/* +Define P2P port +*/}} +{{- define "cosmoshub.p2p" -}} +{{- .Values.service.port.p2p }} +{{- end }} + +{{/* +Define GRPC port +*/}} +{{- define "cosmoshub.grpc" -}} +{{- .Values.service.port.grpc }} +{{- end }} \ No newline at end of file diff --git a/charts/cosmoshub/templates/configmap.yaml b/charts/cosmoshub/templates/configmap.yaml new file mode 100644 index 0000000..3603761 --- /dev/null +++ b/charts/cosmoshub/templates/configmap.yaml @@ -0,0 +1,76 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "cosmoshub.fullname" . }}-scripts + labels: + {{- include "cosmoshub.labels" . | nindent 4 }} +data: + probe.sh: | + #!/bin/sh + set -euo pipefail + + FILE=/root/.gaia/.probe_last_height + STATUS=$(curl -s --fail -m 20 http://localhost:26657/status) || { echo "Curl failed"; exit 1; } + + CATCHING_UP=$(echo "$STATUS" | jq -r '.result.sync_info.catching_up') + CURRENT_HEIGHT=$(echo "$STATUS" | jq -r '.result.sync_info.latest_block_height') + + if [ ! -f "$FILE" ]; then + echo "First run, writing height: $CURRENT_HEIGHT" + echo "$CURRENT_HEIGHT" > "$FILE" + exit 1 + fi + + LAST_HEIGHT=$(cat "$FILE") + echo "Previous height: $LAST_HEIGHT, Current height: $CURRENT_HEIGHT" + + if [ "$CURRENT_HEIGHT" -le "$LAST_HEIGHT" ]; then + echo "Block height not increasing" + exit 1 + fi + + if [ "$CATCHING_UP" = "true" ]; then + echo "Node still catching up" + echo "$CURRENT_HEIGHT" > "$FILE" + exit 1 + fi + + echo "Node is synced and progressing" + echo "$CURRENT_HEIGHT" > "$FILE" + exit 0 + + init.sh: | + #!/bin/sh + + set -euo pipefail + + mkdir -p /root/.gaia/config /root/.gaia/data + + {{- if eq .Values.net "testnet" }} + GENESIS_URL="https://snapshots.polkachu.com/testnet-genesis/cosmos/genesis.json" + ADDRBOOK_URL="https://snapshots.polkachu.com/testnet-addrbook/cosmos/addrbook.json" + {{- else }} + GENESIS_URL="https://snapshots.polkachu.com/genesis/cosmos/genesis.json" + ADDRBOOK_URL="https://snapshots.polkachu.com/addrbook/cosmos/addrbook.json" + {{- end }} + + # Pull genesis if not present + [ -f "/root/.gaia/config/genesis.json" ] || wget -O /root/.gaia/config/genesis.json $GENESIS_URL + + # Update addrbook + wget -O /root/.gaia/config/addrbook.json $ADDRBOOK_URL || true + + # Exit if data exists + [ -f "/root/.gaia/data/priv_validator_state.json" ] && { rm -f /root/.gaia/*.lz4; exit 0; } + + {{- if .Values.snapshot.enabled }} + # Install required packages + apk add --no-cache aria2 lz4 curl jq + + # Download and extract snapshot + cd /root/.gaia + eval "SNAPSHOT_URL={{ .Values.snapshot.url }}" + aria2c -c -x10 "$SNAPSHOT_URL" + lz4 -c -d "$(basename "$SNAPSHOT_URL")" | tar xf - + rm -f *.lz4 + {{- end }} \ No newline at end of file diff --git a/charts/cosmoshub/templates/deployment.yaml b/charts/cosmoshub/templates/deployment.yaml new file mode 100644 index 0000000..93ed647 --- /dev/null +++ b/charts/cosmoshub/templates/deployment.yaml @@ -0,0 +1,139 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "cosmoshub.fullname" . }} + labels: + {{- include "cosmoshub.labels" . | nindent 4 }} + annotations: + checksum/configmap: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} +spec: + replicas: {{ .Values.replicaCount }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "cosmoshub.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "cosmoshub.selectorLabels" . | nindent 8 }} + annotations: + {{- if .Values.podAnnotations }} + {{- toYaml .Values.podAnnotations | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "cosmoshub.fullname" . }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + runAsUser: 0 + runAsGroup: 0 + fsGroup: 0 + terminationGracePeriodSeconds: 60 + initContainers: + - name: init + image: "alpine:latest" + imagePullPolicy: IfNotPresent + command: + - /scripts/init.sh + volumeMounts: + - name: scripts + mountPath: /scripts + readOnly: true + - name: data + mountPath: /root/.gaia + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 500m + memory: 256Mi + containers: + - name: {{ .Chart.Name }} + securityContext: + runAsUser: 0 + runAsGroup: 0 + image: "{{ .Values.image.name }}:{{ .Values.image.tag }}@sha256:{{ .Values.image.hash }}" + imagePullPolicy: IfNotPresent + command: + - gaiad + - start + - --minimum-gas-prices=0.001uatom + - --grpc.address=0.0.0.0:9090 + - --log_format=json + - --rpc.laddr=tcp://0.0.0.0:26657 + {{- range $flag := .Values.flags }} + - {{ $flag }} + {{- end }} + lifecycle: + postStart: + exec: + command: + - /bin/sh + - -c + - "apk add --no-cache curl" + volumeMounts: + - name: data + mountPath: /root/.gaia + - name: scripts + mountPath: /scripts + readOnly: true + ports: + - name: lcd + containerPort: 1317 + - name: rpc + containerPort: {{ include "cosmoshub.rpc" . }} + protocol: TCP + - name: p2p + containerPort: {{ include "cosmoshub.p2p" . }} + protocol: TCP + - name: grpc + containerPort: {{ include "cosmoshub.grpc" . }} + protocol: TCP + startupProbe: + failureThreshold: 600 + periodSeconds: 30 + timeoutSeconds: 10 + exec: + command: + - /scripts/probe.sh + livenessProbe: + timeoutSeconds: 10 + periodSeconds: 30 + exec: + command: + - /scripts/probe.sh + readinessProbe: + timeoutSeconds: 10 + httpGet: + path: /status + port: rpc + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: scripts + configMap: + name: {{ include "cosmoshub.fullname" . }}-scripts + defaultMode: 0777 + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "cosmoshub.fullname" . }} + {{- else }} + emptyDir: {} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} \ No newline at end of file diff --git a/charts/cosmoshub/templates/ingress.yaml b/charts/cosmoshub/templates/ingress.yaml new file mode 100644 index 0000000..44becf5 --- /dev/null +++ b/charts/cosmoshub/templates/ingress.yaml @@ -0,0 +1,42 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "cosmoshub.fullname" . -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "cosmoshub.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + pathType: {{ .pathType | default "Prefix" }} + backend: + service: + name: {{ $fullName }} + port: + name: {{ .servicePort }} + {{- end }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/cosmoshub/templates/pvc.yaml b/charts/cosmoshub/templates/pvc.yaml new file mode 100644 index 0000000..9e0b45a --- /dev/null +++ b/charts/cosmoshub/templates/pvc.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "cosmoshub.fullname" . }} + labels: + {{- include "cosmoshub.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.pvc.annotations | nindent 4 }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | default "ReadWriteOnce" }} + resources: + requests: + storage: {{ .Values.persistence.size | default "100Gi" }} + {{- if .Values.persistence.storageClass }} + storageClassName: "{{ .Values.persistence.storageClass }}" + {{- end }} \ No newline at end of file diff --git a/charts/cosmoshub/templates/service.yaml b/charts/cosmoshub/templates/service.yaml new file mode 100644 index 0000000..426d405 --- /dev/null +++ b/charts/cosmoshub/templates/service.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "cosmoshub.fullname" . }} + labels: + {{- include "cosmoshub.labels" . | nindent 4 }} + {{- if .Values.service.annotations }} + annotations: + {{- toYaml .Values.service.annotations | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port.p2p }} + targetPort: p2p + protocol: TCP + name: p2p + - port: {{ .Values.service.port.rpc }} + targetPort: rpc + protocol: TCP + name: rpc + - port: {{ .Values.service.port.grpc }} + targetPort: grpc + protocol: TCP + name: grpc + selector: + {{- include "cosmoshub.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/cosmoshub/templates/serviceaccount.yaml b/charts/cosmoshub/templates/serviceaccount.yaml new file mode 100644 index 0000000..6a61d44 --- /dev/null +++ b/charts/cosmoshub/templates/serviceaccount.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "cosmoshub.fullname" . }} + labels: + {{- include "cosmoshub.labels" . | nindent 4 }} + annotations: + kubernetes.io/enforce-mountable-secrets: "true" \ No newline at end of file diff --git a/charts/cosmoshub/values.yaml b/charts/cosmoshub/values.yaml new file mode 100644 index 0000000..fcc39fd --- /dev/null +++ b/charts/cosmoshub/values.yaml @@ -0,0 +1,79 @@ +net: mainnet # mainnet or testnet + +replicaCount: 1 + +snapshot: + enabled: true + url: "$(curl -s https://polkachu.com/api/v2/chain_snapshots/cosmos/mainnet | jq -r .snapshot.url)" + +image: + name: ghcr.io/cosmos/gaia + tag: v21.0.0 + hash: 2998c7af42d7f2f86c0d78cc6b9ffc13d36fb64de8129c5bc6cddec0eaebb889 + +flags: +# - --p2p.persistent_peers=648742a99b2714a442506bd5dbefe74c40346fbd@18.225.13.106:26656,... + + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +podAnnotations: {} + +podSecurityContext: + fsGroup: 1000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + annotations: {} + port: + p2p: 26656 + rpc: 26657 + grpc: 9090 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: Prefix + servicePort: rpc + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +persistence: + enabled: true + size: "250Gi" + accessMode: ReadWriteOnce + storageClass: "-" # set to "-" to use default storageClass +pvc: + annotations: {} + +resources: + requests: + cpu: 4 + memory: 16Gi + limits: + memory: 48Gi + +nodeSelector: {} + +tolerations: [] + +affinity: {} \ No newline at end of file diff --git a/charts/indexer-tools/.helmignore b/charts/indexer-tools/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/indexer-tools/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/indexer-tools/Chart.yaml b/charts/indexer-tools/Chart.yaml new file mode 100644 index 0000000..9420221 --- /dev/null +++ b/charts/indexer-tools/Chart.yaml @@ -0,0 +1,16 @@ +apiVersion: v2 +name: indexer-tools +description: A Helm chart for Indexer Tools frontend application +type: application +version: 1.0.0 +appVersion: "v3.4.0-beta5" +maintainers: + - name: vince + email: vince@nodeify.net +keywords: + - graph + - blockchain + - indexer +home: https://nodeify.net +sources: + - https://indexer-tools.vincenttaglia.com/ diff --git a/charts/indexer-tools/README.md b/charts/indexer-tools/README.md new file mode 100644 index 0000000..21f191a --- /dev/null +++ b/charts/indexer-tools/README.md @@ -0,0 +1,67 @@ +# indexer-tools + +![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v3.4.0-beta5](https://img.shields.io/badge/AppVersion-v3.4.0--beta5-informational?style=flat-square) + +A Helm chart for Indexer Tools frontend application + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| env.variables[0].name | string | `"AGENT_SERVICE"` | | +| env.variables[0].value | string | `"http://indexer-graph-network-indexer-agent:8000"` | | +| env.variables[1].name | string | `"GRAPH_API_KEY"` | | +| env.variables[1].value | string | `""` | | +| env.variables[2].name | string | `"DEFAULT_ACCOUNTS"` | | +| env.variables[2].value | string | `"[ { \"address\": \"0x550c1f4814a85aa10f5f061ca8c45e2ee9620226\", \"name\": \"exerimental\", \"active\": true, \"chain\": \"arbitrum-one\", \"agentConnect\": true, \"agentEndpoint\": \"/agent\", \"poiQuery\": false, \"poiQueryEndpoint\": \"\" } ]"` | | +| env.variables[3].name | string | `"DEFAULT_QOS_SUBGRAPH"` | | +| env.variables[3].value | string | `"https://gateway.thegraph.com/api/[api-key]/subgraphs/id/Dtr9rETvwokot4BSXaD5tECanXfqfJKcvHuaaEgPDD2D"` | | +| env.variables[4].name | string | `"DEFAULT_SUBGRAPH_MAINNET"` | | +| env.variables[4].value | string | `"https://gateway.thegraph.com/api/[api-key]/subgraphs/id/9Co7EQe5PgW3ugCUJrJgRv4u9zdEuDJf8NvMWftNsBH8"` | | +| env.variables[5].name | string | `"DEFAULT_SUBGRAPH_ARBITRUM"` | | +| env.variables[5].value | string | `"https://gateway.thegraph.com/api/[api-key]/subgraphs/id/DZz4kDTdmzWLWsV373w2bSmoar3umKKH9y82SUKr5qmp"` | | +| env.variables[6].name | string | `"DEFAULT_SUBGRAPH_SEPOLIA"` | | +| env.variables[6].value | string | `"https://gateway.thegraph.com/api/[api-key]/subgraphs/id/8pVKDwHniAz87CHEQsiz2wgFXGZXrbMDkrxgauVVfMJC"` | | +| env.variables[7].name | string | `"DEFAULT_SUBGRAPH_ARBITRUM_SEPOLIA"` | | +| env.variables[7].value | string | `"https://gateway.thegraph.com/api/[api-key]/subgraphs/id/3xQHhMudr1oh69ut36G2mbzpYmYxwqCeU6wwqyCDCnqV"` | | +| env.variables[8].name | string | `"DEFAULT_RPC_MAINNET"` | | +| env.variables[8].value | string | `"https://eth-mainnet.g.alchemy.com/v2/iwAYPKEO-K7EaRzaIoHUsIoCbiMfir_Y"` | | +| env.variables[9].name | string | `"DEFAULT_RPC_ARBITRUM"` | | +| env.variables[9].value | string | `"https://arb-mainnet.g.alchemy.com/v2/er8LBcXpoFwlV8xJee-WXFbFG_M8L4JK"` | | +| fullnameOverride | string | `""` | | +| healthCheck.livenessProbe.failureThreshold | int | `3` | | +| healthCheck.livenessProbe.initialDelaySeconds | int | `30` | | +| healthCheck.livenessProbe.periodSeconds | int | `10` | | +| healthCheck.livenessProbe.tcpSocket.port | int | `3000` | | +| healthCheck.livenessProbe.timeoutSeconds | int | `5` | | +| healthCheck.readinessProbe.failureThreshold | int | `3` | | +| healthCheck.readinessProbe.initialDelaySeconds | int | `10` | | +| healthCheck.readinessProbe.periodSeconds | int | `10` | | +| healthCheck.readinessProbe.tcpSocket.port | int | `3000` | | +| healthCheck.readinessProbe.timeoutSeconds | int | `5` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"ghcr.io/vincenttaglia/indexer-tools"` | | +| image.tag | string | `"v3.4.0-beta5"` | | +| imagePullSecrets | list | `[]` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podSecurityContext | object | `{}` | | +| replicaCount | int | `1` | | +| resources.limits.cpu | string | `"500m"` | | +| resources.limits.memory | string | `"512Mi"` | | +| resources.requests.cpu | string | `"100m"` | | +| resources.requests.memory | string | `"128Mi"` | | +| securityContext.capabilities.drop[0] | string | `"ALL"` | | +| securityContext.runAsNonRoot | bool | `true` | | +| securityContext.runAsUser | int | `1000` | | +| service.port | int | `3000` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | +| tolerations | list | `[]` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/charts/indexer-tools/templates/_helpers.tpl b/charts/indexer-tools/templates/_helpers.tpl new file mode 100644 index 0000000..d7eb284 --- /dev/null +++ b/charts/indexer-tools/templates/_helpers.tpl @@ -0,0 +1,37 @@ +# templates/_helpers.tpl +{{- define "indexer-tools.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{- define "indexer-tools.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{- define "indexer-tools.labels" -}} +helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} +app.kubernetes.io/name: {{ include "indexer-tools.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{- define "indexer-tools.selectorLabels" -}} +app.kubernetes.io/name: {{ include "indexer-tools.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{- define "indexer-tools.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "indexer-tools.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/indexer-tools/templates/configmap.yaml b/charts/indexer-tools/templates/configmap.yaml new file mode 100644 index 0000000..b1ba8f3 --- /dev/null +++ b/charts/indexer-tools/templates/configmap.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "indexer-tools.fullname" . }}-server + labels: {{- include "indexer-tools.labels" . | nindent 4 }} +data: + server.js: | + const express = require('express'); + const history = require('connect-history-api-fallback'); + const serveStatic = require('serve-static'); + const { createProxyMiddleware } = require('http-proxy-middleware'); + const path = require('path'); + + const app = express(); + + app.use('/agent', createProxyMiddleware({ + target: process.env.AGENT_SERVICE, + changeOrigin: true, + pathRewrite: { + '^/agent': '/' + }, + onProxyRes: (proxyRes, req, res) => { + proxyRes.headers['Access-Control-Allow-Origin'] = '*'; + } + })); + + app.use(history()); + app.use(serveStatic(path.join(__dirname, 'dist'))); + + const port = process.env.PORT || 3000; + app.listen(port); \ No newline at end of file diff --git a/charts/indexer-tools/templates/deployment.yaml b/charts/indexer-tools/templates/deployment.yaml new file mode 100644 index 0000000..88553f2 --- /dev/null +++ b/charts/indexer-tools/templates/deployment.yaml @@ -0,0 +1,84 @@ +# templates/deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "indexer-tools.fullname" . }} + labels: {{- include "indexer-tools.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: {{- include "indexer-tools.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: {{- include "indexer-tools.selectorLabels" . | nindent 8 }} + {{- with .Values.podAnnotations }} + annotations: {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "indexer-tools.serviceAccountName" . }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + initContainers: + - name: install-deps + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: + - /bin/sh + - -c + - | + cd /app && yarn add http-proxy-middleware + volumeMounts: + - name: node-modules + mountPath: /app/node_modules + - name: build + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: ["yarn", "build"] + volumeMounts: + - name: dist-volume + mountPath: /app/dist + - name: node-modules + mountPath: /app/node_modules + containers: + - name: {{ .Chart.Name }} + securityContext: {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + {{- if .Values.env.variables }} + env: + {{- range .Values.env.variables }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + {{- end }} + volumeMounts: + - name: tmp-volume + mountPath: /tmp + - name: app-volume + mountPath: /app/public + - name: dist-volume + mountPath: /app/dist + - name: node-modules + mountPath: /app/node_modules + - name: server-config + mountPath: /app/server.js + subPath: server.js + resources: {{- toYaml .Values.resources | nindent 12 }} + livenessProbe: {{- toYaml .Values.healthCheck.livenessProbe | nindent 12 }} + readinessProbe: {{- toYaml .Values.healthCheck.readinessProbe | nindent 12 }} + volumes: + - name: tmp-volume + emptyDir: {} + - name: app-volume + emptyDir: {} + - name: dist-volume + emptyDir: {} + - name: node-modules + emptyDir: {} + - name: server-config + configMap: + name: {{ include "indexer-tools.fullname" . }}-server \ No newline at end of file diff --git a/charts/indexer-tools/templates/service.yaml b/charts/indexer-tools/templates/service.yaml new file mode 100644 index 0000000..b4a4ce8 --- /dev/null +++ b/charts/indexer-tools/templates/service.yaml @@ -0,0 +1,14 @@ +# templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: {{ include "indexer-tools.fullname" . }} + labels: {{- include "indexer-tools.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: {{- include "indexer-tools.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/indexer-tools/templates/serviceaccount.yaml b/charts/indexer-tools/templates/serviceaccount.yaml new file mode 100644 index 0000000..8448cec --- /dev/null +++ b/charts/indexer-tools/templates/serviceaccount.yaml @@ -0,0 +1,11 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "indexer-tools.serviceAccountName" . }} + labels: {{- include "indexer-tools.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: true +{{- end }} \ No newline at end of file diff --git a/charts/indexer-tools/values.yaml b/charts/indexer-tools/values.yaml new file mode 100644 index 0000000..c63cc38 --- /dev/null +++ b/charts/indexer-tools/values.yaml @@ -0,0 +1,82 @@ +# values.yaml +replicaCount: 1 + +nameOverride: "" +fullnameOverride: "" + +image: + repository: ghcr.io/vincenttaglia/indexer-tools + tag: "v3.4.0-beta5" + pullPolicy: IfNotPresent + +imagePullSecrets: [] + +serviceAccount: + create: true + annotations: {} + name: "" + +env: + variables: + - name: AGENT_SERVICE + value: "http://indexer-graph-network-indexer-agent:8000" + - name: GRAPH_API_KEY + value: "" # Will override the [api-key] default value below + - name: DEFAULT_ACCOUNTS + value: '[ { "address": "0x.............", "name": "my-indexer-name", "active": true, "chain": "arbitrum-one", "agentConnect": true, "agentEndpoint": "/agent", "poiQuery": false, "poiQueryEndpoint": "" } ]' + - name: DEFAULT_QOS_SUBGRAPH + value: "https://gateway.thegraph.com/api/[api-key]/subgraphs/id/Dtr9rETvwokot4BSXaD5tECanXfqfJKcvHuaaEgPDD2D" + - name: DEFAULT_SUBGRAPH_MAINNET + value: "https://gateway.thegraph.com/api/[api-key]/subgraphs/id/9Co7EQe5PgW3ugCUJrJgRv4u9zdEuDJf8NvMWftNsBH8" + - name: DEFAULT_SUBGRAPH_ARBITRUM + value: "https://gateway.thegraph.com/api/[api-key]/subgraphs/id/DZz4kDTdmzWLWsV373w2bSmoar3umKKH9y82SUKr5qmp" + - name: DEFAULT_SUBGRAPH_SEPOLIA + value: "https://gateway.thegraph.com/api/[api-key]/subgraphs/id/8pVKDwHniAz87CHEQsiz2wgFXGZXrbMDkrxgauVVfMJC" + - name: DEFAULT_SUBGRAPH_ARBITRUM_SEPOLIA + value: "https://gateway.thegraph.com/api/[api-key]/subgraphs/id/3xQHhMudr1oh69ut36G2mbzpYmYxwqCeU6wwqyCDCnqV" + - name: DEFAULT_RPC_MAINNET + value: "https://eth-mainnet.g.alchemy.com/v2/iwAYPKEO-K7EaRzaIoHUsIoCbiMfir_Y" + - name: DEFAULT_RPC_ARBITRUM + value: "https://arb-mainnet.g.alchemy.com/v2/er8LBcXpoFwlV8xJee-WXFbFG_M8L4JK" + +podAnnotations: {} +podSecurityContext: {} + +securityContext: + capabilities: + drop: + - ALL + runAsNonRoot: true + runAsUser: 1000 + +service: + type: ClusterIP + port: 3000 + +resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 100m + memory: 128Mi + +healthCheck: + livenessProbe: + tcpSocket: + port: 3000 + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + readinessProbe: + tcpSocket: + port: 3000 + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + +nodeSelector: {} +tolerations: [] +affinity: {}