|
| 1 | + |
| 2 | +resource "null_resource" "mithril_aggregator" { |
| 3 | + depends_on = [ |
| 4 | + null_resource.mithril_reverse_proxy |
| 5 | + ] |
| 6 | + |
| 7 | + triggers = { |
| 8 | + image_id = var.mithril_image_id |
| 9 | + } |
| 10 | + |
| 11 | + connection { |
| 12 | + type = "ssh" |
| 13 | + user = "curry" |
| 14 | + private_key = local.google_service_account_private_key |
| 15 | + host = google_compute_address.mithril-external-address.address |
| 16 | + } |
| 17 | + |
| 18 | + provisioner "remote-exec" { |
| 19 | + inline = [ |
| 20 | + "mkdir -p /home/curry/data/${var.cardano_network}", |
| 21 | + "mkdir -p /home/curry/data/${var.cardano_network}/mithril-aggregator/cardano/db", |
| 22 | + "mkdir -p /home/curry/data/${var.cardano_network}/mithril-aggregator/cardano/ipc", |
| 23 | + "mkdir -p /home/curry/data/${var.cardano_network}/mithril-aggregator/mithril/stores", |
| 24 | + "mkdir -p /home/curry/data/${var.cardano_network}/mithril-aggregator/mithril/snapshots" |
| 25 | + ] |
| 26 | + } |
| 27 | + |
| 28 | + provisioner "remote-exec" { |
| 29 | + inline = [ |
| 30 | + "export NETWORK=${var.cardano_network}", |
| 31 | + "export IMAGE_ID=${var.mithril_image_id}", |
| 32 | + "export AGGREGATOR_HOST=${local.mithril_aggregator_host}", |
| 33 | + "export GOOGLE_APPLICATION_CREDENTIALS_JSON='${var.google_application_credentials_json}'", |
| 34 | + "export GENESIS_VERIFICATION_KEY=$(wget -q -O - ${var.mithril_genesis_verification_key_url})", |
| 35 | + "export GENESIS_SECRET_KEY='${var.mithril_genesis_secret_key}'", |
| 36 | + "export CURRENT_UID=$(id -u)", |
| 37 | + "export DOCKER_GID=$(getent group docker | cut -d: -f3)", |
| 38 | + "docker-compose -f /home/curry/docker/docker-compose-aggregator.yaml --profile all up -d", |
| 39 | + ] |
| 40 | + } |
| 41 | +} |
0 commit comments