diff --git a/docker/fetch-node.dockerfile b/docker/fetch-node.dockerfile new file mode 100644 index 000000000..017160acc --- /dev/null +++ b/docker/fetch-node.dockerfile @@ -0,0 +1,8 @@ +FROM fetchai/fetchd:0.10.6 + +WORKDIR /app + +COPY /scripts/fetch-node-entrypoint.sh /app/entrypoint.sh +RUN ["chmod", "+x", "/app/entrypoint.sh"] + +ENTRYPOINT ["/bin/bash", "/app/entrypoint.sh"] \ No newline at end of file diff --git a/docker/subql-node.dockerfile b/docker/subql-node.dockerfile new file mode 100644 index 000000000..0f33755df --- /dev/null +++ b/docker/subql-node.dockerfile @@ -0,0 +1,44 @@ +FROM node:18-slim AS builder + +ENV NODE_ENV=development +WORKDIR /app + +# Add build dependencies +ADD ./package.json yarn.lock /app/ +RUN apt-get update && apt-get install -y tree +RUN yarn install --frozen-lockfile + +# Copy files & build +COPY . /app +RUN yarn codegen && yarn build + +WORKDIR /app/subql-cosmos/packages/node/ + +RUN yarn install && yarn build + +FROM node:18-slim + +WORKDIR /app + +RUN set -ex \ + && apt-get update -y \ + && apt-get install -y postgresql postgresql-contrib # && npm install -g clinic # Profiler + +ADD https://github.com/mikefarah/yq/releases/download/v4.26.1/yq_linux_amd64 /usr/local/bin/yq +RUN chmod +x /usr/local/bin/yq + +COPY --from=builder /app/subql-cosmos/packages/node/package.json /app/node/ +COPY --from=builder /app/subql-cosmos/packages/node/dist /app/node/dist +COPY --from=builder /app/dist /app/dist +RUN yarn install + +ADD ./proto /app/proto/ +ADD ./project.yaml schema.graphql package.json /app/ + +WORKDIR /app/node +RUN yarn install + +ADD ./scripts/subql-entrypoint.sh /app/entrypoint.sh +RUN chmod +x /app/entrypoint.sh + +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/docker/transaction.dockerfile b/docker/transaction.dockerfile new file mode 100644 index 000000000..ecf8d7c4f --- /dev/null +++ b/docker/transaction.dockerfile @@ -0,0 +1,12 @@ +FROM python:3.9-slim-buster + +# Install pipenv and compilation dependencies +RUN pip3 install cosmpy +ENV PYTHONUNBUFFERED=1 +WORKDIR /app + +# add the remaining parts of the produce the build +COPY ./scripts/tx-entrypoint.py /app/tx-entrypoint.py + +ENTRYPOINT ["python3"] +CMD ["/app/tx-entrypoint.py"] \ No newline at end of file diff --git a/k8s/subquery/.helmignore b/k8s/indexer/.helmignore similarity index 100% rename from k8s/subquery/.helmignore rename to k8s/indexer/.helmignore diff --git a/k8s/indexer/Chart.yaml b/k8s/indexer/Chart.yaml new file mode 100644 index 000000000..c5a10d164 --- /dev/null +++ b/k8s/indexer/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: indexer +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/k8s/indexer/charts/fetch-node/.helmignore b/k8s/indexer/charts/fetch-node/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/k8s/indexer/charts/fetch-node/.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/k8s/indexer/charts/fetch-node/Chart.yaml b/k8s/indexer/charts/fetch-node/Chart.yaml new file mode 100644 index 000000000..1772be51f --- /dev/null +++ b/k8s/indexer/charts/fetch-node/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: fetchd-node-chart +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/k8s/indexer/charts/fetch-node/templates/service.yml b/k8s/indexer/charts/fetch-node/templates/service.yml new file mode 100644 index 000000000..192de51fd --- /dev/null +++ b/k8s/indexer/charts/fetch-node/templates/service.yml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: Service +metadata: + name: fetch-node + labels: + app: fetch-node +spec: + ports: + - name: p2p + port: 26656 + targetPort: 26656 + - name: tcp + port: 26657 + targetPort: 26657 + - name: prometheus + port: 26660 + targetPort: 26660 + - name: api + port: 1317 + targetPort: 1317 + - name: grpc + port: 9090 + targetPort: 9090 + selector: + app: fetch-node \ No newline at end of file diff --git a/k8s/indexer/charts/fetch-node/templates/statefulSet.yml b/k8s/indexer/charts/fetch-node/templates/statefulSet.yml new file mode 100644 index 000000000..db632c706 --- /dev/null +++ b/k8s/indexer/charts/fetch-node/templates/statefulSet.yml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: fetch-node +spec: + selector: + matchLabels: + app: fetch-node # has to match .spec.template.metadata.labels + serviceName: "fetch-node" + replicas: 1 + minReadySeconds: 10 # by default is 0 + template: + metadata: + labels: + app: fetch-node # has to match .spec.selector.matchLabels + spec: + terminationGracePeriodSeconds: 10 + containers: + - name: fetch-node + image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" + ports: + - containerPort: 26656 + - containerPort: 26657 + - containerPort: 26660 + - containerPort: 1317 + - containerPort: 9090 + + volumeMounts: + - name: data + mountPath: /root/.fetchd + + volumeClaimTemplates: + - metadata: + name: data + spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: {{ .Values.storage.size | quote }} diff --git a/k8s/indexer/charts/fetch-node/values.yaml b/k8s/indexer/charts/fetch-node/values.yaml new file mode 100644 index 000000000..0cfe93d6c --- /dev/null +++ b/k8s/indexer/charts/fetch-node/values.yaml @@ -0,0 +1,6 @@ +image: + repo: jonathansumner/fetch-node + tag: v6 + +storage: + size: 5Gi \ No newline at end of file diff --git a/k8s/indexer/charts/graphql-api/.helmignore b/k8s/indexer/charts/graphql-api/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/k8s/indexer/charts/graphql-api/.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/k8s/indexer/charts/graphql-api/Chart.yaml b/k8s/indexer/charts/graphql-api/Chart.yaml new file mode 100644 index 000000000..75109853e --- /dev/null +++ b/k8s/indexer/charts/graphql-api/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: graphql-api +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/k8s/indexer/charts/graphql-api/values.yaml b/k8s/indexer/charts/graphql-api/values.yaml new file mode 100644 index 000000000..c5419b7c2 --- /dev/null +++ b/k8s/indexer/charts/graphql-api/values.yaml @@ -0,0 +1,82 @@ +# Default values for graphql-api. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +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: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/k8s/indexer/charts/postgres-db/.helmignore b/k8s/indexer/charts/postgres-db/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/k8s/indexer/charts/postgres-db/.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/k8s/indexer/charts/postgres-db/Chart.yaml b/k8s/indexer/charts/postgres-db/Chart.yaml new file mode 100644 index 000000000..45bebb779 --- /dev/null +++ b/k8s/indexer/charts/postgres-db/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: postgres-db +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/k8s/indexer/charts/postgres-db/templates/PV.yaml b/k8s/indexer/charts/postgres-db/templates/PV.yaml new file mode 100644 index 000000000..95e563890 --- /dev/null +++ b/k8s/indexer/charts/postgres-db/templates/PV.yaml @@ -0,0 +1,15 @@ +kind: PersistentVolume +apiVersion: v1 +metadata: + name: postgres-pv-volume + labels: + app: postgres + type: local +spec: + storageClassName: manual + capacity: + storage: 10Gi + accessModes: + - ReadWriteMany + hostPath: + path: /var/lib/data \ No newline at end of file diff --git a/k8s/indexer/charts/postgres-db/templates/PVC.yaml b/k8s/indexer/charts/postgres-db/templates/PVC.yaml new file mode 100644 index 000000000..3f904579e --- /dev/null +++ b/k8s/indexer/charts/postgres-db/templates/PVC.yaml @@ -0,0 +1,13 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: postgres-pv-claim + labels: + app: postgres +spec: + storageClassName: manual + accessModes: + - ReadWriteMany + resources: + requests: + storage: 10Gi \ No newline at end of file diff --git a/k8s/indexer/charts/postgres-db/templates/Service.yaml b/k8s/indexer/charts/postgres-db/templates/Service.yaml new file mode 100644 index 000000000..17c5880db --- /dev/null +++ b/k8s/indexer/charts/postgres-db/templates/Service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: postgres + labels: + app: postgres +spec: + ports: + - name: postgres + port: 5432 + targetPort: 5432 + selector: + app: postgres \ No newline at end of file diff --git a/k8s/indexer/charts/postgres-db/templates/StatefulSet.yaml b/k8s/indexer/charts/postgres-db/templates/StatefulSet.yaml new file mode 100644 index 000000000..d5122e83f --- /dev/null +++ b/k8s/indexer/charts/postgres-db/templates/StatefulSet.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: postgres +spec: + serviceName: postgres + selector: + matchLabels: + app: postgres + template: + metadata: + labels: + app: postgres + spec: + containers: + - name: postgres + image: postgres:14.5-bullseye + imagePullPolicy: "IfNotPresent" + env: + - name: POSTGRES_USER + value: "{{ .Values.auth.user }}" + - name: POSTGRES_PASSWORD + value: "{{ .Values.auth.pass }}" + - name: POSTGRES_DB + value: "{{ .Values.auth.db }}" + - name: PGDATA + value: "{{ .Values.data.path }}" + volumeMounts: + - mountPath: /var/lib/postgresql/data + name: postgresdb + volumes: + - name: postgresdb + persistentVolumeClaim: + claimName: postgres-pv-claim \ No newline at end of file diff --git a/k8s/indexer/charts/postgres-db/values.yaml b/k8s/indexer/charts/postgres-db/values.yaml new file mode 100644 index 000000000..ab7b3be41 --- /dev/null +++ b/k8s/indexer/charts/postgres-db/values.yaml @@ -0,0 +1,6 @@ +auth: + user: "subquery" + pass: "subquery" + db: "subquery" +data: + path: "/var/lib/postgresql/data/db/" \ No newline at end of file diff --git a/k8s/indexer/charts/subql-node/.helmignore b/k8s/indexer/charts/subql-node/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/k8s/indexer/charts/subql-node/.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/k8s/indexer/charts/subql-node/Chart.yaml b/k8s/indexer/charts/subql-node/Chart.yaml new file mode 100644 index 000000000..5ac2f7c1a --- /dev/null +++ b/k8s/indexer/charts/subql-node/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: subql-node +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/k8s/indexer/charts/subql-node/templates/Deployment.yaml b/k8s/indexer/charts/subql-node/templates/Deployment.yaml new file mode 100644 index 000000000..a0e3f22a5 --- /dev/null +++ b/k8s/indexer/charts/subql-node/templates/Deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: subql-node + annotations: + prometheus.io/path: /metrics + prometheus.io/port: "3000" + prometheus.io/scrape: "true" +spec: + selector: + matchLabels: + app: subql-node + template: + metadata: + labels: + app: subql-node + spec: + containers: + - name: subql-node + image: "{{.Values.image.repo}}:{{.Values.image.tag}}" + imagePullPolicy: "Always" + args: + - -f=/app + - --db-schema=app + - --batch-size=1 + - --disable-historical=true + - --profiler + env: + - name: DB_USER + value: "{{ .Values.auth.username }}" + - name: DB_PASS + value: "{{ .Values.auth.password }}" + - name: DB_DATABASE + value: "{{ .Values.auth.db_name }}" + - name: DB_HOST + value: "{{ .Values.auth.db_host }}" + - name: DB_PORT + value: "{{ .Values.auth.db_port }}" + - name: START_BLOCK + value: "{{ .Values.auth.start_block }}" + - name: NETWORK_ENDPOINT + value: "{{ .Values.auth.network_endpoint }}" + - name: CHAIN_ID + value: "{{ .Values.auth.chain_id }}" + ports: + - containerPort: 3000 \ No newline at end of file diff --git a/k8s/indexer/charts/subql-node/templates/Service.yaml b/k8s/indexer/charts/subql-node/templates/Service.yaml new file mode 100644 index 000000000..ec41eccbe --- /dev/null +++ b/k8s/indexer/charts/subql-node/templates/Service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: subql-node + labels: + app: subql-node + namespace: joe-testing +spec: + type: NodePort + ports: + - port: 3000 + targetPort: 3000 + selector: + app: subql-node diff --git a/k8s/indexer/charts/subql-node/values.yaml b/k8s/indexer/charts/subql-node/values.yaml new file mode 100644 index 000000000..2ea1e7789 --- /dev/null +++ b/k8s/indexer/charts/subql-node/values.yaml @@ -0,0 +1,12 @@ +image: + repo: jonathansumner/indexer + tag: v5 +auth: + username: "subquery" + password: "subquery" + db_name: "subquery" + db_port: "5432" + db_host: "postgres" + start_block: "1" + network_endpoint: "http://fetch-node:26657" + chain_id: "test" \ No newline at end of file diff --git a/k8s/indexer/charts/tx-gen/.helmignore b/k8s/indexer/charts/tx-gen/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/k8s/indexer/charts/tx-gen/.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/k8s/indexer/charts/tx-gen/Chart.yaml b/k8s/indexer/charts/tx-gen/Chart.yaml new file mode 100644 index 000000000..49945330d --- /dev/null +++ b/k8s/indexer/charts/tx-gen/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: tx-gen +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/k8s/indexer/charts/tx-gen/templates/deployment.yaml b/k8s/indexer/charts/tx-gen/templates/deployment.yaml new file mode 100644 index 000000000..7ebd0a76c --- /dev/null +++ b/k8s/indexer/charts/tx-gen/templates/deployment.yaml @@ -0,0 +1,16 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: fetch-tx +spec: + selector: + matchLabels: + app: fetch-tx + template: + metadata: + labels: + app: fetch-tx + spec: + containers: + - name: fetch-tx + image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" \ No newline at end of file diff --git a/k8s/indexer/charts/tx-gen/values.yaml b/k8s/indexer/charts/tx-gen/values.yaml new file mode 100644 index 000000000..ae4b73822 --- /dev/null +++ b/k8s/indexer/charts/tx-gen/values.yaml @@ -0,0 +1,3 @@ +image: + repo: gcr.io/fetch-ai-sandbox/joe-tx-test + tag: v7 \ No newline at end of file diff --git a/k8s/indexer/values.yaml b/k8s/indexer/values.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/k8s/subquery/Chart.yaml b/k8s/subquery/Chart.yaml deleted file mode 100644 index a037e8dce..000000000 --- a/k8s/subquery/Chart.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: v2 -name: subquery -description: A helm chart for the deployment of the fetch.ai subquery node -type: application -version: 0.1.1 -appVersion: "1.16.0" diff --git a/k8s/subquery/conf/healthcheck.sh b/k8s/subquery/conf/healthcheck.sh deleted file mode 100644 index a5c3890e3..000000000 --- a/k8s/subquery/conf/healthcheck.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -echo "Sending request to $HOST" - -response=$(curl $HOST -s -w "%{http_code}" \ - -H 'accept: */*' \ - -H 'content-type: application/json' \ - --data-raw '{"operationName":"sanityCheck","variables":{},"query":"query sanityCheck {\n blocks {\n totalCount\n }\n}\n"}' -) - -status_code=$(tail -n1 <<< "$response") -content=$(sed '$ d' <<< "$response") - -echo "Obtained response - $content" -echo "Obtained status code - $status_code" - -if [[ "$status_code" -ne "200" ]]; then - exit 1 -else - echo "Sending push to StatusCake" - curl "${STATUSCAKE_ENDPOINT}" - exit 0 -fi diff --git a/k8s/subquery/templates/_helpers.tpl b/k8s/subquery/templates/_helpers.tpl deleted file mode 100644 index b6407fc77..000000000 --- a/k8s/subquery/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "subquery.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "subquery.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 "subquery.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "subquery.labels" -}} -helm.sh/chart: {{ include "subquery.chart" . }} -{{ include "subquery.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "subquery.selectorLabels" -}} -app.kubernetes.io/name: {{ include "subquery.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "subquery.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "subquery.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/k8s/subquery/templates/api/api.cert.yml b/k8s/subquery/templates/api/api.cert.yml deleted file mode 100644 index a86357840..000000000 --- a/k8s/subquery/templates/api/api.cert.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: cert-manager.io/v1alpha2 -kind: Certificate -metadata: - name: "subq-{{ .Release.Namespace }}-{{ .Release.Name }}-cert" - namespace: istio-system -spec: - commonName: {{ .Values.subquery.api.dns.name }} - dnsNames: - - {{ .Values.subquery.api.dns.name }} - issuerRef: - kind: ClusterIssuer - name: letsencrypt-dns - secretName: "subq-{{ .Release.Namespace }}-{{ .Release.Name }}-cert" diff --git a/k8s/subquery/templates/api/api.cmap.yml b/k8s/subquery/templates/api/api.cmap.yml deleted file mode 100644 index f25961ab5..000000000 --- a/k8s/subquery/templates/api/api.cmap.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: subquery-api-config - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: api - -data: - DB_DATABASE: {{ .Values.db.name | quote }} - DB_USER: {{ .Values.db.user | quote }} - DB_HOST: "subquery-db" - DB_PORT: "5432" diff --git a/k8s/subquery/templates/api/api.deploy.yml b/k8s/subquery/templates/api/api.deploy.yml deleted file mode 100644 index 8ec8a135b..000000000 --- a/k8s/subquery/templates/api/api.deploy.yml +++ /dev/null @@ -1,37 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: subquery-api - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: api -spec: - replicas: {{ .Values.subquery.api.replicas }} - selector: - matchLabels: - {{- include "subquery.selectorLabels" . | nindent 6 }} - app.kubernetes.io/component: api - template: - metadata: - labels: - {{- include "subquery.selectorLabels" . | nindent 8 }} - app.kubernetes.io/component: api - spec: - containers: - - name: api - image: "{{ .Values.subquery.api.image }}:{{ .Values.subquery.api.tag }}" - - args: - - "--name=app" - - "--playground" - - "--indexer=http://subquery-node:3000" - - envFrom: - - configMapRef: - name: subquery-api-config - - secretRef: - name: subquery-api-secrets - - ports: - - containerPort: 3000 - name: api diff --git a/k8s/subquery/templates/api/api.dns.yml b/k8s/subquery/templates/api/api.dns.yml deleted file mode 100644 index 7c6b36279..000000000 --- a/k8s/subquery/templates/api/api.dns.yml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: externaldns.k8s.io/v1alpha1 -kind: DNSEndpoint -metadata: - name: api-endpoint - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: api -spec: - endpoints: - - dnsName: {{ .Values.subquery.api.dns.name }} - recordTTL: 180 - recordType: CNAME - targets: - - {{ .Values.subquery.api.dns.target }} diff --git a/k8s/subquery/templates/api/api.gateway.yml b/k8s/subquery/templates/api/api.gateway.yml deleted file mode 100644 index 93fd53b03..000000000 --- a/k8s/subquery/templates/api/api.gateway.yml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: networking.istio.io/v1alpha3 -kind: Gateway -metadata: - name: subquery-api-gateway - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: api - -spec: - selector: - app: {{ .Values.subquery.api.dns.ingressGateway }} - istio: ingressgateway - - servers: - - hosts: - - {{ .Values.subquery.api.dns.name }} - {{- range .Values.subquery.api.dns.additionalNames }} - - {{ . | quote }} - {{- end }} - port: - name: tcp-http - number: 80 - protocol: HTTP - tls: - httpsRedirect: false - - hosts: - - {{ .Values.subquery.api.dns.name }} - {{- range .Values.subquery.api.dns.additionalNames }} - - {{ . | quote }} - {{- end }} - port: - name: tcp-https - number: 443 - protocol: HTTPS - tls: - credentialName: "subq-{{ .Release.Namespace }}-{{ .Release.Name }}-cert" - mode: SIMPLE - privateKey: sds - serverCertificate: sds diff --git a/k8s/subquery/templates/api/api.secrets.yml b/k8s/subquery/templates/api/api.secrets.yml deleted file mode 100644 index bbc9eabf2..000000000 --- a/k8s/subquery/templates/api/api.secrets.yml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: kubernetes-client.io/v1 -kind: ExternalSecret -metadata: - name: subquery-api-secrets - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: api -spec: - backendType: gcpSecretsManager - projectId: {{ $.Values.db.gcpProject }} - data: - - name: "DB_PASS" - key: {{ $.Values.db.gcpSecret }} - property: POSTGRES_PASSWORD diff --git a/k8s/subquery/templates/api/api.svc.yml b/k8s/subquery/templates/api/api.svc.yml deleted file mode 100644 index ce36bdd70..000000000 --- a/k8s/subquery/templates/api/api.svc.yml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: subquery-api - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: api - -spec: - ports: - - port: 3000 - name: api - selector: - {{- include "subquery.selectorLabels" . | nindent 4 }} - app.kubernetes.io/component: api diff --git a/k8s/subquery/templates/api/api.vsvc.yml b/k8s/subquery/templates/api/api.vsvc.yml deleted file mode 100644 index 589f6c946..000000000 --- a/k8s/subquery/templates/api/api.vsvc.yml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: networking.istio.io/v1alpha3 -kind: VirtualService -metadata: - name: subquery-api-vsvc - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: api - -spec: - gateways: - - subquery-api-gateway - - hosts: - - {{ .Values.subquery.api.dns.name }} - {{- range .Values.subquery.api.dns.additionalDnsNames }} - - {{ . | quote }} - {{- end }} - - http: - - route: - - destination: - host: subquery-api - port: - number: 3000 - weight: 100 diff --git a/k8s/subquery/templates/db/db.cmap.yml b/k8s/subquery/templates/db/db.cmap.yml deleted file mode 100644 index 9bd77eb3a..000000000 --- a/k8s/subquery/templates/db/db.cmap.yml +++ /dev/null @@ -1,12 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: subquery-db-config - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: db - -data: - POSTGRES_USER: {{ .Values.db.user | quote }} - POSTGRES_DB: {{ .Values.db.name | quote }} - POSTGRES_INITDB_ARGS: "-A scram-sha-256" diff --git a/k8s/subquery/templates/db/db.secrets.yml b/k8s/subquery/templates/db/db.secrets.yml deleted file mode 100644 index 743e9316a..000000000 --- a/k8s/subquery/templates/db/db.secrets.yml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: kubernetes-client.io/v1 -kind: ExternalSecret -metadata: - name: subquery-db-secrets - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: db -spec: - backendType: gcpSecretsManager - projectId: {{ $.Values.db.gcpProject }} - data: - - name: "POSTGRES_PASSWORD" - key: {{ $.Values.db.gcpSecret }} - property: POSTGRES_PASSWORD diff --git a/k8s/subquery/templates/db/db.sts.yml b/k8s/subquery/templates/db/db.sts.yml deleted file mode 100644 index 59a2fa1c9..000000000 --- a/k8s/subquery/templates/db/db.sts.yml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: subquery-db - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: db - -spec: - selector: - matchLabels: - {{- include "subquery.selectorLabels" . | nindent 6 }} - app.kubernetes.io/component: db - serviceName: "subquery-db" - replicas: 1 - minReadySeconds: 10 # by default is 0 - template: - metadata: - labels: - {{- include "subquery.selectorLabels" . | nindent 8 }} - app.kubernetes.io/component: db - - spec: - terminationGracePeriodSeconds: 10 - containers: - - name: db - image: "{{ .Values.db.image }}:{{ .Values.db.tag }}" - envFrom: - - configMapRef: - name: subquery-db-config - - secretRef: - name: subquery-db-secrets - ports: - - containerPort: 5432 - name: psql - volumeMounts: - - name: data - mountPath: /var/lib/postgresql/data - subPath: db-data - volumeClaimTemplates: - - metadata: - name: data - spec: - accessModes: ["ReadWriteOnce"] - resources: - requests: - storage: {{ .Values.db.storageSize }} diff --git a/k8s/subquery/templates/db/db.svc.yml b/k8s/subquery/templates/db/db.svc.yml deleted file mode 100644 index 8de40a38e..000000000 --- a/k8s/subquery/templates/db/db.svc.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: subquery-db - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: db - -spec: - ports: - - port: 5432 - name: psql - clusterIP: None - selector: - {{- include "subquery.selectorLabels" . | nindent 4 }} - app.kubernetes.io/component: db diff --git a/k8s/subquery/templates/health/configmap.yaml b/k8s/subquery/templates/health/configmap.yaml deleted file mode 100644 index c053749b3..000000000 --- a/k8s/subquery/templates/health/configmap.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: subquery-health-configfiles -data: - healthcheck.sh: | -{{ $.Files.Get "conf/healthcheck.sh" | indent 4 }} diff --git a/k8s/subquery/templates/health/cronjob.yaml b/k8s/subquery/templates/health/cronjob.yaml deleted file mode 100644 index ac50806ba..000000000 --- a/k8s/subquery/templates/health/cronjob.yaml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: batch/v1 -kind: CronJob -metadata: - name: ledger-subquery-health - labels: - app: ledger-subquery-health - appkey: ledger-subquery-health -spec: - schedule: "*/5 * * * *" - successfulJobsHistoryLimit: 2 - failedJobsHistoryLimit: 2 - jobTemplate: - spec: - template: - metadata: - name: ledger-subquery-health - labels: - app: ledger-subquery-health - appkey: ledger-subquery-health - annotations: - sidecar.istio.io/inject: "false" - spec: - containers: - - name: ledger-subquery-health - image: ellerbrock/alpine-bash-curl-ssl - command: ['sh', '-c', '/usr/local/bin/healthcheck.sh' ] - env: - - name: HOST - value: {{ .Values.subquery.api.health.subquery_host }} - - name: STATUSCAKE_ENDPOINT - value: {{ .Values.subquery.api.health.statuscake_endpoint }} - volumeMounts: - - mountPath: /usr/local/bin/ - name: healthcheck-script - volumes: - - name: healthcheck-script - configMap: - name: subquery-health-configfiles - defaultMode: 511 - restartPolicy: Never diff --git a/k8s/subquery/templates/node/node.cmap.yml b/k8s/subquery/templates/node/node.cmap.yml deleted file mode 100644 index 3f04df240..000000000 --- a/k8s/subquery/templates/node/node.cmap.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: subquery-node-config - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: node - -data: - DB_DATABASE: {{ .Values.db.name | quote }} - DB_USER: {{ .Values.db.user | quote }} - DB_HOST: "subquery-db" - DB_PORT: "5432" - START_BLOCK: {{ .Values.subquery.node.startBlock | quote }} - CHAIN_ID: {{ .Values.subquery.node.chainId }} - NETWORK_ENDPOINT: {{ .Values.subquery.node.networkEndpoint }} diff --git a/k8s/subquery/templates/node/node.secrets.yml b/k8s/subquery/templates/node/node.secrets.yml deleted file mode 100644 index 4f2a1b4cb..000000000 --- a/k8s/subquery/templates/node/node.secrets.yml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: kubernetes-client.io/v1 -kind: ExternalSecret -metadata: - name: subquery-node-secrets - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: node -spec: - backendType: gcpSecretsManager - projectId: {{ $.Values.db.gcpProject }} - data: - - name: "DB_PASS" - key: {{ $.Values.db.gcpSecret }} - property: POSTGRES_PASSWORD diff --git a/k8s/subquery/templates/node/node.sts.yml b/k8s/subquery/templates/node/node.sts.yml deleted file mode 100644 index 94ab73368..000000000 --- a/k8s/subquery/templates/node/node.sts.yml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: subquery-node - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: node - -spec: - selector: - matchLabels: - {{- include "subquery.selectorLabels" . | nindent 6 }} - app.kubernetes.io/component: node - serviceName: "subquery-node" - replicas: {{ .Values.subquery.node.replicas }} - minReadySeconds: 10 - template: - metadata: - labels: - {{- include "subquery.selectorLabels" . | nindent 8 }} - app.kubernetes.io/component: node - spec: - terminationGracePeriodSeconds: 10 - containers: - - name: node - image: "{{ .Values.subquery.node.image }}:{{ .Values.subquery.node.tag }}" - args: ["-f=/app", "--db-schema=app", "--batch-size={{ .Values.subquery.node.batchSize }}"] - envFrom: - - configMapRef: - name: subquery-node-config - - secretRef: - name: subquery-node-secrets - ports: - - containerPort: 3000 - name: web diff --git a/k8s/subquery/templates/node/node.svc.yml b/k8s/subquery/templates/node/node.svc.yml deleted file mode 100644 index 29b272145..000000000 --- a/k8s/subquery/templates/node/node.svc.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: subquery-node - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: node - -spec: - ports: - - port: 3000 - name: web - clusterIP: None - selector: - {{- include "subquery.selectorLabels" . | nindent 4 }} - app.kubernetes.io/component: node diff --git a/k8s/subquery/templates/process-genesis/genesis.cmap.yml b/k8s/subquery/templates/process-genesis/genesis.cmap.yml deleted file mode 100644 index 7fc297f40..000000000 --- a/k8s/subquery/templates/process-genesis/genesis.cmap.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: subquery-genesis-config - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: genesis -data: - DB_NAME: {{ .Values.db.name | quote }} - DB_USER: {{ .Values.db.user | quote }} - DB_SCHEMA: {{ .Values.db.schema | quote }} - DB_HOST: "subquery-db" - DB_PORT: "5432" diff --git a/k8s/subquery/templates/process-genesis/genesis.cron.yml b/k8s/subquery/templates/process-genesis/genesis.cron.yml deleted file mode 100644 index c7bbf287e..000000000 --- a/k8s/subquery/templates/process-genesis/genesis.cron.yml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: subquery-process-genesis - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: genesis -spec: - template: - metadata: - labels: - {{- include "subquery.selectorLabels" . | nindent 8 }} - app.kubernetes.io/component: genesis - spec: - terminationGracePeriodSeconds: 10 - restartPolicy: OnFailure - containers: - - name: genesis - image: "{{ .Values.subquery.genesis_processor.image }}:{{ .Values.subquery.genesis_processor.tag }}" - command: ["pipenv", "run"] - args: - - python - - /app/scripts/genesis.py - - {{ .Values.subquery.genesis_processor.genesisFile }} - envFrom: - - configMapRef: - name: subquery-genesis-config - - secretRef: - name: subquery-genesis-secrets - initContainers: - - command: - - sh - - -c - - > - set -x; - while [ $(curl -sw '%{http_code}' "http://subquery-node:3000/ready" -o /dev/null) -ne 200 ]; do - echo "Waiting for subquery-node"; sleep 5; - done - image: yauritux/busybox-curl - name: wait-subquerynode-0 diff --git a/k8s/subquery/templates/process-genesis/genesis.secrets.yml b/k8s/subquery/templates/process-genesis/genesis.secrets.yml deleted file mode 100644 index cbcfc6fca..000000000 --- a/k8s/subquery/templates/process-genesis/genesis.secrets.yml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: kubernetes-client.io/v1 -kind: ExternalSecret -metadata: - name: subquery-genesis-secrets - labels: - {{- include "subquery.labels" . | nindent 4 }} - app.kubernetes.io/component: genesis -spec: - backendType: gcpSecretsManager - projectId: {{ $.Values.db.gcpProject }} - data: - - name: "DB_PASS" - key: {{ $.Values.db.gcpSecret }} - property: POSTGRES_PASSWORD diff --git a/k8s/subquery/values.yaml b/k8s/subquery/values.yaml deleted file mode 100644 index 5d098c029..000000000 --- a/k8s/subquery/values.yaml +++ /dev/null @@ -1,44 +0,0 @@ -subquery: - node: - image: gcr.io/fetch-ai-sandbox/subquery-node - tag: 239fe08 - startBlock: "827201" - networkEndpoint: https://rpc-dorado.fetch.ai:443 - chainId: "dorado-1" - batchSize: 1 - - api: - image: gcr.io/fetch-ai-sandbox/subquery-api - tag: v1.4.0 - - replicas: 1 - - dns: - # Gateways - ingressGateway: "istio-fetch-gaia-ig" - - # DNS Settings - name: staging.subquery.sandbox-london-b.fetch-ai.com - target: "gaia.sandbox-london-b.fetch-ai.com" - additionalDnsNames: [] - - health: - statuscake_endpoint: placeholder # NOTE: replace this with statuscake PUSH endpoint - subquery_host: https://subquery.fetch.ai/ - - genesis_processor: - image: gcr.io/fetch-ai-images/subquery-genesis-processor - tag: v2 - genesisFile: https://storage.googleapis.com/fetch-ai-testnet-genesis/genesis-dorado-827201.json - -db: - image: postgres - tag: 14-alpine - - name: subquery - user: subquery - schema: app - gcpProject: fetch-ai-sandbox - gcpSecret: sandbox_subquery_postgres - - storageSize: 30Gi diff --git a/scripts/fetch-node-entrypoint.sh b/scripts/fetch-node-entrypoint.sh new file mode 100644 index 000000000..b9bef896e --- /dev/null +++ b/scripts/fetch-node-entrypoint.sh @@ -0,0 +1,14 @@ +set -e + +if [ ! -f /root/.fetchd/config/genesis.json ]; then + echo "Genesis not found, configuring new setup" + fetchd init node --chain-id test + fetchd config keyring-backend test + fetchd config chain-id test + fetchd keys add validator + fetchd add-genesis-account $(fetchd keys show validator -a) 1152997575000000000000000000stake + fetchd gentx validator 100000000000000000000stake --keyring-backend test --chain-id test + fetchd collect-gentxs +fi + +fetchd start --rpc.laddr tcp://0.0.0.0:26657 \ No newline at end of file diff --git a/scripts/subql-entrypoint.sh b/scripts/subql-entrypoint.sh new file mode 100644 index 000000000..32efbcde9 --- /dev/null +++ b/scripts/subql-entrypoint.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e + +if [[ ! -z "${START_BLOCK}" ]]; then + echo "[Config Update] Start Block: ${START_BLOCK}" + yq -i '.dataSources[].startBlock = env(START_BLOCK)' /app/project.yaml +fi + +if [[ ! -z "${CHAIN_ID}" ]]; then + echo "[Config Update] Chain ID: ${CHAIN_ID}" + yq -i '.network.chainId = env(CHAIN_ID)' /app/project.yaml +fi + +if [[ ! -z "${NETWORK_ENDPOINT}" ]]; then + echo "[Config Update] Network Endpoint: ${NETWORK_ENDPOINT}" + yq -i '.network.endpoint = strenv(NETWORK_ENDPOINT)' /app/project.yaml +fi + +# Add btree_gist extension to support historical mode +export PGPASSWORD=$DB_PASS +psql -v ON_ERROR_STOP=1 \ + -h $DB_HOST \ + -U $DB_USER \ + -p $DB_PORT \ + -d $DB_DATABASE <