Skip to content

Commit a84e6c9

Browse files
bug fixes (#364)
1 parent 4e44e77 commit a84e6c9

File tree

3 files changed

+36
-22
lines changed

3 files changed

+36
-22
lines changed

templates/terraform/subql/base/bootstrap_nova_subql_provisioner.tf

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ resource "null_resource" "setup-nova-green-subql-nodes" {
9191
# create subql dir
9292
provisioner "remote-exec" {
9393
inline = [
94-
"mkdir -p /home/${var.ssh_user}/subql",
95-
"mkdir -p /home/${var.ssh_user}/subql/postgresql",
96-
"mkdir -p /home/${var.ssh_user}/subql/postgresql/{conf,data}",
94+
"sudo mkdir -p /home/${var.ssh_user}/subql",
95+
"sudo mkdir -p /home/${var.ssh_user}/subql/postgresql",
96+
"sudo mkdir -p /home/${var.ssh_user}/subql/postgresql/conf",
97+
"sudo mkdir -p /home/${var.ssh_user}/subql/postgresql/data",
9798
"sudo chown -R ${var.ssh_user}:${var.ssh_user} /home/${var.ssh_user}/subql/ && sudo chmod -R 750 /home/${var.ssh_user}/subql/"
9899
]
99100
}
@@ -159,7 +160,6 @@ resource "null_resource" "start-nova-blue-subql-nodes" {
159160
# run subql install script
160161
"chmod +x /home/${var.ssh_user}/subql/install_subql_stack.sh",
161162
"bash /home/${var.ssh_user}/subql/install_subql_stack.sh",
162-
"echo 'Installation Complete'",
163163

164164
# create .env file
165165
"grep -q '^NR_AGENT_IDENTIFIER=' /home/${var.ssh_user}/astral/.env && sed -i 's/^NR_AGENT_IDENTIFIER=.*/NR_AGENT_IDENTIFIER=subql-${var.nova-blue-subql-node-config.deployment-color}-${var.nova-blue-subql-node-config.network-name}/' /home/${var.ssh_user}/astral/.env || echo NR_AGENT_IDENTIFIER=subql-${var.nova-blue-subql-node-config.deployment-color}-${var.nova-blue-subql-node-config.network-name} >> /home/${var.ssh_user}/astral/.env",
@@ -169,6 +169,13 @@ resource "null_resource" "start-nova-blue-subql-nodes" {
169169
"grep -q '^HASURA_GRAPHQL_ADMIN_SECRET=' /home/${var.ssh_user}/astral/.env && sed -i 's/^HASURA_GRAPHQL_ADMIN_SECRET=.*/HASURA_GRAPHQL_ADMIN_SECRET=${var.hasura_graphql_admin_secret}/' /home/${var.ssh_user}/astral/.env || echo HASURA_GRAPHQL_ADMIN_SECRET=${var.hasura_graphql_admin_secret} >> /home/${var.ssh_user}/astral/.env",
170170
"grep -q '^HASURA_GRAPHQL_JWT_SECRET=' /home/${var.ssh_user}/astral/.env && sed -i 's|^HASURA_GRAPHQL_JWT_SECRET=.*|HASURA_GRAPHQL_JWT_SECRET={\"type\":\"HS256\",\"key\":\"${var.hasura_graphql_jwt_secret}\"}|' /home/${var.ssh_user}/astral/.env || echo HASURA_GRAPHQL_JWT_SECRET={\"type\":\"HS256\",\"key\":\"${var.hasura_graphql_jwt_secret}\"} >> /home/${var.ssh_user}/astral/.env",
171171

172+
# run subql stack
173+
"export $(grep -v '^#' /home/${var.ssh_user}/astral/.env | xargs)",
174+
"cd /home/${var.ssh_user}/astral/indexers",
175+
"yarn build-dictionary",
176+
"npx lerna run codegen",
177+
"npx lerna run build",
178+
"sudo docker compose -p prod-astral-indexers -f /home/${var.ssh_user}/astral/docker-compose.yml -f /home/${var.ssh_user}/astral/docker-compose.prod.yml --profile dictionary --profile task --profile taurus up -d --remove-orphans",
172179
"echo 'Installation Complete'",
173180
]
174181
}
@@ -225,7 +232,6 @@ resource "null_resource" "nova-start-green-subql-nodes" {
225232
# run subql install script
226233
"chmod +x /home/${var.ssh_user}/subql/install_subql_stack.sh",
227234
"bash /home/${var.ssh_user}/subql/install_subql_stack.sh",
228-
"echo 'Installation Complete'",
229235

230236
# create .env file
231237
"grep -q '^NR_AGENT_IDENTIFIER=' /home/${var.ssh_user}/astral/.env && sed -i 's/^NR_AGENT_IDENTIFIER=.*/NR_AGENT_IDENTIFIER=subql-${var.nova-green-subql-node-config.deployment-color}-${var.nova-green-subql-node-config.network-name}/' /home/${var.ssh_user}/astral/.env || echo NR_AGENT_IDENTIFIER=subql-${var.nova-green-subql-node-config.deployment-color}-${var.nova-green-subql-node-config.network-name} >> /home/${var.ssh_user}/astral/.env",
@@ -235,6 +241,13 @@ resource "null_resource" "nova-start-green-subql-nodes" {
235241
"grep -q '^HASURA_GRAPHQL_ADMIN_SECRET=' /home/${var.ssh_user}/astral/.env && sed -i 's/^HASURA_GRAPHQL_ADMIN_SECRET=.*/HASURA_GRAPHQL_ADMIN_SECRET=${var.hasura_graphql_admin_secret}/' /home/${var.ssh_user}/astral/.env || echo HASURA_GRAPHQL_ADMIN_SECRET=${var.hasura_graphql_admin_secret} >> /home/${var.ssh_user}/astral/.env",
236242
"grep -q '^HASURA_GRAPHQL_JWT_SECRET=' /home/${var.ssh_user}/astral/.env && sed -i 's|^HASURA_GRAPHQL_JWT_SECRET=.*|HASURA_GRAPHQL_JWT_SECRET={\"type\":\"HS256\",\"key\":\"${var.hasura_graphql_jwt_secret}\"}|' /home/${var.ssh_user}/astral/.env || echo HASURA_GRAPHQL_JWT_SECRET={\"type\":\"HS256\",\"key\":\"${var.hasura_graphql_jwt_secret}\"} >> /home/${var.ssh_user}/astral/.env",
237243

244+
# run subql stack
245+
"export $(grep -v '^#' /home/${var.ssh_user}/astral/.env | xargs)",
246+
"cd /home/${var.ssh_user}/astral/indexers",
247+
"yarn build-dictionary",
248+
"npx lerna run codegen",
249+
"npx lerna run build",
250+
"sudo docker compose -p prod-astral-indexers -f /home/${var.ssh_user}/astral/docker-compose.yml -f /home/${var.ssh_user}/astral/docker-compose.prod.yml --profile dictionary --profile task --profile taurus up -d --remove-orphans",
238251
"echo 'Installation Complete'",
239252
]
240253
}

templates/terraform/subql/base/bootstrap_subql_provisioner.tf

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ resource "null_resource" "setup-green-subql-nodes" {
9191
# create subql dir
9292
provisioner "remote-exec" {
9393
inline = [
94-
"mkdir -p /home/${var.ssh_user}/subql",
95-
"mkdir -p /home/${var.ssh_user}/subql/postgresql",
96-
"mkdir -p /home/${var.ssh_user}/subql/postgresql/{conf,data}",
94+
"sudo mkdir -p /home/${var.ssh_user}/subql",
95+
"sudo mkdir -p /home/${var.ssh_user}/subql/postgresql",
96+
"sudo mkdir -p /home/${var.ssh_user}/subql/postgresql/conf",
97+
"sudo mkdir -p /home/${var.ssh_user}/subql/postgresql/data",
9798
"sudo chown -R ${var.ssh_user}:${var.ssh_user} /home/${var.ssh_user}/subql/ && sudo chmod -R 750 /home/${var.ssh_user}/subql/"
9899
]
99100
}
@@ -159,7 +160,6 @@ resource "null_resource" "start-blue-subql-nodes" {
159160
# run subql install script
160161
"chmod +x /home/${var.ssh_user}/subql/install_subql_stack.sh",
161162
"bash /home/${var.ssh_user}/subql/install_subql_stack.sh",
162-
"echo 'Installation Complete'",
163163

164164
# create .env file
165165
"grep -q '^NR_AGENT_IDENTIFIER=' /home/${var.ssh_user}/astral/.env && sed -i 's/^NR_AGENT_IDENTIFIER=.*/NR_AGENT_IDENTIFIER=subql-${var.blue-subql-node-config.deployment-color}-${var.blue-subql-node-config.network-name}/' /home/${var.ssh_user}/astral/.env || echo NR_AGENT_IDENTIFIER=subql-${var.blue-subql-node-config.deployment-color}-${var.blue-subql-node-config.network-name} >> /home/${var.ssh_user}/astral/.env",
@@ -169,6 +169,13 @@ resource "null_resource" "start-blue-subql-nodes" {
169169
"grep -q '^HASURA_GRAPHQL_ADMIN_SECRET=' /home/${var.ssh_user}/astral/.env && sed -i 's/^HASURA_GRAPHQL_ADMIN_SECRET=.*/HASURA_GRAPHQL_ADMIN_SECRET=${var.hasura_graphql_admin_secret}/' /home/${var.ssh_user}/astral/.env || echo HASURA_GRAPHQL_ADMIN_SECRET=${var.hasura_graphql_admin_secret} >> /home/${var.ssh_user}/astral/.env",
170170
"grep -q '^HASURA_GRAPHQL_JWT_SECRET=' /home/${var.ssh_user}/astral/.env && sed -i 's|^HASURA_GRAPHQL_JWT_SECRET=.*|HASURA_GRAPHQL_JWT_SECRET={\"type\":\"HS256\",\"key\":\"${var.hasura_graphql_jwt_secret}\"}|' /home/${var.ssh_user}/astral/.env || echo HASURA_GRAPHQL_JWT_SECRET={\"type\":\"HS256\",\"key\":\"${var.hasura_graphql_jwt_secret}\"} >> /home/${var.ssh_user}/astral/.env",
171171

172+
# run subql stack
173+
"export $(grep -v '^#' /home/${var.ssh_user}/astral/.env | xargs)",
174+
"cd /home/${var.ssh_user}/astral/indexers",
175+
"yarn build-dictionary",
176+
"npx lerna run codegen",
177+
"npx lerna run build",
178+
"sudo docker compose -p prod-astral-indexers -f /home/${var.ssh_user}/astral/docker-compose.yml -f /home/${var.ssh_user}/astral/docker-compose.prod.yml --profile dictionary --profile task --profile taurus up -d --remove-orphans",
172179
"echo 'Installation Complete'",
173180
]
174181
}
@@ -225,7 +232,6 @@ resource "null_resource" "start-green-subql-nodes" {
225232
# run subql install script
226233
"chmod +x /home/${var.ssh_user}/subql/install_subql_stack.sh",
227234
"bash /home/${var.ssh_user}/subql/install_subql_stack.sh",
228-
"echo 'Installation Complete'",
229235

230236
# create .env file
231237
"grep -q '^NR_AGENT_IDENTIFIER=' /home/${var.ssh_user}/astral/.env && sed -i 's/^NR_AGENT_IDENTIFIER=.*/NR_AGENT_IDENTIFIER=subql-${var.green-subql-node-config.deployment-color}-${var.green-subql-node-config.network-name}/' /home/${var.ssh_user}/astral/.env || echo NR_AGENT_IDENTIFIER=subql-${var.green-subql-node-config.deployment-color}-${var.green-subql-node-config.network-name} >> /home/${var.ssh_user}/astral/.env",
@@ -235,6 +241,13 @@ resource "null_resource" "start-green-subql-nodes" {
235241
"grep -q '^HASURA_GRAPHQL_ADMIN_SECRET=' /home/${var.ssh_user}/astral/.env && sed -i 's/^HASURA_GRAPHQL_ADMIN_SECRET=.*/HASURA_GRAPHQL_ADMIN_SECRET=${var.hasura_graphql_admin_secret}/' /home/${var.ssh_user}/astral/.env || echo HASURA_GRAPHQL_ADMIN_SECRET=${var.hasura_graphql_admin_secret} >> /home/${var.ssh_user}/astral/.env",
236242
"grep -q '^HASURA_GRAPHQL_JWT_SECRET=' /home/${var.ssh_user}/astral/.env && sed -i 's|^HASURA_GRAPHQL_JWT_SECRET=.*|HASURA_GRAPHQL_JWT_SECRET={\"type\":\"HS256\",\"key\":\"${var.hasura_graphql_jwt_secret}\"}|' /home/${var.ssh_user}/astral/.env || echo HASURA_GRAPHQL_JWT_SECRET={\"type\":\"HS256\",\"key\":\"${var.hasura_graphql_jwt_secret}\"} >> /home/${var.ssh_user}/astral/.env",
237243

244+
# run subql stack
245+
"export $(grep -v '^#' /home/${var.ssh_user}/astral/.env | xargs)",
246+
"cd /home/${var.ssh_user}/astral/indexers",
247+
"yarn build-dictionary",
248+
"npx lerna run codegen",
249+
"npx lerna run build",
250+
"sudo docker compose -p prod-astral-indexers -f /home/${var.ssh_user}/astral/docker-compose.yml -f /home/${var.ssh_user}/astral/docker-compose.prod.yml --profile dictionary --profile task --profile taurus up -d --remove-orphans",
238251
"echo 'Installation Complete'",
239252
]
240253
}

templates/terraform/subql/base/scripts/install_subql_stack.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,3 @@ git clone https://github.com/autonomys/astral.git
6161
cd astral/indexers
6262

6363
yarn install --frozen-lockfile
64-
65-
export $(grep -v '^#' ../.env | xargs) &&
66-
yarn build-dictionary &&
67-
npx lerna run codegen &&
68-
npx lerna run build &&
69-
sudo docker compose -p prod-astral-indexers \
70-
-f ../docker-compose.yml \
71-
-f ../docker-compose.prod.yml \
72-
--profile dictionary \
73-
--profile task \
74-
--profile taurus \
75-
up -d --remove-orphans

0 commit comments

Comments
 (0)