Coder Social home page Coder Social logo

trading-post-ops's Introduction

Trading Post Ops

This repo deploys the Trading Post website.

Infrastructure v1.0

Infrastructure v1.0 gets the initial version of the app ready for testing. Everything is running on a single server.

Dependencies

  • Packer

Build Instructions

  • Register an elastic IP (EIP) on AWS
  • Register AWS Route53 domain name mtgtradingpost.com
  • A hosted zone is automatically created for mtgtradingpost.com
  • Create a record set pointing mtgtradingpost.com to the EIP
  • Export AWS secret and access keys as environment variables for Terragrunt to use:
export AWS_ACCESS_KEY_ID=<access key>
export AWS_SECRET_ACCESS_KEY=<secret key>
  • Use Packer to build the monolith Amazon Machine Image (AMI):
cd v1/packer
packer build packer.json
  • Spin up an EC2 server with the created AMI
  • Modify the Security Group to allow SSH/22 inbound from your IP and HTTP/80 inbound from you IP and all of the tester IPs
  • Associate the EIP to the EC2 server
  • SSH into the EC2 server using the EIP
  • Start Apache server:
sudo a2ensite FlaskApp
sudo service apache2 restart

Infrastructure v2.0

Dependencies

  • Packer
  • Terraform
  • Terragrunt

Build Instructions

  • Export AWS secret and access keys as environment variables for Terragrunt to use:
export AWS_ACCESS_KEY_ID=<access key>
export AWS_SECRET_ACCESS_KEY=<secret key>
  • Use Packer to build the front-end AMI:
cd v2/packer
packer build packer.json

Note: CircleCI is already set up to deploy the AMI with every change to the application repo.

  • Deploy RDS
cd v2/terragrunt/dev/rds
terragrunt apply --terragrunt-source-update

Note: Running Terragrunt for the first time creates DynamoDB locking table and S3 bucket to store the Terraform state. It will also output the RDS endpoint which will be used by the Flask front-end.

  • Deploy ASG for Flask Front End
cd v2/terragrunt/dev/asg
terragrunt apply --terragrunt-source-update
cd v2/terragrunt/dev/harness
terragrunt apply --terragrunt-source-update

Note: Harness Delegate is required to interface with the Harness manager for continuous deployment of application changes.

  • Deploy ELK Stack
cd v2/terragrunt/dev/elk
terragrunt apply --terragrunt-source-update

Note: Apache logs from the frontend will be picked up by Filebeat and sent to Logstash which parse the event and send it to Elasticsearch. Kibana will read the events in Elasticsearch to create dashboards and run user queries.

Harness Setup

Harness is used for continuous deployment of application changes.

Shared Resources

  • Cloud Provider
    • Name: trading-post
    • AWS credentials to access account with Harness Delegate installed

Application

  • Service
    • Name: trading-post
    • Deployment type: AWS AMI
    • Artifact:
      • Cloud Provider: trading-post
      • AWS Tags: app:trading-post
    • User Data to start service requires RDS endpoint
  • Environment
    • Name: trading-post
    • Cloud Provider Type: AWS
    • Deployment Type: AMI
    • Use already provisioned infrastructure
    • Cloud Provider: trading-post
    • Auto-scaling Group: auto-populated by Terragrunt asg deploy
    • Class Load Balancers: auto-populated by Terragrunt asg deploy
    • Scope to trading-post Service
  • Workflow
    • Name: trading-post canary deploy
    • Workflow Type: Canary
    • Environment: trading-post
    • Predeployment Steps:
      • Email
    • Phase 1:
      • AWS AutoScaling Group Setup (2 target instances)
      • Upgrade AutoScaling Group (50% upgrade)
      • Manual approval
    • Phase 2:
      • Upgrade AutoScaling Group (100% upgrade)
      • Manual approval
  • Workflow
    • Name: trading-post collect artifact
    • Workflow Type: Build Workflow
    • Artifact Collection
      • Use Artifact defined in Service
  • Pipeline
    • Name: trading-post canary pipeline
    • Pipeline Stages
      • trading-post collect artifact
      • trading-post canary deploy
  • Trigger
    • Type: On new artifact
    • Artifact defined in Service
    • Execute trading-post canary pipeline

trading-post-ops's People

Contributors

cheuklau avatar

Stargazers

 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.