Skip to content

Added support for db migrations #204

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions k8s/subquery/templates/db/db.sts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ spec:
name: data
spec:
accessModes: ["ReadWriteOnce"]
{{ if .Values.db.dataSource }}
dataSource:
kind: PersistentVolumeClaim
name: {{ .Values.db.dataSource }}
{{ end }}
resources:
requests:
storage: {{ .Values.db.storageSize }}
volumeMode: Filesystem
storageClassName: {{ .Values.db.storageClass }}
2 changes: 2 additions & 0 deletions k8s/subquery/templates/node/node.cmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ metadata:

data:
DB_DATABASE: {{ .Values.db.name | quote }}
SHADOW_DATABASE: {{ .Values.db.shadowDatabase | quote }}
ROOT_DATABASE: {{ .Values.db.rootDatabase | quote
Comment on lines +11 to +12

Choose a reason for hiding this comment

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

We actually shouldn't need these in production. These are only needed for resetting the DB or committing migrations. We should only ever be applying migrations in production which only interacts with DB_DATABASE.

DB_USER: {{ .Values.db.user | quote }}
DB_HOST: "subquery-db"
DB_PORT: "5432"
Expand Down
9 changes: 7 additions & 2 deletions k8s/subquery/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ subquery:
genesisFile: https://storage.googleapis.com/fetch-ai-testnet-genesis/genesis-dorado-827201.json

db:
image: postgres
image: postgres # TODO: change this to our custom image
tag: 14-alpine

name: subquery
user: subquery
schema: app
shadowDatabase: subquery_shadow
rootDatabase: postgres

gcpProject: fetch-ai-sandbox
gcpSecret: sandbox_subquery_postgres

storageSize: 30Gi
storageSize: 100Gi
storageClass: csi-standard
dataSource: data-subquery-db-migration-source-0 # NOTE: specify this if PVC need to be copied from existing PVC