GithubHelp home page GithubHelp logo

scribd / pr-preview-example Goto Github PK

View Code? Open in Web Editor NEW
14.0 4.0 2.0 28 KB

Pull Request Previews with Github Actions, AWS App Mesh, and ECS

Home Page: https://github.com/scribd/pr-preview-example

Shell 2.07% HCL 97.93%
aws github-actions appmesh ecs servicediscovery

pr-preview-example's Introduction

Pull Request Previews with Github Actions, AWS App Mesh, and ECS

Let's say you have an ECS based service: www.example.com, and when someone opens a pull request, you'd like to be able to preview what that branch looks like when deployed.

Our approach is to create a Github Actions workflow that

  • builds and deploys an ECS Service as Virtual Nodes
  • creates an App Mesh Virtual Service that points to the Virtual Nodes
  • creates an App Mesh Virtual Gateway Route that routes <pr-number>.pr-preview.example.com to that Virtual Service.

Application Infrastructure

The supporting application infrastructure is deployed using terraform as it is mostly stable.

Broadly speaking, the following is created:

  • An Elastic Load Balancer
  • An ECS cluster
  • A DNS entry for *.pr-preview.example.com pointing to the Elastic Load Balancer.
  • An AppMesh Virtual Gateway configuration registered to the ELB
  • An AppMesh Virtual Gateway ECS deployment
  • IAM and other resources for use by the application.

See the example implementation for details.

Notes

  • We choose EC2 flavor ECS cluster so that we can take advantage of local file system caching, but you don't have to.
  • This example doesn't include autoscaling configuration.

Github Actions

The preview stack is dynamically deployed using Github Actions when a pull request is opened.

After the pull request is merged (or closed), the preview stack is deleted.

The preview stack is composed of:

  • ECS Service:
    • Task Definition
    • Service Definition
  • AppMesh configuration:
    • Virtual Node
    • Route
    • Virtual Router
    • Virtual Service
    • Virtual Gateway Route

pr-preview-example's People

Contributors

cktaylor avatar jim80net avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.