You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update aws hydra head opening instructions (#2163)
<!-- Describe your change here -->
---
<!-- Consider each and tick it off one way or the other -->
* [x] CHANGELOG updated or not needed
* [x] Documentation updated or not needed
* [x] Haddocks updated or not needed
* [ ] No new TODOs introduced or explained herafter
Copy file name to clipboardExpand all lines: sample-node-config/aws/README.md
+80-32Lines changed: 80 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,46 +8,54 @@
8
8
This directory contains some [Terraform](https://www.hashicorp.com/products/terraform) and AWS based infrastructure code to setup a single [Hydra node](https://hydra.family/head-protocol/docs/getting-started/installation) connected to a [Cardano node](https://docs.cardano.org/getting-started/installing-the-cardano-node) running on `preview` testnet. It's not a complete turnkey solution and requires some tweaking and parameterisation to be completely usable but we thought it would be good starting point for new Hydra users.
9
9
10
10
### Pre-requisites
11
-
- you have access to an aws account with root privileges.
12
-
- you have configured your local aws credentials.
13
-
for this examplein `~/.aws/credentials` we have:
11
+
1.**AWS Account**: You need access to an AWS account with privileges to create EC2 instances and related resources.
12
+
2.**AWS CLI & Terraform**: You must have the [AWS CLI](https://aws.amazon.com/cli/) and [Terraform](https://developer.hashicorp.com/terraform/downloads) installed and configured on your local machine.
13
+
3.**AWS Credentials File**: Your local AWS credentials should be configured. For this example, we assume a profile in `~/.aws/credentials`:
14
14
```
15
15
[personal]
16
16
aws_access_key_id=???
17
17
aws_secret_access_key=???
18
18
region=eu-west-3
19
19
```
20
-
> **personal** will be your AWS_PROFILE
21
-
> so whenever you see _personal_ in the rest of the file you need to replace it with your own aws profile name.
20
+
4. **EC2 Key Pair**: You must create an EC2 Key Pair in the AWS region you intend to use. When you create it, AWS will provide a `.pem` file. **Download and save this file securely.** You will need its name for the configuration.
21
+
> Here and later we refer to your `AWS_PROFILE` name as **personal**.
22
+
> Whenever you see _personal_ in the rest of the file you need to replace it with your own aws profile name.
22
23
> Also you need to make sure to create a new key pair in the region eu-west-3 (TODO: abstract the region away?)
23
24
> TODO: it would be cool to use aws_ssm to connect to the EC2 so that we don't depend on extra ssh keys manipulations.
24
25
25
-
- you have terraform and aws installed on your system.
26
-
- you have built the required 2 folder structures under aws folder:
27
-
+ credentials.
28
-
+ aws.
26
+
### Project Setup
27
+
Before running Terraform, you need to create a specific directory and file structure within the `sample-node-config/aws/` directory.
29
28
30
-
## Project structure to build
29
+
1. **Create Directories**:
30
+
- `credentials/`: This will store your Cardano-related keys.
31
+
- `aws/`: This will store your EC2 `.pem` file.
32
+
33
+
2. **Place Your Key**: Copy the `.pem` file you downloaded from AWS into the `aws/` directory. For example: `aws/my-key.pem`.
34
+
35
+
3. **Generate Cardano Keys**: Create your Cardano keys and place them in the `credentials/` directory. You should have at least `cardano.addr`, `cardano-key.sk`, and `hydra-key.sk`.
36
+
37
+
The final structure should look like this:
31
38
```
32
39
.
33
-
+-- credentials
34
-
| +-- arnaud.cardano.vk
35
-
| +-- arnaud.hydra.vk
40
+
+-- credentials/
41
+
| +-- cardano.addr
36
42
| +-- cardano-key.sk
37
43
| +-- cardano-key.vk
38
-
| +-- cardano.addr
39
44
| +-- hydra-key.sk
40
45
| +-- hydra-key.vk
41
46
+-- aws
42
47
| +-- personal.pem
43
48
+-- terraform.tfvars
49
+
+-- (other *.tf files)
44
50
```
45
51
46
52
This should only be done once, when starting afresh.
47
53
48
-
These are folders you must create yourself:
49
-
-***credentials*** to store all blockchain related credential files.
50
-
-***aws*** to store your personal aws credentials.
54
+
TODO: refer to how to generate addresses and .sk, .vk files.
55
+
56
+
### Terraform Configuration
57
+
58
+
Instead of altering `variables.tf`, you should specify your custom values in a `terraform.tfvars` file at the root of the `sample-node-config/aws/` directory.
51
59
52
60
At the root of the `aws` project, execute:
53
61
```sh
@@ -56,21 +64,45 @@ $ ./setup/setup.sh
56
64
[Note] all scripts inside the `/setup` folder are expected to be executed at the root of the `aws` project.
57
65
58
66
This will create a file called `terraform.tfvars`, used to complete the `variables.tf` definitions. For this example it would be defined as:
59
-
```
67
+
```toml
68
+
# The AWS profile name from your ~/.aws/credentials file.
60
69
profile = "iog"
70
+
# The name of the EC2 Key Pair you created in the AWS console.
71
+
# This must match the name of the key pair, not the filename.
61
72
key_name = "personal"
62
73
```
63
74
64
75
## Initialise Terraform
76
+
65
77
This should only be done once, when starting afresh.
66
78
At the root of `aws` project execute:
79
+
67
80
```sh
68
-
$ terraform init
81
+
terraform init
69
82
```
70
83
71
84
### Alter terraform variables
85
+
86
+
Instead of altering `variables.tf`, you should specify your custom values in a `terraform.tfvars` file at the root of the `sample-node-config/aws/` directory.
72
87
Alter the file `variables.tf` found in `sample-node-config/aws/` to reflect your ami, region and instance_type. Defaults are already provided.
73
88
89
+
Example
90
+
```toml
91
+
# The AWS profile from your `~/.aws/credentials` file.
92
+
profile = "default"
93
+
# The name of the EC2 Key Pair you created in the AWS Console for your chosen region.
94
+
key_name = "hydra-node-key"
95
+
# The hydra network environment to use. Can be "preview", "preprod", or "mainnet".
96
+
env = "preview"
97
+
# The AWS region where you created your key pair and want to deploy resources.
98
+
region = "eu-central-1"
99
+
# The Amazon Machine Image (AMI) ID for a recent Ubuntu release in your chosen region.
100
+
# You can find this in the AWS EC2 Console when launching a new instance.
101
+
ami = "ami-012345fxxxxxxxx"
102
+
# The type of EC2 instance to launch.
103
+
instance_type = "r5a.xlarge"
104
+
```
105
+
74
106
### Deploying the VM
75
107
Then create a deployment plan and apply it:
76
108
```sh
@@ -129,26 +161,38 @@ $ scripts/login.sh
129
161
- ctrl B + D: detach session
130
162
- tmux a: attach the detached-session
131
163
164
+
```shell
165
+
source~/.bash_env
166
+
```
167
+
132
168
## Create marker utxo: get fuel from testnet
133
169
Now that you are logged in to your VM, first thing we need is to spin up your `cardano-node` and create the marker utxo.
134
-
For that we will need to execute:
170
+
171
+
172
+
For that we will need to executea docker command. First, go to the `docker folder:
173
+
```shell
174
+
cd docker
135
175
```
176
+
177
+
and then:
178
+
```shell
136
179
$ docker-compose up -d cardano-node
137
180
$ fuel
138
181
```
139
182
140
183
## Configuring Hydra Node
184
+
141
185
We need to make sure some files, which are not provided by default and which are required for starting the `hydra-node`, are in place at the home folder of your VM:
142
186
* A Hydra signing key file `hydra-key.sk` which will be used in the Head to sign snapshots.
143
-
This can be generated using [hydra-node](https://hydra.family/head-protocol/docs/getting-started/quickstart#hydra-keys),
187
+
This can be generated using [hydra-node](https://hydra.family/head-protocol/docs/configuration#hydra-keys),
144
188
* A cardano signing key file `cardano-key.sk` which is required to identify the parties on-chain and sign transactions.
145
-
This is a standard Cardano key so one can reuse an existing key or [generate a new one](https://hydra.family/head-protocol/docs/getting-started/quickstart#cardano-keys),
189
+
This is a standard Cardano key so one can reuse an existing key or [generate a new one](https://hydra.family/head-protocol/docs/configuration#cardano-keys),
146
190
* 0 or more hydra verification keys and cardano verification keys for the other Head parties,
147
191
* The IP addresses and ports of _peer_ nodes,
148
192
* Configuration files for [promtail](https://grafana.com/docs/loki/latest/clients/promtail/) and [prometheus](https://prometheus.io/) which are run as part of the stack,
149
193
* Configuration files for the off-chain ledger.
150
194
151
-
Then the [docker-compose.yaml](./docker/docker-compose.yaml) should be edited to reflect the above parameters as [command-line arguments](https://hydra.family/head-protocol/docs/getting-started/quickstart) to the `hydra-node` container.
195
+
Then the [docker-compose.yaml](./docker/docker-compose.yaml) should be edited to reflect the above parameters as [command-line arguments](https://hydra.family/head-protocol/docs/configuration) to the `hydra-node` container.
152
196
153
197
i.e.:
154
198
```
@@ -162,23 +206,26 @@ The [promtail-config.yml](./docker/promtail-config.yml) should be edited to poin
162
206
For `cardano-node` and `hydra-node` services, make sure the `logging` options for `awslogs` are properly aligned with what is defined in your `cloudwatch.tf` and `variables.tf` files.
163
207
164
208
## Running the hydraw instance
209
+
165
210
Next, to run hydraw, execute:
166
-
```
167
-
$ up
211
+
212
+
```sh
213
+
up
168
214
```
169
215
170
216
> execute `down` to take it down
171
217
172
218
## Opening the Head
173
219
Finally, execute the hydra-tui and open the head:
174
-
```
175
-
$ tui
220
+
221
+
```sh
222
+
tui
176
223
```
177
224
178
225
> If you take down your hydra-node instance once the head is open. you will loose access to your funds committed to the head.
179
-
To get them back, currently you need to start the head from a point time in the past.
180
-
For that you must run hydra-node the using parameter `--start-chain-from`.
0 commit comments