Coder Social home page Coder Social logo

valkehh / bluegreendemo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from onedaywillcome1/bluegreendemo

0.0 0.0 0.0 2.88 MB

It contains aws fargate ecs terraform code blocks, sample spring boot service & gitlab-ci yaml which provides continuous ci-cd

Shell 13.90% Java 11.45% HCL 74.29% Dockerfile 0.36%

bluegreendemo's Introduction

About

Project contains sample spring boot hello world microservice with unit test & integration test.Project can be buit by gradle, and can be deployed to AWS by terraform

Project has following CI stages:

  • build
    • It executes gradle build to compile, run tests and build package
  • dockerize
    • It gets the artifact(jar) from previous build step and put into docker image, then push to AWS ECR
  • deploy
    • It executes terraform apply to deploy image to AWS ECS and trigger codedeploy
  • destroy
    • It executes terraform destroy to delete every resource. This step is manual, needs click to play button

Prerequisites

  • Put the following tag into your VPC
    • Key = BlueGreenDemo alt text
  • Put the following tags into your each Private Subnets(ECS Fargate tasks will use these subnets)
    • Type = Private alt text
  • Put the following tags into your each Public Subnets(ALBs will use these subnets)
    • Type = Public alt text
  • Buy domain from AWS Route53 and create Route 53 hosted zone with domain name(i.e. mycompany.com) or just only add nameservers of created hosted zone into your different hosting firm alt text
  • Create IAM User with access key & secret keys. These will be used in Gitlab CI env vars as described below.

How to use it?

After cloning this project, you have to do the following steps:

  • Push to your Gitlab repository.
  • Set the environment variables under project settings
    • AWS_ACCESS_KEY_ID (access key of iam user)
    • AWS_SECRET_ACCESS_KEY (secret key of iam user)
    • AWS_DEFAULT_REGION (i.e.us-east-1)
    • DOMAIN_NAME (i.e.mycompany.com) alt text
  • Commit to your project, and pipeline will automatically start.You can reach to your app with mybgapp.<yourdomain_name.com>(i.e. mybgapp.mycompany.com or mybgapp.mycompany.com:8080)
  • Check out your AWS codedeploy pipeline, then execute following steps according to your needs:
    • Switch traffic(80 port can access to new version of your app)
    • Terminate original task (deletes v1 of your app, after switch traffic)
    • Rollback(destroys your buggy v2 app) alt text

bluegreendemo's People

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.