Skip to content

Add Terraform and Nixops deployment files#1

Merged
bolt12 merged 5 commits intomasterfrom
bolt12/deploy
Jul 11, 2022
Merged

Add Terraform and Nixops deployment files#1
bolt12 merged 5 commits intomasterfrom
bolt12/deploy

Conversation

@bolt12
Copy link
Copy Markdown
Contributor

@bolt12 bolt12 commented May 26, 2022

Note: Please read the README for a thorough guide line on the whole deployment process.

This PR refurbishes the current deployment process of IOHK's networking team. Brief summary of the highlights:

  • All machines should now run NixOS. This is going to be good to have a higher level of detail while managing the OS configuration; we are going to have rollbacks and cached builds, not to mention higher reproducibility and more flexibility when managing different versions of cardano-node.
  • Automated AWS instances deployment with Terraform. Eventually this part of the process can be absorbed into either Nixops or vice-versa.
    • Currently due to the current situation with NixOS AMIs in the regions we want to launch nodes (which has already been patched), we need to upload our own NixOS images to these regions. The current Terraform deployment process is capable of handling that, although it should be just a matter of time before we can remove this from the process.
  • Automated NixOS deployments to AWS instances with NixOps. This allows us to quickly monitorize, maintain and deploy fined-tuned NixOS configurations to our NixOS machines. We are able to declaratively start two instances of cardano-node (1 mainnet and 1 testnet) and customize, if needed, each one.

As one could understand the deployment process consists on 2 phases: Terraform deployment and Nixops deployment. The Terraform deployment process depends on a particular patch of this script file which is not included in this PR because one would have to fork the entirety of the Nixpkgs repository to do so. A better solution would be to clone the repository and apply the patch locally in the machine that is going to perform the deployment. This is needed for the reasons mentioned above and detailed in the README.

@bolt12 bolt12 requested review from coot and njd42 May 26, 2022 16:50
@bolt12
Copy link
Copy Markdown
Contributor Author

bolt12 commented May 27, 2022

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread dev-deployer-terraform/main.tf Outdated
Comment thread dev-deployer-terraform/modules/multi-region/main.tf Outdated
Comment thread dev-deployer-terraform/modules/multi-region/main.tf Outdated
Comment thread dev-deployer-terraform/modules/multi-region/main.tf
Comment on lines +18 to +25
af-south-1 = "";
us-west-1 = "";
sa-east-1 = "";
us-east-2 = "";
ap-southeast-1 = "";
ap-southeast-2 = "";
ap-northeast-1 = "";
eu-west-3 = "";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terraform run:

terraform show -json | jq '.values.root_module.child_modules[].resources[].values | "\(.availability_zone) : \(.public_ip)"' | grep -v "null : null"

to a file and import it here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately I don't think this can be done reliably due to the existence of availability zones. For example the output of the command above looks something like:

"af-south-1b : ..."
"us-west-1c : ..."
"eu-west-3c : ..."
"us-east-2c : ..."
"ap-southeast-2c : ..."
"ap-southeast-1a : ..."
"sa-east-1c : ..."
"ap-northeast-1d : ..."

so there's information about the Region + Availability Zone and from what I gathered these are logical and can depend from user to user. So I am not sure these can change throughout the time.

Comment thread dev-deployer-nixops/network.nix
Comment thread dev-deployer-nixops/network.nix Outdated
Small refactor of the Terraform configuration. It now fetches the AMI ids automatically.

Small refactor of the nixops configuration
@bolt12 bolt12 merged commit 7d1e51e into master Jul 11, 2022
@coot coot deleted the bolt12/deploy branch August 6, 2025 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant