helm部署graph-node服务

发布于:2025-08-06 ⋅ 阅读:(19) ⋅ 点赞:(0)

还得先部署postgresql

-- 创建一个名为 my_app_user 的用户,并设置密码
CREATE USER my_app_user WITH PASSWORD 'your_secure_password';

-- 授予 my_app_user 连接到 my_application_db 的权限
GRANT CONNECT ON DATABASE my_application_db TO my_app_user;

-- 授予 my_app_user 在 my_application_db 数据库中创建表、索引等的权限
-- 你需要连接到 my_application_db 才能执行此步骤
\c my_application_db; -- 切换到你的新数据库

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO my_app_user;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO my_app_user;
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO my_app_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO my_app_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO my_app_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON FUNCTIONS TO my_app_user;

\c my_application_db;

-- 创建 uuid-ossp 扩展(用于生成 UUID)
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

-- 创建 pg_trgm 扩展(用于模糊匹配和全文搜索)
CREATE EXTENSION IF NOT EXISTS pg_trgm;

1、加载helm仓库

helm repo add stakewise https://charts.stakewise.io

2、安装graph-node

helm install my-graph-node stakewise/graph-node --version 3.0.3

3、导出value.yaml,然后自定义value.yaml

helm show values stakewise/graph-node > values.yaml

4、自定义values.yaml

# Default values for graph-node.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

global:
  serviceAccount:
    create: true

replicaCount: 1

image:
  # -- Image for Graph Node
  registry: "docker.io"
  repository: graphprotocol/graph-node
  pullPolicy: IfNotPresent
  # -- Overrides the image tag
  # @default -- Chart.appVersion
  tag: ""

# -- Pull secrets required to fetch the Image
imagePullSecrets: []

nameOverride: ""
fullnameOverride: ""

## -- Graph Node
##
graph:
  # -- PostgreSQL configuration
  postgresql:
    host: "parasail-graph-node-postgresql"
    port: "5432"
    database: "subgraph-dev"
    username: "graphnode"
    password: "XXXXXXXXXXX"
    poolSize: "30"

  # -- Blockchain configuration for Graph Node
  chains:
    # -- Ethereum Mainnet
   # mainnet:
    fluence_test_net:   
      # -- Enable this configuring graph-node with this chain
    #  enabled: false
      enabled: true
      # -- The database shard to use for this chain
      shard: primary
      ## -- A list of JSON-RPC endpoints for this node
      provider:
        - # -- Label for the RPC endpoint
          #label: eth-mainnet
          label: fluence-testnet-rpc
          # -- URL for JSON-RPC endpoint
          url: "https://rpc.testnet.fluence.dev"
          # -- Data capabilities this node has
          features: [archive, traces]

  ipfsUrl: ""

  # -- Deployment rule configuration
  deployment:
    rule:
      - shard: primary
        indexers: "{{ include 'graph-node.indexersList' . }}"

  # -- [Configuration for graph-node](https://github.com/graphprotocol/graph-node/blob/master/docs/config.md)
  # @default -- See default template in [values.yaml](values.yaml)
  configTemplate: |
    # Store configuration
    [store]
      [store.primary]
      connection = "postgresql://{{ $.Values.graph.postgresql.username }}:{{ $.Values.graph.postgresql.password }}@{{ $.Values.graph.postgresql.host }}:{{ $.Values.graph.postgresql.port }}/{{ $.Values.graph.postgresql.database }}"
      pool_size = {{ $.Values.graph.postgresql.poolSize }}
      weight = 1
    # Chain configuration
    {{- $patchedChains := dict "ingestor" (print (include "common.names.fullname" $) "-0" ) }}
    {{- range $chainName, $chainValues := $.Values.graph.chains }}
    {{- if $chainValues.enabled }}
      {{- $_ := set $patchedChains $chainName (omit $chainValues "enabled") }}
    {{- end }}
    {{- end }}
    {{ toToml (dict "chains" $patchedChains) }}
    # Deployment rule configuration
    [deployment]
    [[deployment.rule]]
    indexers = [ {{ include "graph-node.indexersList" . }} ]
    shard = "primary"

  # -- Additional CLI arguments to pass to Graph Node
  extraArgs: []

  # -- Additional container environment variables.
  env:
    # How often to poll Ethereum for new blocks (in ms)
    ETHEREUM_POLLING_INTERVAL: "500"
    # "instant" or "synced". Synced will only switch a named subgraph to a new deployment once it has synced,
    # making the new deployment the "Pending" version
    EXPERIMENTAL_SUBGRAPH_VERSION_SWITCHING_MODE: "synced"
    # Number of Ethereum blocks to request in parallel.
    # Also limits other parallel requests such such as trace_filter
    ETHEREUM_BLOCK_BATCH_SIZE: "50"
    # Maximum number of blocks to scan for triggers in each request
    GRAPH_ETHEREUM_MAX_BLOCK_RANGE_SIZE: "1000"
    # How many simultaneous connections to allow to the store.
    # Due to implementation details, this value may not be strictly adhered to
    STORE_CONNECTION_POOL_SIZE: "25"
    GRAPH_ALLOW_NON_DETERMINISTIC_IPFS: true
    GRAPH_MAX_IPFS_FILE_BYTES: "1048576"
    # Control log levels
    # Options: debug, error, info, warn, or trace
    GRAPH_LOG: "info"
    GRAPH_GRAPHQL_DISABLE_BOOL_FILTERS: "false"
    # Timeout for IPFS, which includes requests for manifest files and from mappings
    GRAPH_IPFS_TIMEOUT: "300"

