WIP commit to create a comparison with the ECS blue green repo,

specifically the fargate branch changes.
This commit is contained in:
Joe Bailey 2023-02-12 15:21:47 -08:00
parent 517d5e0979
commit 008f84a252
2 changed files with 34 additions and 16 deletions

View file

@ -222,13 +222,12 @@ Resources:
- echo -n "$CODEBUILD_LOG_PATH" > /tmp/build_id.out - echo -n "$CODEBUILD_LOG_PATH" > /tmp/build_id.out
- printf "%s:%s" "$REPOSITORY_URI" "$(cat /tmp/build_id.out)" > /tmp/build_tag.out - printf "%s:%s" "$REPOSITORY_URI" "$(cat /tmp/build_id.out)" > /tmp/build_tag.out
- printf '{"tag":"%s"}' "$(cat /tmp/build_id.out)" > /tmp/build.json - printf '{"tag":"%s"}' "$(cat /tmp/build_id.out)" > /tmp/build.json
# - $(aws ecr get-login-password) - echo Logging in to Amazon ECR...
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin "$(aws sts get-caller-identity --query \"Account\" --output text)".dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
build: build:
commands: commands:
- ./mvnw package - ./mvnw package -DskipTests
- docker build --tag "$(cat /tmp/build_tag.out)" . - docker build --tag "$(cat /tmp/build_tag.out)" .
# - ./mvnw spring-boot:build-image
- docker image tag spring-petclinic:3.0.0-SNAPSHOT "$(cat /tmp/build_tag.out)"
post_build: post_build:
commands: commands:
- docker push "$(cat /tmp/build_tag.out)" - docker push "$(cat /tmp/build_tag.out)"
@ -239,13 +238,12 @@ Resources:
ComputeType: "BUILD_GENERAL1_SMALL" ComputeType: "BUILD_GENERAL1_SMALL"
Image: "aws/codebuild/standard:6.0" Image: "aws/codebuild/standard:6.0"
Type: "LINUX_CONTAINER" Type: "LINUX_CONTAINER"
PrivilegedMode: true
EnvironmentVariables: EnvironmentVariables:
- Name: AWS_DEFAULT_REGION - Name: AWS_DEFAULT_REGION
Value: !Ref AWS::Region Value: !Ref AWS::Region
- Name: REPOSITORY_URI - Name: REPOSITORY_URI
Value: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository} Value: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository}
- Name: DOCKER_HOST
Value: unix:///var/run/docker.sock
Name: !Sub ${AWS::StackName}-codebuildproject Name: !Sub ${AWS::StackName}-codebuildproject
ServiceRole: !Ref CodeBuildServiceRole ServiceRole: !Ref CodeBuildServiceRole
@ -259,11 +257,11 @@ Resources:
BuildSpec: | BuildSpec: |
version: 0.1 version: 0.1
phases: phases:
install: # install:
commands: # commands:
- pip install --upgrade python # - pip install --upgrade python
- pip install --upgrade awscli # - pip install --upgrade awscli
- pip install --upgrade boto3 # - pip install --upgrade boto3
pre_build: pre_build:
commands: commands:
- printenv - printenv
@ -274,7 +272,7 @@ Resources:
discard-paths: yes discard-paths: yes
Environment: Environment:
ComputeType: "BUILD_GENERAL1_SMALL" ComputeType: "BUILD_GENERAL1_SMALL"
Image: aws/codebuild/python:2.7.12 Image: "aws/codebuild/standard:6.0"
Type: "LINUX_CONTAINER" Type: "LINUX_CONTAINER"
EnvironmentVariables: EnvironmentVariables:
- Name: AWS_DEFAULT_REGION - Name: AWS_DEFAULT_REGION

View file

@ -31,9 +31,7 @@ Parameters:
IsProduction: IsProduction:
Type: String Type: String
Resources: Resources:
LoadBalancerListener: LoadBalancerListener:
Type: AWS::ElasticLoadBalancingV2::Listener Type: AWS::ElasticLoadBalancingV2::Listener
Properties: Properties:
@ -77,7 +75,7 @@ Resources:
Conditions: Conditions:
- Field: path-pattern - Field: path-pattern
Values: Values:
- "*" - "*"
ListenerArn: !Ref LoadBalancerListener ListenerArn: !Ref LoadBalancerListener
Priority: 1 Priority: 1
@ -104,15 +102,37 @@ Resources:
Role: !Ref ECSServiceRole Role: !Ref ECSServiceRole
DesiredCount: !Ref DesiredCount DesiredCount: !Ref DesiredCount
TaskDefinition: !Ref TaskDefinition TaskDefinition: !Ref TaskDefinition
# CapacityProviderStrategy:
# - CapacityProvider: FARGATE
# - Base: 0
# - Weight: 1
LoadBalancers: LoadBalancers:
- ContainerName: simple-app - ContainerName: simple-app
ContainerPort: 80 ContainerPort: 80
TargetGroupArn: !Ref TargetGroup TargetGroupArn: !Ref TargetGroup
# NetworkConfiguration:
# - AwsvpcConfiguration:
# - AssignPublicIp: ENABLED
# - SecurityGroups:
# - Ref: SecurityGroupIDs
# - Subnets: !!omap
# - Ref: SubnetIDs
PlatformVersion: LATEST
# DeploymentConfiguration:
# - MaximumPercent: 200
# - MinimumHealthyPercent: 100
# - DeploymentCircuitBreaker:
# - Enable: true
# - Rollback: true
# DeploymentController:
# - Type: ECS
# ServiceConnectConfiguration:
# - Enabled: false
TaskDefinition: TaskDefinition:
Type: AWS::ECS::TaskDefinition Type: AWS::ECS::TaskDefinition
Properties: Properties:
#Family: !Sub ${AWS::StackName}-simple-app Family: !Sub ${AWS::StackName}-simple-app
ContainerDefinitions: ContainerDefinitions:
- Name: simple-app - Name: simple-app
Image: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository}:${Tag} Image: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository}:${Tag}