Skip to content

fission-codes/ipfs-cluster-aws

Repository files navigation

Deploys a multi-region DNS-balanced TLS-enabled network of ipfs-cluster nodes running on NixOS on AWS EC2 cloud servers using Terraform.

First, Install nix, clone this repo and cd in.

Zero to Hero

Set up or choose an existing, public Route53 Hosted zone to use for subdomains.

Get or create an AWS access key with appropriate permissions.

Configure credentials and default region for Terraform's AWS provider. For example, using environment variables:

export AWS_ACCESS_KEY_ID="..."
export AWS_SECRET_ACCESS_KEY="..."
export AWS_DEFAULT_REGION="us-west-2"

Set Terraform imput variable values, for example by copying terraform.tfvars.example to terraform.tfvars and editing it. See inputs.tf for all variables and documentation. If you do not set variables, Terraform will ask you for the required ones on every run.

Start the deployment:

nix-shell --run 'terraform apply'

Read the plan and accept it if you are satisfied. When the deployment is done, read the outputs. Access the gateway at https://your-environment-ipfs-cluster.your-domain/ .

Connect to a server and run some commands:

ssh root@<your-environment>-ipfs-cluster-us-east-1-node0.<your-domain> -i SECRET/private_key 'ipfs-cluster-ctl peers ls'

When you're done, don't forget to destroy the cloud resources so as not to waste power and money:

nix-shell --run 'terraform destroy'

Develop

Start the deployment shell to see a list of available commands:

nix-shell

What? Where?

  • infrastructure
  • operating sysem configuration
  • deployment environment
    • shell.nix is loaded by nix-shell and includes dependencies and scripts used for infrastructure deployment
  • nix/ package definitions and dependencies

Security

The Terraform state terraform.tfstate contains sensitive data such as the cluster secret. The state should be encrypted and may be stored remotely.

If you don't specify a public_key variable, a private key without a passphrase is generated and saved to SECRET/private_key. For production use, generate a key with passphrase (stored in your keychain), specify this variable and let ssh find the private key, eg. via .ssh/config.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published