Skip to content

Commit

Permalink
update readme, allocate elastic ip as part of setup
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrostr committed May 13, 2022
1 parent 7b2eb1a commit 360bb4c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Full Node BSC

## goal

spins up a geth full node for binance smart chain using teraform and ansible

### requirements

env vars:

```bash
export TF_VAR_AWS_ACCESS_KEY=""
export TF_VAR_AWS_SECRET_KEY=""
export TF_VAR_SSH_PASSWORD="" # to be used on logins without ssh keypair
export TF_VAR_REGION=""
```

- aws-cli
- terraform
- ansible
- jq (for parsing json)

ssh keys (`~/.ssh/id_rsa` and `~/.ssh/id_rsa.pub`)

### setup

get an ip address alocated and append to ansible hosts, export the address to env

```bash
aws ec2 allocate-address > /etc/allocated-address
export BSC_NODE_IP=$(cat /etc/allocated-address | jq -r ".PublicIp")
export TF_VAR_ALLOCATION_ID=$(cat /etc/allocated-address | jq -r ".AllocationId")
echo $BSC_NODE_IP >> /etc/ansible/hosts
```

in case one would prefer to maintain the same address, the setting of the `BSC_NODE_IP`
and `TF_VAR_ALLOCATION_ID` variables can be appended to ~/.profile or ~/.bashrc

### usage

start the instance

```bash
terraform init && terraform apply
ssh -i ~/.ssh/id_rsa ubuntu@$BSC_NODE_IP
```

```bash
git clone https://github.com/ethereum/go-ethereum
```
6 changes: 6 additions & 0 deletions ansible/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: First Task
hosts: all
tasks:
- name: Leaving a mark
command: "touch /tmp/mark"
3 changes: 1 addition & 2 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ variable "SSH_PASSWORD" {

variable "ALLOCATION_ID" {
type = string
sensitive = false
default = "eipalloc-0c57be50bb3a7471b"
sensitive = true
}

0 comments on commit 360bb4c

Please sign in to comment.