GithubHelp home page GithubHelp logo

rk4github / voteapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws-samples/voteapp

0.0 2.0 0.0 13.31 MB

Cloud native microservices app running with a service mesh (AWS App Mesh).

License: Apache License 2.0

Shell 19.12% Smarty 1.15% Dockerfile 3.46% Java 1.74% Go 11.19% JavaScript 63.35%

voteapp's Introduction

Vote App

The Vote App is a simple application to demonstrate microservices running under App Mesh. It is based on the original Docker version (see ATTRIBUTION).

Vote App architecture

To learn more about the project repo, see this orientation.

Quick Start

Prerequisites

Before deploying the Vote App, you will need a functional VPC, ECS cluster, and service mesh.

Bash scripts and CloudFormation stack templates are provided under the config directory to create the necessary resources to run the Vote App.

The following environment variables must be exported before running the scripts:

# The prefix to use for created stack resources
export ENVIRONMENT_NAME=mesh-demo

# The AWS CLI profile (can specify "default")
export AWS_PROFILE="tony"

# The AWS region to deploy to; valid regions during preview:
# us-west-2 | us-east-1 | us-east-2 | eu-west-1
export AWS_REGION="us-west-2"
export KEY_PAIR_NAME="my-key-pair"

# The name to use for your app mesh 
export MESH_NAME="default"

# The domain to use for service discovery
export SERVICES_DOMAIN="${MESH_NAME}.svc.cluster.local"

# Optional: the number of physical nodes (EC2 instances) to join the
# ECS cluster (the default is 5)
export CLUSTER_SIZE=5

1. Deploy VPC

$ ./config/infrastructure/vpc.sh

2. Deploy Mesh

This step will set up the necessary app mesh resources (virtual nodes, virtual routers, and routes)..

To perform this step, you will first need to install the latest version of the AWS CLI.

$ ./config/appmesh/deploy-mesh.sh 

3. Deploy ECS Cluster

$ ./config/infrastructure/ecs-cluster.sh

Deploy the Vote App

$ ./config/ecs/ecs-voteapp.sh
...
Waiting for changeset to be created..
Waiting for stack create/update to complete
Successfully created/updated stack - mesh-demo-ecs-voteapp
[ecs-voteapp.sh] Public endpoints
[ecs-voteapp.sh] ================
[ecs-voteapp.sh] voteapp: http://mesh-Publi-142LFAOM1M1V5-2012495322.us-west-2.elb.amazonaws.com
[ecs-voteapp.sh] prometheus: http://mesh-Publi-142LFAOM1M1V5-2012495322.us-west-2.elb.amazonaws.com:9090/targets
[ecs-voteapp.sh] grafana: http://mesh-Publi-142LFAOM1M1V5-2012495322.us-west-2.elb.amazonaws.com:3000
[ecs-voteapp.sh] logs: https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#logStream:group=mesh-demo-ecs-cluster-ECSServiceLogGroup-16Q5XXLI1B7UP

For convenience, save the output from the above command in a text file that you can source into your bash shell:

voteapp.env

# vote app
export EP=http://mesh-Publi-142LFAOM1M1V5-2012495322.us-west-2.elb.amazonaws.com
alias vote="docker run -it --rm -e WEB_URI=$EP subfuzion/vote vote"
alias results="docker run -it --rm -e WEB_URI=$EP subfuzion/vote results"
#
export PROMETHEUS_EP="$EP:9090/targets"
alias prometheus="open $PROMETHEUS_EP"
#
export GRAFANA_EP="$EP:3000/?orgId=1"
alias grafana="open $GRAFANA_EP"

If you saved the above to a file called voteapp.env, you can source it in like this:

source voteapp.env

Testing with the Voter client

You can test the app by running the voter CLI in your terminal. Set your shell environment as shown in the previous section after deploying the app.

$ vote
? What do you like better? (Use arrow keys)
  (quit)
❯ cats
  dogs

You can print voting results:

$ results
Total votes -> cats: 4, dogs: 0 ... CATS WIN!

Observability

CloudWatch

TODO

X-Ray

Use X-Ray to trace requests between services (optional).

For further information about how to use X-Ray to trace requests as they are routed between different services, see the README.

Grafana / Prometheus.

If you want to use Grafana to visualize metrics from Envoy run

$ ./config/ecs/update-targetgroups.sh 

This will register the IP address of the task running Grafana and Prometheus with their respective target groups. When finished, you should be able to access Grafana from http://<load_balancer_dns_name>:3000. To configure Grafana, follow the instructions in the README.

voteapp's People

Contributors

aughban avatar awssandra avatar christopherhein avatar gmridula avatar jamsajones avatar jicowan avatar jpeddicord avatar kiranmeduri avatar ndegory avatar nithu0115 avatar otterley avatar subfuzion avatar tiffanyfay avatar

Watchers

 avatar  avatar

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.