GithubHelp home page GithubHelp logo

aws_staging_demo's Introduction

aws_staging_demo

This repository is a demo for AWS Staging environment. Supposed some situation like

  • Need AWS Fargate Staging environment
  • Each developer needs a unique Staging environment
  • And each developer can deploy to their own Staging environment at their own timing

I solved this problem by using Terraform, Terragrunt and CI/CD. Each Staging environment shares some resources.(VPC etc.)

Usage

I assume Terraform, Terragrunt is already installed, and created IAM user for it. Fist of all, create backend.

% BUCKET_NAME=hoge_bucket
% aws s3 mb $BUCKET_NAME

Next, copy terraform/env.yaml.example to terraform/env.yaml.Then, set your bucket name and your application domain name.

It's time to deploy Terraform resources🚀.

Common resources

Common resources mean literally common resources for all users, such as VPC, Subnet, Security Group, etc.

  1. move common resources Terraform directory
% cd terraform/common_resources
  1. apply
% terragrunt apply

This deploy creates just a plain box like under architecture.

Next, we put some application in this box.

User resources

User resources create resources for each user. There two way of deploying this resources. One is deploy by human, and the other is deploy by CI/CD. This section describes how to deploy by human.

  1. move user resources Terraform directory
% cd terraform/user_resources
  1. apply
% terragrunt apply

It's all done!

CI/CD

GitHub Actions is used for CI/CD. The staging deploy workflow triggered by workflow_dispatch. First time, Terraform create below resources.

  • ECS
    • Cluster
    • Task Definition
    • Service
  • ALB
    • listener
    • target group
  • Route53
    • A record

Then http://<your github username>.<your domain> id registered to Route53. After that, update Task Definition, and restart Fargate. And ALB Lister handle request to your own Fargate depend on host header (<your github username>.) .

Note

  • This repository is just a demo, so it doesn't have any test.
  • SSL certificate is not included in this repository.
  • This repository doesn't have any resources for like production environment. (common_resources has production , but it's just a dummy.)

aws_staging_demo's People

Contributors

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