Skip to content

Commit

Permalink
Merge branch 'main' into lemmih/terraform-dev-environment
Browse files Browse the repository at this point in the history
  • Loading branch information
lemmih authored Oct 16, 2023
2 parents 0fb6863 + b8ff114 commit 0a82ae6
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 297 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/deploy-lotus-mainnet.yml

This file was deleted.

16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ That's it! From now on, every time you commit changes to your project, these hoo
## Overview
The Terraform folder contains terraform scripts to automate the setup of droplets on DigitalOcean. These scripts enable the configuration of essential infrastructure required for running Forest Mainnet, Calibnet, or Lotus Mainnet nodes. The script automates several steps, including:
The Terraform folder contains terraform scripts to automate the setup of droplets on DigitalOcean. These scripts enable the configuration of essential infrastructure required for running Forest Mainnet or Calibnet Filecoin node. The script automates several steps, including:
- Booting up a New Droplet: It initializes a new droplet with specified parameters such as image, name, region, and size.
- Volume Attachment (optional): The script can optionally attach a storage volume to the droplet if the user specifies so (attach_volume variable set to true). This feature primarily runs on the Mainnet but can also be applied to the Calibnet if set to true. To ensure compliance with device identifier restrictions on DigitalOcean, any "-" characters in the volume name are automatically replaced with "_" when mounting the volume on the droplet.
- Volume Attachment (optional): The script can optionally attach a storage volume to the droplet if the user specifies so (attach_volume variable set to false). To ensure compliance with device identifier restrictions on DigitalOcean, any "-" characters in the volume name are automatically replaced with "_" when mounting the volume on the droplet.
- Running Initialization Script: The `user-data.sh` or `lotus.sh` script is executed during the droplet's initialization. This script is powered by the Terraform engine and allows dynamic insertion of variables from the `terraform.tfvars` file. It handles crucial tasks such as creating a new user, configuring SSH settings, restricting SSH access, and managing Docker-related setups. Its purpose is to specifically run the Mainnet or Calibnet chain based on the specifications provided in the Terraform script. Additionally, it initializes Watchtower to ensure the Forest images are up to date and configures the New Relic infrastructure agent and Openmetrics New Relic container exclusively on the forest nodes.
- Running Initialization Script: The `user-data.sh` script is executed during the droplet's initialization. This script is powered by the Terraform engine and allows dynamic insertion of variables from the `terraform.tfvars` file. It handles crucial tasks such as creating a new user, configuring SSH settings, restricting SSH access, and managing Docker-related setups. Its purpose is to specifically run the Mainnet or Calibnet chain based on the specifications provided in the Terraform script. Additionally, it initializes Watchtower to ensure the Forest images are up to date and configures the New Relic infrastructure agent and Openmetrics New Relic container exclusively on the forest nodes.

## Requirements
The droplet requirements to run Forest Mainnet, Calibnet or lotus mainnet nodes include:
The droplet requirements to run Forest Mainnet or Calibnet nodes include:
- RAM: 8GB
- VCPU: 1
- Disk Size: >100 GB
Expand All @@ -74,7 +74,7 @@ The user's local machine requirements include the following:
To implement the infrastructure, run the following:
- Create an `ssh-key` to be added to the DigitalOcean list and store the fingerprint for use in the next few steps; you can check more details [here](https://docs.digitalocean.com/products/droplets/how-to/add-ssh-keys/to-team/)
- Create a space on DigitalOcean with any preferred unique name, then add the bucket name and endpoint to the `backend.tf` file located in the `forest-mainnet`, `forest-calibnet` or `lotus-mainnet` directory, depending on which one you plan to run.
- Create a space on DigitalOcean with any preferred unique name, then add the bucket name and endpoint to the `backend.tf` file located in the `forest-mainnet` or `forest-calibnet` directory, depending on which one you plan to run.
- Generate `digitalocean_api_token` from DigitalOcean console; you can check [here](https://docs.digitalocean.com/reference/api/create-personal-access-token/) for more details.
Expand All @@ -95,11 +95,11 @@ export TF_VAR_NR_LICENSE_KEY=
```
Then save the file and restart the terminal for the changes to take effect.

- Navigate to the terraform directory and run `make init_calib` for calibnet, `make init_main` for mainnet, or `make init_lt_main` for lotus mainnet to initialize and verify variables.
- Navigate to the terraform directory and run `make init_calib` for calibnet or `make init_main` for mainnet to initialize and verify variables.

- Run `make plan_calib` for calibnet, `make plan_main` for mainnet, or `make plan_lt_main` for lotus mainnet in the terraform directory to view all the configured resources.
- Run `make plan_calib` for calibnet, or `make plan_main` for mainnet, or `make plan_lt_main` in the terraform directory to view all the configured resources.

- To create the infrastructure, run `make apply_calib` for calibnet, `make apply_main` for mainnet, or `make apply_lt_main` for lotus mainnet in the terraform directory.
- To create the infrastructure, run `make apply_calib` for calibnet, or `make apply_main` for mainnet in the terraform directory.

## Collaborators
Feel free to contribute to the codebase by resolving any open issues, refactoring, adding new features, writing test cases, or any other way to make the project better and helpful to the community. Feel free to fork and send pull requests.
Expand Down
23 changes: 5 additions & 18 deletions terraform/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
TF = terraform
TF_MAIN_DIR = forest-mainnet
TF_CALIB_DIR = forest-calibnet
TF_LT_MAIN_DIR = lotus-mainnet

# Define the default target
.DEFAULT_GOAL := help
Expand All @@ -11,11 +10,11 @@ help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " init_calib, init_main, or init_lt_main Initialize Terraform for either Forest mainnet, calibnet, or lotus mainnet"
@echo " plan_calib, plan_main, or plan_lt_main Generate and show an execution plan for either Forest mainnet, calibnet, or lotus mainnet"
@echo " apply_main, apply_calib, or apply_lt_main Apply the changes for either Forest mainnet, calibnet, or lotus mainnet"
@echo " destroy_main, destroy_calib or destroy_lt_main Destroy the Terraform-managed infrastructure for either Forest mainnet, calibnet, or lotus mainnet"
@echo " help Shows this help message"
@echo " init_calib or init_main Initialize Terraform for either Forest mainnet or calibnet"
@echo " plan_calib or plan_main Generate and show an execution plan for either Forest mainnet or calibnet"
@echo " apply_main or apply_calib Apply the changes for either Forest mainnet or calibnet"
@echo " destroy_main or destroy_calib Destroy the Terraform-managed infrastructure for either Forest mainnet or calibnet"
@echo " help Shows this help message"

init_calib:
@cd $(TF_CALIB_DIR) && $(TF) init
Expand All @@ -40,15 +39,3 @@ apply_main:

destroy_main:
@cd $(TF_MAIN_DIR) && $(TF) destroy

init_lt_main:
@cd $(TF_LT_MAIN_DIR) && $(TF) init

plan_lt_main:
@cd $(TF_LT_MAIN_DIR) && $(TF) plan

apply_lt_main:
@cd $(TF_LT_MAIN_DIR) && $(TF) apply --auto-approve

destroy_lt_main:
@cd $(TF_LT_MAIN_DIR) && $(TF) destroy
46 changes: 0 additions & 46 deletions terraform/lotus-mainnet/.terraform.lock.hcl

This file was deleted.

37 changes: 0 additions & 37 deletions terraform/lotus-mainnet/main.tf

This file was deleted.

20 changes: 0 additions & 20 deletions terraform/lotus-mainnet/variables.tf

This file was deleted.

127 changes: 0 additions & 127 deletions terraform/modules/filecoin_node/lotus.sh

This file was deleted.

2 changes: 1 addition & 1 deletion terraform/modules/filecoin_node/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This terraform script executes the following steps:
# - Boot a New droplet for the Mainnet or Calibnet chain
# - Attach a volume to the droplet if Attach volume is set to true
# - Run the user-data.sh or lotus.sh script at the initialization of the new droplet
# - Run the user-data.sh at initialization of the new droplet

terraform {
required_version = "~> 1.3"
Expand Down

0 comments on commit 0a82ae6

Please sign in to comment.