Giter Site home page Giter Site logo

hello-world's Introduction

DevOps exercise

  1. Create a barebones dockerized application (in the language of your choice) with just one endpoint that returns "hello world" and run it as an Elastic Container Service on an ECS cluster in AWS.

  2. Send APM metrics of the docker application to the Datadog dashboard.

This problem can be solved in more than one way but you can go with a solution that you think is best. The most important part of this exercise is the self-evaluation of the solution. So please take the time to document the pros, cons, and improvements that can be made on top of your solution.

Environment details

  1. AWS EC2 instance
  2. AWS ECS cluster using Fargate
  3. AWS Container launch using Fargate
  4. Datadog APM

Install docker on EC2 instance

  • sudo yum update -y
  • sudo amazon-linux-extras install docker
  • sudo service docker start
  • sudo usermod -a -G docker ec2-user

exit and check docker version

  • docker info

Clone hell-world repo

Build, run and test the hello-world docker application - local

Build and run

  • cd hello-world
  • docker build -t flask-1:latest .
  • docker run -t -i -d -p 5050:5050 flask-1

Test

hello world

Push docker images to AWS ECS image repository

Authenticate to image repository using https://docs.aws.amazon.com/AmazonECR/latest/userguide/Registries.html#registry_auth

  • aws ecr create-repository --repository-name hello-world-repository-4 --region us-east-1
  • docker tag flask-1 .dkr.ecr.us-east-1.amazonaws.com/hello-world-repository-4
  • docker push .dkr.ecr.us-east-1.amazonaws.com/hello-world-repository-4

Amazon ECS and Datadog Fargate integration

Follow the guide: https://app.datadoghq.com/account/settings#integrations/aws-fargate

Setup, run and rest hello-world docker application - ECS

Setup and run

  • Create ECS cluster followed by Fargate
  • Create Task definition with launch type Fargate
  • Allocate required resources, roles, size
  • Add required containers for application and datadog-agent
    • datadog-agent
      • provide image and DD_API_key and ECS_FARGATE
    • hello-world app
      • provide pushed image registry, ports (5050 and 8126), and docker labels
  • Associate security groups as per required TCP ports
  • Run task definition

Test

hello world

Other approaches evaluated

1. Running datadog daemon as part of docker application

- Issue observed was it required systemd services to start daemon services inside a docker. However, that access was not available inside a docker application. This approched word for an AWS EC2 instance 

2. Creating ECS task difinition using EC2

- This approached worked. However, here docker application is running on an EC2 instance. The infrastructure has dependency on the EC2 instance which needs to be self-managed. Scalling could be an issue. 

2. Creating ECS task definition using Fargate

- This approached worked and is the one submitted. Here, the advantage is the infrastructre is managed by AWS and scalling the application when APM shows high number of request can be automated using AWS ECS automation and load balancer

hello-world's People

Contributors

sg3629 avatar

Watchers

 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.