-
-
Save matilote/c1ec9955edc3c2140f6e52eb092376f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "digitalocean_droplet" "node" { | |
image = "ubuntu-20-04-x64" | |
name = "${var.hostname}-${var.TF_VAR_chain}" | |
region = "lon1" | |
size = "s-2vcpu-4gb" | |
ssh_keys = flatten([ | |
var.ssh_fingerprint | |
]) | |
connection { | |
user = "root" | |
type = "ssh" | |
private_key = "${file(var.pvt_key)}" | |
timeout = "2m" | |
host = self.ipv4_address | |
} | |
provisioner "remote-exec" { | |
inline = [ | |
"export PATH=$PATH:/usr/bin", | |
"sudo apt-get update", | |
"sudo apt-get install -y docker.io", | |
"git clone https://github.com/NethermindEth/nethermind.git", | |
"cd nethermind/", | |
"git checkout ${var.TF_VAR_tag}", | |
"sudo sed -i '14s|.*|ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:4111|' /lib/systemd/system/docker.service", | |
"sudo systemctl daemon-reload", | |
"sudo systemctl restart docker", | |
"docker build -t nethermind .", | |
"docker run -itd --network host --name nethermind -v /root/logs:/nethermind/logs nethermind --config ${var.TF_VAR_chain} --JsonRpc.Enabled true --JsonRpc.Host 0.0.0.0 --Metrics.Enabled true --Metrics.NodeName 'SMOKE ${var.TF_VAR_chain} ${var.TF_VAR_tag}' --Metrics.PushGatewayUrl ${var.gateway}", | |
] | |
} | |
} | |
resource "local_file" "node_ip" { | |
content = "${digitalocean_droplet.node.ipv4_address}" | |
filename = "node_ip.txt" | |
} | |
output "public_ip" { | |
description = "output the public ip of provider instance" | |
value = "${digitalocean_droplet.node.ipv4_address}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment