Skip to content

Commit

Permalink
Hasura integration with squids (#334)
Browse files Browse the repository at this point in the history
* add hasura graphql server to squids

* add ports
  • Loading branch information
DaMandal0rian authored Aug 6, 2024
1 parent 8579eaa commit de91cbe
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 14 deletions.
25 changes: 13 additions & 12 deletions explorer/terraform/aws/gemini-3h/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,17 @@ module "squids" {
prune = false
}

cloudflare_api_token = var.cloudflare_api_token
cloudflare_email = var.cloudflare_email
aws_key_name = var.aws_key_name
nr_api_key = var.nr_api_key
netdata_token = var.netdata_token
access_key = var.access_key
secret_key = var.secret_key
vpc_id = var.vpc_id
vpc_cidr_block = var.vpc_cidr_block
public_subnet_cidrs = var.public_subnet_cidrs
postgres_password = var.postgres_password
prometheus_secret = var.prometheus_secret
cloudflare_api_token = var.cloudflare_api_token
cloudflare_email = var.cloudflare_email
aws_key_name = var.aws_key_name
nr_api_key = var.nr_api_key
netdata_token = var.netdata_token
access_key = var.access_key
secret_key = var.secret_key
vpc_id = var.vpc_id
vpc_cidr_block = var.vpc_cidr_block
public_subnet_cidrs = var.public_subnet_cidrs
postgres_password = var.postgres_password
prometheus_secret = var.prometheus_secret
hasura_graphql_admin_secret = var.hasura_graphql_admin_secret
}
1 change: 1 addition & 0 deletions explorer/terraform/aws/gemini-3h/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ nr_api_key = ""
netdata_token = ""
postgres_password = ""
prometheus_secret = ""
hasura_graphql_admin_secret = ""
5 changes: 5 additions & 0 deletions explorer/terraform/aws/gemini-3h/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,8 @@ variable "prometheus_secret" {
sensitive = true
type = string
}

variable "hasura_graphql_admin_secret" {
sensitive = true
type = string
}
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ resource "null_resource" "start-nova-blue-squid-nodes" {
"echo INGEST_HEALTH_HOST=http://ingest:9090 >> /home/${var.ssh_user}/squid/.env",
"echo INGEST_HEALTH_PORT=7070 >> /home/${var.ssh_user}/squid/.env",
"echo MY_SECRET=${var.prometheus_secret} >> /home/${var.ssh_user}/squid/.env",
"echo HASURA_GRAPHQL_ADMIN_SECRET=${var.hasura_graphql_admin_secret} >> /home/${var.ssh_user}/squid/.env",

# create docker compose file
"chmod +x /home/${var.ssh_user}/squid/create_compose_file.sh",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ resource "null_resource" "start-blue-squid-nodes" {
"echo INGEST_HEALTH_HOST=http://ingest:9090 >> /home/${var.ssh_user}/squid/.env",
"echo INGEST_HEALTH_PORT=7070 >> /home/${var.ssh_user}/squid/.env",
"echo MY_SECRET=${var.prometheus_secret} >> /home/${var.ssh_user}/squid/.env",
"echo HASURA_GRAPHQL_ADMIN_SECRET=${var.hasura_graphql_admin_secret} >> /home/${var.ssh_user}/squid/.env",

# create docker compose file
"chmod +x /home/${var.ssh_user}/squid/create_compose_file.sh",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,30 @@ services:
options:
loki-url: "https://logging.subspace.network/loki/api/v1/push"
graphql-engine:
image: hasura/graphql-engine:v2.40.0
depends_on:
- "postgres"
restart: always
environment:
## postgres database to store Hasura metadata
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://\${POSTGRES_USER}:\${POSTGRES_PASSWORD}@db:5432/postgres
## enable the console served by server
HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set "false" to disable console
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE: "true"
## uncomment next line to run console offline (i.e load console assets from server instead of CDN)
# HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets
## uncomment next line to set an admin secret
HASURA_GRAPHQL_ADMIN_SECRET: \${HASURA_GRAPHQL_ADMIN_SECRET}
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: user
HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES: "true"
command:
- graphql-engine
- serve
ports:
- "8080:8080"
agent:
container_name: newrelic-infra
image: newrelic/infrastructure:latest
Expand All @@ -108,7 +132,7 @@ services:
SECRET: \${MY_SECRET}
command: "postgres"
ports:
- 8080:8080
- 9080:8080
prom-health-check:
image: ghcr.io/subspace/health-check:latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,30 @@ services:
options:
loki-url: "https://logging.subspace.network/loki/api/v1/push"
graphql-engine:
image: hasura/graphql-engine:v2.40.0
depends_on:
- "postgres"
restart: always
environment:
## postgres database to store Hasura metadata
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://\${POSTGRES_USER}:\${POSTGRES_PASSWORD}@db:5432/postgres
## enable the console served by server
HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set "false" to disable console
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE: "true"
## uncomment next line to run console offline (i.e load console assets from server instead of CDN)
# HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets
## uncomment next line to set an admin secret
HASURA_GRAPHQL_ADMIN_SECRET: \${HASURA_GRAPHQL_ADMIN_SECRET}
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: user
HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES: "true"
command:
- graphql-engine
- serve
ports:
- "8080:8080"
agent:
container_name: newrelic-infra
image: newrelic/infrastructure:latest
Expand All @@ -108,7 +132,7 @@ services:
SECRET: \${MY_SECRET}
command: "postgres"
ports:
- 8080:8080
- 9080:8080
prom-health-check:
image: ghcr.io/subspace/health-check:latest
Expand Down
5 changes: 5 additions & 0 deletions templates/terraform/explorer/base/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,8 @@ variable "prometheus_secret" {
sensitive = true
type = string
}

variable "hasura_graphql_admin_secret" {
sensitive = true
type = string
}

0 comments on commit de91cbe

Please sign in to comment.