diff --git a/spire/templates/apps-100A.yml b/spire/templates/apps-100A.yml index 8c7cfe09..782a1057 100644 --- a/spire/templates/apps-100A.yml +++ b/spire/templates/apps-100A.yml @@ -55,8 +55,6 @@ Parameters: PlaySharedAlbListenerRulePriorityPrefix: { Type: String } - StyleguideSharedAlbListenerRulePriorityPrefix: { Type: String } - TheWorldWebsiteSharedAlbListenerRulePriorityPrefix: { Type: String } Conditions: @@ -390,36 +388,6 @@ Resources: TemplateURL: !Sub ${TemplateUrlPrefix}/s3-signing.yml TimeoutInMinutes: 5 - StyleguideStack: - Type: AWS::CloudFormation::Stack - Condition: IsStaging # Staging only - UpdateReplacePolicy: Delete - DeletionPolicy: Delete - Properties: - Parameters: - NestedChangeSetScrubbingResourcesState: !Ref NestedChangeSetScrubbingResourcesState - AlbFullName: !Ref AlbFullName - AlbHttpsListenerArn: !Ref AlbHttpsListenerArn - EcsClusterArn: !Ref EcsClusterArn - VpcId: !Ref VpcId - EcrImageTag: !Sub /prx/${EnvironmentTypeAbbreviation}/Spire/Styleguide/pkg/docker-image-tag - AlbListenerRulePriorityPrefix: !Ref StyleguideSharedAlbListenerRulePriorityPrefix - EnvironmentType: !Ref EnvironmentType - EnvironmentTypeAbbreviation: !Ref EnvironmentTypeAbbreviation - RootStackName: !Ref RootStackName - RootStackId: !Ref RootStackId - X8664AsgCapacityProviderName: !Ref X8664AsgCapacityProviderName - Tags: - - { Key: prx:meta:tagging-version, Value: "2021-04-07" } - - { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName } - - { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId } - - { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName } - - { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId } - - { Key: prx:ops:environment, Value: !Ref EnvironmentType } - - { Key: prx:dev:application, Value: Styleguide } - TemplateURL: !Sub ${TemplateUrlPrefix}/styleguide.yml - TimeoutInMinutes: 20 - TheWorldWebsiteStack: Type: AWS::CloudFormation::Stack UpdateReplacePolicy: Delete diff --git a/spire/templates/apps/styleguide.yml b/spire/templates/apps/styleguide.yml deleted file mode 100644 index 141044b3..00000000 --- a/spire/templates/apps/styleguide.yml +++ /dev/null @@ -1,241 +0,0 @@ -# stacks/apps/styleguide.yml -# 100A -AWSTemplateFormatVersion: "2010-09-09" - -Description: >- - Creates an ECS service for Styleguide, along with target group and listener - rule for the shared ALB. - -Parameters: - kContainerName: - Type: String - Default: styleguide-web - kApplicationPort: - Type: Number - Default: 80 - ####### - NestedChangeSetScrubbingResourcesState: { Type: String } - AlbFullName: { Type: String } - AlbHttpsListenerArn: { Type: String } - EcsClusterArn: { Type: String } - EnvironmentType: { Type: String } - EnvironmentTypeAbbreviation: { Type: String } - RootStackName: { Type: String } - RootStackId: { Type: String } - VpcId: { Type: AWS::EC2::VPC::Id } - EcrImageTag: { Type: AWS::SSM::Parameter::Value } - AlbListenerRulePriorityPrefix: { Type: String } - X8664AsgCapacityProviderName: { Type: String } - -Conditions: - IsProduction: !Equals [!Ref EnvironmentType, Production] - EnableNestedChangeSetScrubbingResources: !Equals [!Ref NestedChangeSetScrubbingResourcesState, Enabled] - -Resources: - NestedChangeSetScrubber: { Type: AWS::SNS::Topic, Condition: EnableNestedChangeSetScrubbingResources } - - HostHeaderListenerRule: - Type: AWS::ElasticLoadBalancingV2::ListenerRule - Properties: - Actions: - - TargetGroupArn: !Ref TargetGroup - Type: forward - Conditions: - - Field: host-header - Values: - - styleguide.* - ListenerArn: !Ref AlbHttpsListenerArn - Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "01"]] - - TargetGroup: - Type: AWS::ElasticLoadBalancingV2::TargetGroup - Properties: - HealthCheckIntervalSeconds: 15 - HealthCheckPath: / - HealthCheckTimeoutSeconds: 5 - HealthyThresholdCount: 3 - Port: 80 - Protocol: HTTP - TargetGroupAttributes: - - Key: deregistration_delay.timeout_seconds - Value: "15" - Tags: - - { Key: Name, Value: !Sub "${RootStackName}_styleguide" } - - { Key: prx:meta:tagging-version, Value: "2021-04-07" } - - { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName } - - { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId } - - { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName } - - { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId } - - { Key: prx:ops:environment, Value: !Ref EnvironmentType } - - { Key: prx:dev:application, Value: Styleguide } - TargetType: instance - UnhealthyThresholdCount: 3 - VpcId: !Ref VpcId - TargetGroupHttp5xxAlarm: - Type: AWS::CloudWatch::Alarm - Properties: - AlarmName: !Sub INFO [Styleguide] Web server <${EnvironmentTypeAbbreviation}> RETURNING 5XX ERRORS (${RootStackName}) - AlarmDescription: !Sub >- - ${EnvironmentType} Styleguide's Storybook server is returning 5XX - errors from the ECS service to the load balancer. - ComparisonOperator: GreaterThanThreshold - Dimensions: - - Name: LoadBalancer - Value: !Ref AlbFullName - - Name: TargetGroup - Value: !GetAtt TargetGroup.TargetGroupFullName - EvaluationPeriods: 1 - MetricName: HTTPCode_Target_5XX_Count - Namespace: AWS/ApplicationELB - Period: 60 - Statistic: Sum - Tags: - - { Key: prx:meta:tagging-version, Value: "2021-04-07" } - - { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName } - - { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId } - - { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName } - - { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId } - - { Key: prx:ops:environment, Value: !Ref EnvironmentType } - - { Key: prx:ops:cloudwatch-log-group-name, Value: !Ref TaskLogGroup } - - { Key: prx:dev:application, Value: Styleguide } - Threshold: 0 - TreatMissingData: notBreaching - - EcsService: - Type: AWS::ECS::Service - Properties: - CapacityProviderStrategy: - - Base: 0 - CapacityProvider: !Ref X8664AsgCapacityProviderName - Weight: 1 - Cluster: !Ref EcsClusterArn - DeploymentConfiguration: - MaximumPercent: 200 - MinimumHealthyPercent: 50 - DesiredCount: 1 - EnableECSManagedTags: true - EnableExecuteCommand: true - LoadBalancers: - - ContainerName: !Ref kContainerName - ContainerPort: !Ref kApplicationPort - TargetGroupArn: !Ref TargetGroup - PlacementConstraints: - - Type: memberOf - Expression: attribute:ecs.cpu-architecture == x86_64 - PropagateTags: TASK_DEFINITION - Tags: - - { Key: prx:meta:tagging-version, Value: "2021-04-07" } - - { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName } - - { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId } - - { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName } - - { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId } - - { Key: prx:ops:environment, Value: !Ref EnvironmentType } - - { Key: prx:dev:application, Value: Styleguide } - TaskDefinition: !Ref TaskDefinition - - TaskLogGroup: - Type: AWS::Logs::LogGroup - DeletionPolicy: Delete - UpdateReplacePolicy: Delete - Properties: - RetentionInDays: 14 - Tags: - - { Key: prx:meta:tagging-version, Value: "2021-04-07" } - - { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName } - - { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId } - - { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName } - - { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId } - - { Key: prx:ops:environment, Value: !Ref EnvironmentType } - - { Key: prx:dev:application, Value: Styleguide } - - ExecutionRole: - Type: AWS::IAM::Role - Properties: - AssumeRolePolicyDocument: - Statement: - - Action: sts:AssumeRole - Effect: Allow - Principal: - Service: ecs-tasks.amazonaws.com - Version: "2012-10-17" - ManagedPolicyArns: - - arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy - Tags: - - { Key: prx:meta:tagging-version, Value: "2021-04-07" } - - { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName } - - { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId } - - { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName } - - { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId } - - { Key: prx:ops:environment, Value: !Ref EnvironmentType } - - { Key: prx:dev:application, Value: Styleguide } - TaskRole: - Type: AWS::IAM::Role - Properties: - AssumeRolePolicyDocument: - Statement: - - Action: sts:AssumeRole - Effect: Allow - Principal: - Service: ecs-tasks.amazonaws.com - Version: "2012-10-17" - Policies: - - PolicyDocument: - Statement: - - Action: - - ssmmessages:CreateControlChannel - - ssmmessages:CreateDataChannel - - ssmmessages:OpenControlChannel - - ssmmessages:OpenDataChannel - Effect: Allow - Resource: "*" - Sid: AllowSsmChannels - Version: "2012-10-17" - PolicyName: EcsExec - Tags: - - { Key: prx:meta:tagging-version, Value: "2021-04-07" } - - { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName } - - { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId } - - { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName } - - { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId } - - { Key: prx:ops:environment, Value: !Ref EnvironmentType } - - { Key: prx:dev:application, Value: Styleguide } - TaskDefinition: - Type: AWS::ECS::TaskDefinition - Properties: - ContainerDefinitions: - - Command: - - web - Cpu: !If [IsProduction, 100, 64] - Environment: - - Name: APP_NAME - Value: styleguide - - Name: APP_ENV - Value: !Ref EnvironmentTypeAbbreviation - - Name: AWS_DEFAULT_REGION - Value: !Ref AWS::Region - - Name: DUMMY - Value: value - Essential: true - Image: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${EcrImageTag} - LogConfiguration: - LogDriver: awslogs - Options: - awslogs-group: !Ref TaskLogGroup - awslogs-region: !Ref AWS::Region - awslogs-stream-prefix: ecs - Memory: !If [IsProduction, 400, 200] - Name: !Ref kContainerName - PortMappings: - - ContainerPort: !Ref kApplicationPort - HostPort: 0 - ExecutionRoleArn: !GetAtt ExecutionRole.Arn - NetworkMode: bridge - Tags: - - { Key: prx:meta:tagging-version, Value: "2021-04-07" } - - { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName } - - { Key: prx:cloudformation:stack-id, Value: !Ref AWS::StackId } - - { Key: prx:cloudformation:root-stack-name, Value: !Ref RootStackName } - - { Key: prx:cloudformation:root-stack-id, Value: !Ref RootStackId } - - { Key: prx:ops:environment, Value: !Ref EnvironmentType } - - { Key: prx:dev:application, Value: Styleguide } - TaskRoleArn: !GetAtt TaskRole.Arn diff --git a/spire/templates/root.yml b/spire/templates/root.yml index bebace04..4ddfc856 100644 --- a/spire/templates/root.yml +++ b/spire/templates/root.yml @@ -73,7 +73,6 @@ Mappings: Spots: { prefix: 38 } TheCount: { prefix: 42 } TheCastle: { prefix: 50 } # Legacy Castle - Styleguide: { prefix: 65 } Wfmt: { prefix: 77 } TheWorldWebsite: { prefix: 82 } SharedVpcCidrBlockMap: @@ -712,8 +711,6 @@ Resources: PlaySharedAlbListenerRulePriorityPrefix: !FindInMap [SharedAlbListenerRulePriorityMap, Play, prefix] - StyleguideSharedAlbListenerRulePriorityPrefix: !FindInMap [SharedAlbListenerRulePriorityMap, Styleguide, prefix] - TheWorldWebsiteSharedAlbListenerRulePriorityPrefix: !FindInMap [SharedAlbListenerRulePriorityMap, TheWorldWebsite, prefix] Tags: