Giter Site home page Giter Site logo

hashistack-digitalocean's Introduction

Hashistack Digitalocean

Terraform to setup a consul and nomad cluster by building the number of servers and clients specified. It wraps them around a firewall that can only be accesses via a bastion host (ssh) and a load balancer (http) Uses digital ocean as a provider to create the droplets needed. Sets up Vault to store secrets

Now also uses Consul Connect as a sidecar allocation to interact with other services

It starts nomad and consul as a service and automatically connects all nodes in the cluster

Environment variables

  • do_token - api token for digital ocean which can be found in your DigitalOcean Account under "API"
  • ssh_fingerprint - the ssh fingerprint to use to connect to your newly created droplets
  • bastion_host_id - the droplet id of the bastion host server
  • server_count - number of server droplets to create
  • client_count - number of client droplets to create

Modules

server-droplet

  • Create servers and sets up nomad and consul in server mode
  • server_count - number of server droplets to create

client-droplet

  • Create clients and sets up nomad and consul in client mode
  • client_count - number of client droplets to create
  • consul_server_ip - a consul server ip

load-balancer

  • Create a public load balancer to connect to all servers
  • all_server_ids - ids of all servers (droplets)

firewall

  • Create a firewall around the server and client droplets
  • all_server_ids - ids of all servers (droplets)
  • load_balancer_id - the id of the digital ocean load balancer
  • bastion_id - the droplet id of the bastion host

Scripts

Scripts for installing required software in newly created droplets

consul

install_consul.sh client|server ${self.ipv4_address_private} ${var.consul_server_ip}

  • Installs required software - unzip and docker
  • Sets up iptables to allow access to localhost from docker
  • Downloads consul and copies the binary to the /user/bin directory
  • Starts consul as a service in either server or client mode
  • If in client mode, it joins the client to the cluster

nomad

install_nomad.sh client|server

  • Downloads nomad and copies the binary to the /user/bin directory
  • Starts nomad as a service in either server or client mode

vault

install_vault.sh server

  • Downloads vault and copies the binary to the /user/bin directory
  • Starts vault as a service in server mode
  • Initializes Vault
  • Unseals vaults to make it ready for use
  • Exports the vault token for nomad to use

How to run

  • eval `ssh-agent -s`
  • ssh-add ~/.ssh/id_rsa (add your private key to the ssh agent which corresponds to the ssh_fingerprint)
  • terraform init
  • terraform plan
  • terraform apply

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.