serviceAccount:
  # -- Specifies whether a service account should be created
  create: true
  # -- Annotations to add to the service account
  annotations: {}
  # -- The name of the service account to use.
  # If not set and create is true, a name is generated using the fullname template
  name: ""

service:
  #type: ClusterIP
  type: NodePort 
  ports:
    # Port for the GraphQL HTTP server
    http: 8000
    # Port for the GraphQL WebSocket server
    websocket: 8001
    # Port for the JSON-RPC admin server
    jsonrpc: 8020
    # Port for index status
    indexStatus: 8030
    # Port for Prometheus Exporter
    metrics: 8040

ingress:
  enabled: true
  className: alb
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: instance
    alb.ingress.kubernetes.io/load-balancer-name: graph-node-test 
    alb.ingress.kubernetes.io/certificate-arn: ""
    alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-TLS-1-2-2017-01
    alb.ingress.kubernetes.io/healthcheck-path: "/"
    alb.ingress.kubernetes.io/success-codes: "200"
    alb.ingress.kubernetes.io/ssl-redirect: '443'
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP":80},{"HTTPS":443}]'
    alb.ingress.kubernetes.io/tags: user:product=parasail,user:product_service=graph-node-parasail   
  hosts:
    - host: graph-node-test.parasail.network
      paths:
        - path: /
          pathType: ImplementationSpecific
  tls: []
  #  - secretName: chart-example-tls
  #    hosts:
  #      - chart-example.local

## -- Configure resource requests and limits.
## http://kubernetes.io/docs/user-guide/compute-resources/
##
resources: {}

## -- Node labels for pod assignment
## ref: https://kubernetes.io/docs/user-guide/node-selection/
##
nodeSelector: {}

## -- Tolerations for pod assignment
## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
##
tolerations: []

## -- Affinity for pod assignment
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
affinity: {}

## -- used to assign priority to pods
## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
##
priorityClassName: ""

## -- IPFS Server
##
ipfs:
  enabled: true

## -- Prometheus Service Monitor
## ref: https://github.com/coreos/prometheus-operator
##      https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint
##
serviceMonitor:
  # Create ServiceMonitor resource(s) for scraping metrics using PrometheusOperator
  enabled: false
  # The namespace in which the ServiceMonitor will be created
  namespace: ""
  # The interval at which metrics should be scraped
  interval: 30s
  # The timeout after which the scrape is ended
  scrapeTimeout: ""
  # Metrics RelabelConfigs to apply to samples before scraping.
  relabellings: []
  # Metrics RelabelConfigs to apply to samples before ingestion.
  metricRelabelings: []
  # Specify honorLabels parameter to add the scrape endpoint
  honorLabels: false
  # Additional labels that can be used so ServiceMonitor resource(s) can be discovered by Prometheus
  additionalLabels: {}

## -- Custom PrometheusRule to be defined
## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions
##
prometheusRule:
  # Create a custom prometheusRule Resource for scraping metrics using PrometheusOperator
  enabled: false
  # Create a default set of Alerts
  default: true
  # The namespace in which the prometheusRule will be created
  namespace: ""
  # Additional labels for the prometheusRule
  additionalLabels: {}
  # Custom Prometheus rules
  rules: []

# -- Readiness probe
readinessProbe:
  initialDelaySeconds: 60
  timeoutSeconds: 1
  periodSeconds: 10
  failureThreshold: 3
  successThreshold: 1
  httpGet:
    path: /
    port: http
    scheme: HTTP

# -- Liveness probe
livenessProbe:
  initialDelaySeconds: 60
  timeoutSeconds: 1
  periodSeconds: 10
  failureThreshold: 3
  successThreshold: 1
  httpGet:
    path: /
    port: http
    scheme: HTTP

安装命令

helm install parasail-graph-node-test stakewise/graph-node --version 3.1.0 -n graph-node-test --create-namespace -f values.yaml

更新命令

helm upgrade parasail-graph-node-test stakewise/graph-node --version 3.1.0 -n graph-node-test --create-namespace -f values.yaml

网站公告

今日签到

点亮在社区的每一天
去签到