From feaebf20903c09973f2c3aefa48e4dd0dd879535 Mon Sep 17 00:00:00 2001 From: Felipe Gonzalez Date: Fri, 8 Nov 2024 16:55:33 -0300 Subject: [PATCH] fix: Bootstrapping (#21) --- bootstrap/cell/variables.tf | 10 +---- bootstrap/configs/cardano-mainnet.toml | 1 + bootstrap/configs/cardano-preprod.toml | 1 + bootstrap/configs/cardano-preview.toml | 1 + bootstrap/instance/main.tf | 2 +- bootstrap/instance/sts.tf | 51 ++++++++++++-------------- bootstrap/main.tf | 6 +-- 7 files changed, 31 insertions(+), 41 deletions(-) diff --git a/bootstrap/cell/variables.tf b/bootstrap/cell/variables.tf index 5a44a26..abeaed4 100644 --- a/bootstrap/cell/variables.tf +++ b/bootstrap/cell/variables.tf @@ -6,14 +6,6 @@ variable "salt" { type = string } -variable "extension_subdomain" { - type = string -} - -variable "dns_zone" { - default = "demeter.run" -} - variable "storage_size" { type = string } @@ -31,7 +23,7 @@ variable "tolerations" { effect = string key = string operator = string - value = string + value = optional(string) })) default = [ { diff --git a/bootstrap/configs/cardano-mainnet.toml b/bootstrap/configs/cardano-mainnet.toml index cccaca8..359823c 100644 --- a/bootstrap/configs/cardano-mainnet.toml +++ b/bootstrap/configs/cardano-mainnet.toml @@ -10,6 +10,7 @@ path = "/var/data/mainnet/db" byron_path = "/etc/genesis/mainnet/byron.json" shelley_path = "/etc/genesis/mainnet/shelley.json" alonzo_path = "/etc/genesis/mainnet/alonzo.json" +conway_path = "/etc/genesis/mainnet/conway.json" [sync] pull_batch_size = 100 diff --git a/bootstrap/configs/cardano-preprod.toml b/bootstrap/configs/cardano-preprod.toml index 4bc3610..ad022fb 100644 --- a/bootstrap/configs/cardano-preprod.toml +++ b/bootstrap/configs/cardano-preprod.toml @@ -10,6 +10,7 @@ path = "/var/data/preprod/db" byron_path = "/etc/genesis/preprod/byron.json" shelley_path = "/etc/genesis/preprod/shelley.json" alonzo_path = "/etc/genesis/preprod/alonzo.json" +conway_path = "/etc/genesis/preprod/conway.json" [sync] pull_batch_size = 100 diff --git a/bootstrap/configs/cardano-preview.toml b/bootstrap/configs/cardano-preview.toml index 4630b4d..c34d26e 100644 --- a/bootstrap/configs/cardano-preview.toml +++ b/bootstrap/configs/cardano-preview.toml @@ -10,6 +10,7 @@ path = "/var/data/preview/db" byron_path = "/etc/genesis/preview/byron.json" shelley_path = "/etc/genesis/preview/shelley.json" alonzo_path = "/etc/genesis/preview/alonzo.json" +conway_path = "/etc/genesis/preview/conway.json" [sync] pull_batch_size = 100 diff --git a/bootstrap/instance/main.tf b/bootstrap/instance/main.tf index fb649d9..85c5e17 100644 --- a/bootstrap/instance/main.tf +++ b/bootstrap/instance/main.tf @@ -33,7 +33,7 @@ variable "tolerations" { effect = string key = string operator = string - value = string + value = optional(string) })) default = [ { diff --git a/bootstrap/instance/sts.tf b/bootstrap/instance/sts.tf index e3cb073..770b837 100644 --- a/bootstrap/instance/sts.tf +++ b/bootstrap/instance/sts.tf @@ -28,33 +28,30 @@ resource "kubernetes_stateful_set_v1" "utxorpc" { } } spec { - # @TODO: once the bootstrap command works in non-interactive, we can restore this. - # init_container { - # name = "init" - # image = "ghcr.io/txpipe/dolos:${var.dolos_version}" - # # command = ["sleep", "infinity"] - # args = [ - # "-c", - # "/etc/config/dolos.toml", - # "bootstrap", - # "--download-dir", - # "/var/data/${var.network}/snapshot", - # "--skip-if-not-empty", - # # "--skip-download", - # ] - # resources { - # limits = var.resources.limits - # requests = var.resources.requests - # } - # volume_mount { - # name = "config" - # mount_path = "/etc/config" - # } - # volume_mount { - # name = "data" - # mount_path = "/var/data" - # } - # } + init_container { + name = "init" + image = "ghcr.io/txpipe/dolos:${var.dolos_version}" + args = [ + "-c", + "/etc/config/dolos.toml", + "bootstrap", + "snapshot", + "--variant", + "full" + ] + resources { + limits = var.resources.limits + requests = var.resources.requests + } + volume_mount { + name = "config" + mount_path = "/etc/config" + } + volume_mount { + name = "data" + mount_path = "/var/data" + } + } container { name = local.instance image = "ghcr.io/txpipe/dolos:${var.dolos_version}" diff --git a/bootstrap/main.tf b/bootstrap/main.tf index f0beba1..dcb8177 100644 --- a/bootstrap/main.tf +++ b/bootstrap/main.tf @@ -68,10 +68,8 @@ module "cells" { for_each = var.cells source = "./cell" - namespace = var.namespace - salt = each.key - extension_subdomain = var.extension_subdomain - dns_zone = var.dns_zone + namespace = var.namespace + salt = each.key tolerations = coalesce(each.value.tolerations, [ { effect = "NoSchedule"