All Projects → bitgn → Fdb Cloud Test

bitgn / Fdb Cloud Test

Licence: mit
Packer + Terraform setup to experiment with FDB clusters in the cloud.

Projects that are alternatives of or similar to Fdb Cloud Test

Hybrid multicloud overlay
MutiCloud_Overlay demonstrates a use case of overlay over one or more clouds such as AWS, Azure, GCP, OCI, Alibaba and a vSphere private infrastructure in Hub and spoke topology, point to point topology and in a Single cloud. Overlay protocols IPv6 and IPv4 are independent of underlying infrastructure. This solution can be integrated with encryption and additional security features.
Stars: ✭ 127 (+452.17%)
Mutual labels:  terraform, hcl, packer
Hcloud Okd4
Deploy OKD4 (OpenShift) on Hetzner Cloud
Stars: ✭ 29 (+26.09%)
Mutual labels:  terraform, hcl, packer
Multi Env Deploy
Complete example of deploying complex web apps to AWS using Terraform, Ansible, and Packer
Stars: ✭ 132 (+473.91%)
Mutual labels:  terraform, hcl, packer
Terraform Aws Couchbase
Reusable infrastructure modules for running Couchbase on AWS
Stars: ✭ 73 (+217.39%)
Mutual labels:  terraform, hcl, packer
Elasticsearch Cloud Deploy
Deploy Elasticsearch on the cloud easily
Stars: ✭ 308 (+1239.13%)
Mutual labels:  terraform, hcl, packer
Terraformer
CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code
Stars: ✭ 6,316 (+27360.87%)
Mutual labels:  terraform, hcl
Terragoat
TerraGoat is Bridgecrew's "Vulnerable by Design" Terraform repository. TerraGoat is a learning and training project that demonstrates how common configuration errors can find their way into production cloud environments.
Stars: ✭ 461 (+1904.35%)
Mutual labels:  terraform, hcl
Infrastructure As Code Talk
Sample code for the talk "Infrastructure-as-code: running microservices on AWS with Docker, ECS, and Terraform"
Stars: ✭ 520 (+2160.87%)
Mutual labels:  terraform, hcl
Terratest
Terratest is a Go library that makes it easier to write automated tests for your infrastructure code.
Stars: ✭ 5,797 (+25104.35%)
Mutual labels:  terraform, packer
Terratag
Terratag is a CLI tool that enables users of Terraform to automatically create and maintain tags across their entire set of AWS, Azure, and GCP resources
Stars: ✭ 385 (+1573.91%)
Mutual labels:  terraform, hcl
Bedrock
Automation for Production Kubernetes Clusters with a GitOps Workflow
Stars: ✭ 528 (+2195.65%)
Mutual labels:  terraform, hcl
Terraform Aws Secure Baseline
Terraform module to set up your AWS account with the secure baseline configuration based on CIS Amazon Web Services Foundations and AWS Foundational Security Best Practices.
Stars: ✭ 596 (+2491.3%)
Mutual labels:  terraform, hcl
Vault On Gke
Run @HashiCorp Vault on Google Kubernetes Engine (GKE) with Terraform
Stars: ✭ 453 (+1869.57%)
Mutual labels:  terraform, hcl
Inframap
Read your tfstate or HCL to generate a graph specific for each provider, showing only the resources that are most important/relevant.
Stars: ✭ 430 (+1769.57%)
Mutual labels:  terraform, hcl
K2tf
Kubernetes YAML to Terraform HCL converter
Stars: ✭ 477 (+1973.91%)
Mutual labels:  terraform, hcl
Terraform Ls
Terraform Language Server
Stars: ✭ 389 (+1591.3%)
Mutual labels:  terraform, hcl
Intro To Terraform
Sample code for the blog post series "A Comprehensive Guide to Terraform."
Stars: ✭ 550 (+2291.3%)
Mutual labels:  terraform, hcl
Red Baron
Automate creating resilient, disposable, secure and agile infrastructure for Red Teams.
Stars: ✭ 662 (+2778.26%)
Mutual labels:  terraform, hcl
Terraform Ecs
AWS ECS terraform module
Stars: ✭ 657 (+2756.52%)
Mutual labels:  terraform, hcl
Vim Terraform
basic vim/terraform integration
Stars: ✭ 668 (+2804.35%)
Mutual labels:  terraform, hcl

About

The purpose of this project is to make it easy to run various load tests on systems with FoundationDB in the cloud.

We can achieve that by:

  1. "Prebaking" cloud-specific VM images for the FoundationDB cluster nodes along with the tester nodes and machines for capturing the telemetry.
  2. Using these images to quickly create FoundationDB clusters with the specific configuration.

