当前位置: 首页 > 软件库 > 云计算 > >

ecs-refarch-continuous-deployment

授权协议 Apache-2.0 License
开发语言 Java
所属分类 云计算
软件类型 开源软件
地区 不详
投 递 者 吕和风
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

ECS Reference Architecture: Continuous Deployment

The ECS Continuous Deployment reference architecture demonstrates how to achievecontinuous deployment of an application to AmazonElastic Container Service (Amazon ECS) using AWS CodePipeline and AWSCodeBuild. With continuous deployment, software revisions are deployed to aproduction environment automatically without explicit approval from a developer,making the entire software release process automated.

Launching this AWS CloudFormation stack provisions a continuous deploymentprocess that uses AWS CodePipeline to monitor a GitHub repository for newcommits and AWS CodeBuild to create a new Docker container image and to push itinto Amazon Elastic Container Registry (Amazon ECR).

When creating this stack, you can opt to deploy the service onto AWSFargate or Amazon EC2. AWS Fargate allows you to run containerswithout managing clusters or services. If you choose Amazon EC2, an Auto Scalinggroup of t2.micro instances will be created to host your service.

Running the example

1. Fork the GitHub repository

Fork the Amazon ECS sampleapp GitHub repository intoyour GitHub account.

From your terminal application, execute the following command (make sure toreplace <your_github_username> with your actual GitHub username):

git clone https://github.com/<your_github_username>/ecs-demo-php-simple-app

This creates a directory named ecs-demo-php-simple-app in your currentdirectory, which contains the code for the Amazon ECS sample app.

2. Create the CloudFormation stack

Deploy Region Name Region Launch Types
�� US East (N. Virginia) us-east-1 Fargate, EC2
�� US East (Ohio) us-east-2 EC2
�� US West (N. California) us-west-1 EC2
�� US West (Oregon) us-west-2 EC2
�� EU (Ireland) eu-west-1 EC2
�� EU (London) eu-west-2 EC2
�� EU (Frankfurt) eu-central-1 EC2
�� Asia Pacific (Singapore) ap-southeast-1 EC2
�� Asia Pacific (Sydney) ap-southeast-2 EC2
�� Asia Pacific (Tokyo) ap-northeast-1 EC2
�� Asia Pacific (Seoul) ap-northeast-2 EC2
�� Canada (Central) ca-central-1 EC2

This reference architecture can only be deployed to Regions which have allnecessary services available. See the RegionTablefor information about service availability.

The CloudFormation template requires the following parameters:

  • Cluster Configuration

    • Launch Type: Deploy the service using either AWS Fargate or Amazon EC2.Selecting EC2 will create an Auto Scaling group of t2.micro instances foryour cluster. See the documentation to learn more aboutlaunch types.
  • GitHub Configuration

    • Repo: The repo name of the sample service.
    • Branch: The branch of the repo to deploy continuously.
    • User: Your username on GitHub.
    • Personal Access Token: Token for the user specified above.(https://github.com/settings/tokens)

The CloudFormation stack provides the following output:

  • ServiceUrl: The sample service that is being continuously deployed.
  • PipelineUrl: The continuous deployment pipeline in the AWS ManagementConsole.

Testing the example

After the CloudFormation stack is created, the latest commit to the GitHubrepository is run through the pipeline and deployed to ECS. Open thePipelineUrl to watch the first revision run through the CodePipelinepipeline. After the deploy step turns green, open the URL from ServiceUrlwhich loads a page similar to this:

ECS sample app

To test continuous deployment, make a change to src/index.php in theecs-demo-php-simple-app repository and push it to GitHub. CodePipeline detectsthe change, builds the new application, and deploys it to your clusterautomatically. After the pipeline finishes deploying the revision, reload thepage to see the changes made.

Cleaning up the example resources

To remove all resources created by this example, do the following:

  1. Delete the main CloudFormation stack which deletes the substacks and resources.

  2. Manually delete resources which may contain content:

    • S3 Bucket: ArtifactBucket
    • ECR Repository: Repository

CloudFormation template resources

The following sections explains all of the resources created by theCloudFormation template provided with this example.

DeploymentPipeline

Resources that compose the deployment pipeline include the CodeBuild project,the CodePipeline pipeline, an S3 bucket for deployment artifacts, and allnecessary IAM roles used by those services.

Service

An ECS task definition, service, IAM role, and ECR repository for the sampleapplication. This template is used by the CodePipeline pipeline to deploy thesample service continuously.

Cluster

An ECS cluster optionally backed by an Auto Scaling group of EC2 instancesrunning the Amazon ECS-optimized AMI for the EC2 launch type.

Load Balancer

An Application Load Balancer to be used for traffic to the sample application.

VPC

A VPC with two public subnets on two separate Availability Zones, an internetgateway, and a route table with a default route to the public internet.

License

This reference architecture sample is licensed under Apache 2.0.

 相关资料
  • Serverless Reference Architecture: Web Application README Languages:PT Introduction The Web Application reference architecture is a general-purpose, event-driven, web application back-end that uses AW

  • Yarn can easily be used in various continuous integration systems. To speed up builds, the Yarn cache directory can be saved across builds. AppVeyor Yarn is preinstalled on AppVeyor, so you don’t need

  • Lab: Build a Continuous Deployment Pipeline with Jenkins and Kubernetes For a more in depth best practices guide, go to the solution posted here. Introduction This guide will take you through the step

  • Question lintcode: (402) Continuous Subarray Sum Problem Statement Given an integer array, find a continuous subarray where the sum of numbers is the biggest. Your code should return the index of the

  • Question lintcode: (403) Continuous Subarray Sum II Maximum circular subarray sum - GeeksforGeeks Problem Statement Given an integer array, find a continuous rotate subarray where the sum of numbers i

  • Question lintcode: (397) Longest Increasing Continuous subsequence Problem Statement Give you an integer array (index from 0 to n-1, where n is the size of this array),find the longest increasing cont