Skip to content

kospiotr/us-playground-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

314 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

us-playground-scripts

Set-up

There should be only one bootstrap Consul instance so we need 1 bootstrap VM and one or more server instances. In order to not make each other to create and join the same cluster we will develop in isolated networks (VPCs).

  1. Set up private VPC
  2. Add firewall rule that enables following ports: tcp:8500; tcp:9990; tcp:4646; tcp:4140
  3. Create 2 templates that uses your VPC and add network tag with defined firewall rule:

Running for bootstrap VM:

export BRANCH=master
export REPO=raw.githubusercontent.com/kospiotr/us-playground-scripts
sudo su -c "bash <(wget -qO- "https://${REPO}/${BRANCH}/startup-bootstrap.sh?$(uuidgen)") $BRANCH > /var/log/startup.log" root

Running for server VM:

export BRANCH=master
export REPO=raw.githubusercontent.com/kospiotr/us-playground-scripts
sudo su -c "bash <(wget -qO- "https://${REPO}/${BRANCH}/startup-instance.sh?$(uuidgen)") $BRANCH > /var/log/startup.log" root

Demo

Architecture

Load Balancer -> Api G/W -> Service Discovery -> Micro Services

Consul

Service Discovery and dependency for Nomad, API G/W

Nomad

Scheduler for services

Micro Services

Code (https://github.com/kospiotr/us-playground-scripts/tree/master/u-service-hello)

Features

  • Accepts application name as argument
  • Automatic registration in Consul (Service Discovery)

Rest Endpoints

  • GET / - default entrypoint displaying Hello World

  • GET /my-health-check - healthcheck for service discovery and or gateway

  • GET /api/inspect - displaying app instance info

    • delay - [optional, query] sleep value in ms
    • format - [optional, query, default: html, values: html, csv] output format
  • Deploy 1 micro service:

export BRANCH=master
export ENVIRONMENT=dev
export REPO=https://raw.githubusercontent.com/kospiotr/us-playground-scripts
wget "${REPO}/${BRANCH}/u-service-app1-ocd/${ENVIRONMENT}/deploy.job.nomad?$(uuidgen)" -O u-service-app1-ocd.job.nomad && nomad job run u-service-app1-ocd.job.nomad

Api Gateway

Linkerd

export BRANCH=master
export ENVIRONMENT=dev
export REPO=https://raw.githubusercontent.com/kospiotr/us-playground-scripts

wget "${REPO}/${BRANCH}/linkerd-ocd/${ENVIRONMENT}/deploy.job.nomad?$(uuidgen)" -O linkerd.job.nomad && nomad job run linkerd.job.nomad

Spring Gateway

export BRANCH=master
export ENVIRONMENT=dev
export REPO=https://raw.githubusercontent.com/kospiotr/us-playground-scripts
wget "${REPO}/${BRANCH}/spring-gateway-ocd/${ENVIRONMENT}/deploy.job.nomad?$(uuidgen)" -O spring-gateway.job.nomad && nomad job run spring-gateway.job.nomad

Routing

  • Deploy 2 micro service:
export BRANCH=master
export ENVIRONMENT=dev
export REPO=https://raw.githubusercontent.com/kospiotr/us-playground-scripts
wget "${REPO}/${BRANCH}/u-service-app2-ocd/${ENVIRONMENT}/deploy.job.nomad?$(uuidgen)" -O u-service-app2-ocd.job.nomad && nomad job run u-service-app2-ocd.job.nomad

Linkerd

Spring Gateway

Scale & Load Balancing

Will be using application_one on the Spring Gateway

export BRANCH=master
export ENVIRONMENT=dev
export REPO=https://raw.githubusercontent.com/kospiotr/us-playground-scripts
wget "${REPO}/${BRANCH}/u-service-app1-ocd/${ENVIRONMENT}/deploy.job.nomad?$(uuidgen)" -O u-service-app1-ocd.job.nomad && nomad job run u-service-app1-ocd.job.nomad

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 5