The first step is handled by the Packer, the second - by the Terraform.

We want to start with a fixed topology:

  • foundationDB nodes in the same network, forming a cluster;
  • tester machines connected to the FDB.

Number and VM type for the node and load tester machines could be changed within the configuration.

Creating AMIs

First you need to create packer images for FDB and tester machines.

Note, that in this setup we actually create a temporary EC2 instance in the cloud, install all the dependencies there, make a snapshot (AMI) and kill the original machine. With these snapshots we could then quickly launch a dozen of EC2 instances, connecting them into a cluster.

You can create a FoundationDB AMI like this (make sure to fill in your AWS credentials):

$ export AWS_ACCESS_KEY=""
$ export AWS_SECRET_KEY=""
$ cd packer-fdb
$ packer build --only=aws packer.json

Tester AMI can be created exactly like this but you enter packer-tester folder instead.

Creating Docker

Should you want to create docker images instead of AMIs, you can do so via:

$ cd packer-fdb
$ packer build --only=docker packer.json

Deploying Clusters

Setup Terraform

Before deploying pre-baked images into AWS you need to configure your working copy first. Install Terraform, then go to the terraform folder of this repository and execute:

$ terraform init

Then, you would need to create a file .secret.aws.tfvars, filling it with your AWS credentials:

aws_access_key = ""
aws_secret_key = ""
aws_account_id = ""

Afterwards you would also need to create a new ssh key called terraform and place it into your ~/.ssh/ folder. Terraform will install it into all the new machines, making it possible for you to connect to them via ssh.

You can do that with:

$ ssh-keygen -t rsa -b 4096 -C "terraform" -f "$HOME/.ssh/terraform"

Deploy a cluster

In order to deploy a cluster you would need to execute the following in the terraform folder:

# prepare terraform plan, using a separate file with the credentials
$ terraform plan -var-file=.secret.aws.tfvars -out my.plan
# carry out the plan
$ terraform apply "my.plan"

The process should take 3-4 minutes and print out in the end something like this:

aws_instance.fdb[0]: Creation complete after 3m32s (ID: i-0b90a62a90636c1ad)

Apply complete! Resources: 12 added, 0 changed, 0 destroyed.

Outputs:

fdb_address = [
    fdb-01.amazonaws.com,
    fdb-02.amazonaws.com,
    fdb-03.amazonaws.com
]
tester_address = [
    tester-01.amazonaws.com
]

Note that the machine names would be different each time (and much longer). This is just a sample output.

Congratulations, you now have a FoundationDB cluster running in AWS. You can test it by connecting to the test machine with your terraform key:

$ ssh -i ~/.ssh/terraform [email protected]

On your first connection, the ssh might ask you about accepting the new fingerprint. This happens because we have a brand new server running. Just type in 'yes'.

Once connected to the test machine, you could verify that the client tools are installed and the cluster is responding:

$ fdbcli
Using cluster file `/etc/foundationdb/fdb.cluster'.

The database is available.

Welcome to the fdbcli. For help, type `help'.
fdb> status details

Using cluster file `/etc/foundationdb/fdb.cluster'.

Configuration:
  Redundancy mode        - double
  Storage engine         - ssd-2
  Coordinators           - 3
  
...

Congratulations, FDB cluster is up and running!

Destroy the cluster

Keeping AWS instances running costs money. So generally it is advised to destroy all the resources after the experiment.

Terraform makes it easy:

$ terraform destroy -var-file=.secret.aws.tfvars

....

Plan: 0 to add, 0 to change, 12 to destroy.

Do you really want to destroy?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes
  
....

Destroy complete! Resources: 12 destroyed.

Modify the cluster

You can tune the cluster configuration by editing variables.tf file to your liking. Ideally, you would do that before creating a new cluster.

The most important options there are:

variable "aws_fdb_size" {
  default = "t2.medium"
  description = "machine type to run FoundationDB servers"

}
# using only 1 machine will conflict with the default cluster config
# 'configure new memory double'
variable "aws_fdb_count" {
  default = 3
  description = "how many machines do we want in our cluster. Minimum 2"
}

variable "aws_tester_size" {
  default = "m4.xlarge"
  description = "instance type for launching tester machines"
}

Plans

I plan to improve this repository a bit later by:

  1. Introducing a load tester tool (pre-installed to the tester image) with common benchmarks.
  2. Adding a few scripts to visualize the results.
  3. Adding more Terraform configurations tuned for better performance.

Contact

If you have any questions, please don't hesitate to get in touch by sending an email to rinat at abdullin.com.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].