Skip to content

Commit 2ea6992

Browse files
committed
Update terraform deployment for verified signers
1 parent 00430e5 commit 2ea6992

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

mithril-infra/main.dns.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,24 @@ resource "google_dns_record_set" "mithril-aggregator-endpoint" {
1313
rrdatas = [google_compute_address.mithril-external-address.address]
1414
}
1515

16+
resource "google_dns_record_set" "mithril-signer-endpoint" {
17+
for_each = var.mithril_signers
18+
19+
name = "mithril-signer-${each.key}.${google_dns_managed_zone.mithril-api-zone.dns_name}"
20+
managed_zone = google_dns_managed_zone.mithril-api-zone.name
21+
type = "A"
22+
ttl = 300
23+
rrdatas = [google_compute_address.mithril-external-address.address]
24+
}
25+
1626
locals {
1727
mithril_aggregator_host = trimsuffix(google_dns_record_set.mithril-aggregator-endpoint.name, ".")
1828
mithril_aggregator_endpoint_url = format("https://%s/aggregator", local.mithril_aggregator_host)
29+
mithril_signers_host = {
30+
for key, signer in var.mithril_signers :
31+
key => "mithril-signer-${key}.${trimsuffix(google_dns_managed_zone.mithril-api-zone.dns_name, ".")}"
32+
}
33+
mithril_signers_endpoint_url = [for key, signer in var.mithril_signers :
34+
format("https://%s", "mithril-signer-${key}.${trimsuffix(google_dns_managed_zone.mithril-api-zone.dns_name, ".")}")
35+
]
1936
}

mithril-infra/mithril.bootstrap.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ done
3636
echo "Startup script complete!"
3737
EOT
3838
,
39-
"chmod u+x /home/curry/tools/*.sh",
39+
"find /home/curry/tools -name '*.sh' -type f | xargs chmod u+x",
4040
"rm -rf /home/curry/docker/cardano-configurations && git clone https://github.com/input-output-hk/cardano-configurations.git /home/curry/docker/cardano-configurations"
4141
]
4242
}

mithril-infra/mithril.signer.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
locals {
2+
mithril_signers_index = [for key, signer in var.mithril_signers : key]
3+
}
14
resource "null_resource" "mithril_signer" {
25
for_each = var.mithril_signers
36

@@ -22,6 +25,7 @@ resource "null_resource" "mithril_signer" {
2225
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/db",
2326
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/ipc",
2427
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/pool",
28+
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/cardano/www",
2529
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/mithril/stores",
2630
"mkdir -p /home/curry/data/${var.cardano_network}/mithril-signer-${each.key}/mithril/snapshots"
2731
]
@@ -33,6 +37,8 @@ resource "null_resource" "mithril_signer" {
3337
"export PARTY_ID=${each.value.pool_id}",
3438
"export NETWORK=${var.cardano_network}",
3539
"export IMAGE_ID=${var.mithril_image_id}",
40+
"export SIGNER_HOST=${local.mithril_signers_host[each.key]}",
41+
"export SIGNER_WWW_PORT=`expr 8080 + ${index(local.mithril_signers_index, each.key) + 1}`",
3642
"export CURRENT_UID=$(id -u)",
3743
"export DOCKER_GID=$(getent group docker | cut -d: -f3)",
3844
"docker-compose -p $SIGNER_ID -f /home/curry/docker/docker-compose-signer-${each.value.type}.yaml --profile all up -d",

mithril-infra/output.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ output "google_project" {
22
value = local.google_project_id
33
}
44

5-
output "aggregator_endpoint" {
5+
output "mithril_aggregator_endpoint" {
66
value = local.mithril_aggregator_endpoint_url
77
}
88

9+
output "mithril_signers_endpoint_url" {
10+
value = local.mithril_signers_endpoint_url
11+
}
12+
913
output "storage_bucket" {
1014
value = google_storage_bucket.cloud_storage.name
1115
}

0 commit comments

Comments
 (0)