diff --git a/main.tf b/main.tf index 46c8843..c59b3b1 100644 --- a/main.tf +++ b/main.tf @@ -406,6 +406,7 @@ module "ec2_asg_stats" { postgres_password = var.deploy_rds_db ? module.rds[0].db_instance_password : var.blockscout_settings["postgres_password"] postgres_user = var.deploy_rds_db ? module.rds[0].db_instance_username : var.blockscout_settings["postgres_user"] postgres_host = var.deploy_rds_db ? module.rds[0].db_instance_address : module.ec2_database[0].private_dns + create_database = var.stats_create_database } tags = local.final_tags } @@ -436,7 +437,8 @@ module "ec2_asg_eth_bytecode_db" { postgres_password = var.deploy_rds_db ? module.rds[0].db_instance_password : var.blockscout_settings["postgres_password"] postgres_user = var.deploy_rds_db ? module.rds[0].db_instance_username : var.blockscout_settings["postgres_user"] postgres_host = var.deploy_rds_db ? module.rds[0].db_instance_address : module.ec2_database[0].private_dns - verifier_url = var.verifier_enabled ? (var.verifier_url != "" ? var.verifier_url : module.alb_verifier[0].lb_dns_name) : var.verifier_url + verifier_url = var.verifier_enabled ? (var.verifier_url != "" ? var.verifier_url : "http://${module.alb_verifier[0].lb_dns_name}") : var.verifier_url + create_database = var.eth_bytecode_db_create_database } tags = local.final_tags } diff --git a/templates/docker_compose_eth-bytecode-db.tftpl b/templates/docker_compose_eth-bytecode-db.tftpl index 4af2c00..cc15849 100644 --- a/templates/docker_compose_eth-bytecode-db.tftpl +++ b/templates/docker_compose_eth-bytecode-db.tftpl @@ -1,7 +1,7 @@ version: '3.8' services: - sig-provider: - container_name: 'stats' + eth-bytecode-db: + container_name: 'eth-bytecode-db' image: ${docker_image} restart: always environment: @@ -11,6 +11,7 @@ services: ETH_BYTECODE_DB__SERVER__HTTP__MAX_BODY_SIZE: 10485760 ETH_BYTECODE_DB__TRACING__FORMAT: "json" ETH_BYTECODE_DB__VERIFIER__URI: '${verifier_url}' + ETH_BYTECODE_DB__DATABASE__CREATE_DATABASE: "${create_database}" RUST_LOG : info ports: - 8050:8050 diff --git a/templates/docker_compose_stats.tftpl b/templates/docker_compose_stats.tftpl index 1b0ecc4..aa9cd88 100644 --- a/templates/docker_compose_stats.tftpl +++ b/templates/docker_compose_stats.tftpl @@ -1,6 +1,6 @@ version: '3.8' services: - sig-provider: + stats: container_name: 'stats' image: ${docker_image} restart: always @@ -11,6 +11,7 @@ services: STATS__METRICS__ENABLED: "true" STATS__RUN_MIGRATIONS: "true" STATS__TRACING__FORMAT: "json" + STATS__CREATE_DATABASE: "${create_database}" ports: - 8050:8050 - 8051:8051 diff --git a/terraform.tf b/terraform.tf index c7c5550..cd2e407 100644 --- a/terraform.tf +++ b/terraform.tf @@ -2,7 +2,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.39.0" + version = ">= 4.64.0" } random = { source = "hashicorp/random" diff --git a/variables.tf b/variables.tf index 819a55a..4670166 100644 --- a/variables.tf +++ b/variables.tf @@ -44,7 +44,7 @@ variable "user" { variable "image_name" { description = "OS image mask" type = string - default = "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*" + default = "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-202304*" } variable "image_owner" { description = "ID of image owner" @@ -257,6 +257,11 @@ variable "stats_docker_image" { type = string default = "ghcr.io/blockscout/stats:main" } +variable "stats_create_database" { + description = "Create database in application start" + type = bool + default = true +} ## eth-bytecode-db settings variable "eth_bytecode_db_enabled" { @@ -284,3 +289,8 @@ variable "verifier_url" { type = string default = "" } +variable "eth_bytecode_db_create_database" { + description = "Create database in application start" + type = bool + default = true +} \ No newline at end of file