Skip to content

Commit

Permalink
Merge pull request #707 from PRX/remove-play-proxy
Browse files Browse the repository at this point in the history
Remove Play proxy server
  • Loading branch information
farski authored Sep 28, 2023
2 parents 58cba57 + 9de4009 commit e6daf75
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 203 deletions.
3 changes: 0 additions & 3 deletions spire/templates/apps-100A.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ Resources:
EcsClusterArn: !Ref EcsClusterArn
VpcId: !Ref VpcId
EcrImageTag: !Sub /prx/${EnvironmentTypeAbbreviation}/Spire/Dovetail-Play/pkg/docker-image-tag
ProxyEcrImageTag: !Sub /prx/${EnvironmentTypeAbbreviation}/Spire/Dovetail-Play/proxy/pkg/docker-image-tag
AlbListenerRulePriorityPrefix: !Ref PlaySharedAlbListenerRulePriorityPrefix
EnvironmentType: !Ref EnvironmentType
EnvironmentTypeAbbreviation: !Ref EnvironmentTypeAbbreviation
Expand Down Expand Up @@ -542,8 +541,6 @@ Outputs:
IframelyTargetGroupFullName:
Value: !GetAtt IframelyStack.Outputs.TargetGroupFullName

PlayProxyTargetGroupFullName:
Value: !GetAtt PlayStack.Outputs.ProxyTargetGroupFullName
PlayWebTargetGroupFullName:
Value: !GetAtt PlayStack.Outputs.WebTargetGroupFullName

Expand Down
197 changes: 0 additions & 197 deletions spire/templates/apps/play.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ Parameters:
kApplicationPort:
Type: Number
Default: 4300
kProxyContainerName:
Type: String
Default: play-proxy
kProxyApplicationPort:
Type: Number
Default: 3000
#######
AlbFullName: { Type: String }
AlbHttpsListenerArn: { Type: String }
Expand All @@ -32,28 +26,12 @@ Parameters:
CloudWatchAlarmTaggerServiceToken: { Type: String }
VpcId: { Type: AWS::EC2::VPC::Id }
EcrImageTag: { Type: AWS::SSM::Parameter::Value<String> }
ProxyEcrImageTag: { Type: AWS::SSM::Parameter::Value<String> }
AlbListenerRulePriorityPrefix: { Type: String }

Conditions:
IsProduction: !Equals [!Ref EnvironmentType, Production]

Resources:
ProxyPathListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
Actions:
- TargetGroupArn: !Ref ProxyTargetGroup
Type: forward
Conditions:
- Field: host-header
Values:
- play*.*
- Field: path-pattern
Values:
- /proxy*
ListenerArn: !Ref AlbHttpsListenerArn
Priority: !Join ["", [!Ref AlbListenerRulePriorityPrefix, "25"]]
HostHeaderListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
Expand Down Expand Up @@ -265,181 +243,6 @@ Resources:
- { Key: prx:dev:application, Value: Play }
TaskRoleArn: !GetAtt TaskRole.Arn

ProxyTargetGroup:
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}_play_proxy" }
- { 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:family, Value: Dovetail }
- { Key: prx:dev:application, Value: Play }
TargetType: instance
UnhealthyThresholdCount: 3
VpcId: !Ref VpcId
ProxyTargetGroupSustainedHttp5xxAlarm:
Type: AWS::CloudWatch::Alarm
Condition: IsProduction
Properties:
AlarmName: !Sub ERROR [Play] Proxy server <${EnvironmentTypeAbbreviation}> SUSTAINED 5XX ERRORS (${RootStackName})
AlarmDescription: !Sub >-
${EnvironmentType} Play's feed proxy server is returning 5XX errors
from the ECS service to the load balancer.
ComparisonOperator: GreaterThanThreshold
DatapointsToAlarm: 3 # M in M-out-of-N alarms
Dimensions:
- Name: LoadBalancer
Value: !Ref AlbFullName
- Name: TargetGroup
Value: !GetAtt WebTargetGroup.TargetGroupFullName
EvaluationPeriods: 10 # N in M-out-of-N alarms
MetricName: HTTPCode_Target_5XX_Count
Namespace: AWS/ApplicationELB
Period: 60
Statistic: Sum
Threshold: 5
TreatMissingData: notBreaching
ProxyTargetGroupSustainedHttp5xxAlarmTags:
Type: Custom::CloudWatchAlarmTags
Condition: IsProduction
Properties:
ServiceToken: !Ref CloudWatchAlarmTaggerServiceToken
AlarmArn: !GetAtt ProxyTargetGroupSustainedHttp5xxAlarm.Arn
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 ProxyTaskLogGroup }
- { Key: prx:dev:family, Value: Dovetail }
- { Key: prx:dev:application, Value: Play }
ProxyTargetGroupHttp5xxSpikeAlarm:
Type: AWS::CloudWatch::Alarm
Condition: IsProduction
Properties:
AlarmName: !Sub ERROR [Play] Proxy server <${EnvironmentTypeAbbreviation}> 5XX ERRORS SPIKE (${RootStackName})
AlarmDescription: !Sub >-
${EnvironmentType} Play's feed proxy 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 WebTargetGroup.TargetGroupFullName
EvaluationPeriods: 1 # N in M-out-of-N alarms
MetricName: HTTPCode_Target_5XX_Count
Namespace: AWS/ApplicationELB
Period: 60
Statistic: Sum
Threshold: 15
TreatMissingData: notBreaching
ProxyTargetGroupHttp5xxAlarmTags:
Type: Custom::CloudWatchAlarmTags
Condition: IsProduction
Properties:
ServiceToken: !Ref CloudWatchAlarmTaggerServiceToken
AlarmArn: !GetAtt ProxyTargetGroupHttp5xxSpikeAlarm.Arn
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 ProxyTaskLogGroup }
- { Key: prx:dev:family, Value: Dovetail }
- { Key: prx:dev:application, Value: Play }

ProxyEcsService:
Type: AWS::ECS::Service
Properties:
Cluster: !Ref EcsClusterArn
DeploymentConfiguration:
MaximumPercent: 200
MinimumHealthyPercent: 50
DesiredCount: 1
EnableECSManagedTags: true
LoadBalancers:
- ContainerName: !Ref kProxyContainerName
ContainerPort: !Ref kProxyApplicationPort
TargetGroupArn: !Ref ProxyTargetGroup
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:family, Value: Dovetail }
- { Key: prx:dev:application, Value: Play }
TaskDefinition: !Ref ProxyTaskDefinition
ProxyTaskLogGroup:
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:family, Value: Dovetail }
- { Key: prx:dev:application, Value: Play }
ProxyTaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
ContainerDefinitions:
- Cpu: 64
Essential: true
Image: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${ProxyEcrImageTag}
LinuxParameters:
InitProcessEnabled: true
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group: !Ref ProxyTaskLogGroup
awslogs-region: !Ref AWS::Region
awslogs-stream-prefix: ecs
Memory: 200
Name: !Ref kProxyContainerName
PortMappings:
- ContainerPort: !Ref kProxyApplicationPort
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:family, Value: Dovetail }
- { Key: prx:dev:application, Value: Play }
TaskRoleArn: !GetAtt TaskRole.Arn

Outputs:
ProxyTargetGroupFullName:
Value: !GetAtt ProxyTargetGroup.TargetGroupFullName
WebTargetGroupFullName:
Value: !GetAtt WebTargetGroup.TargetGroupFullName
2 changes: 0 additions & 2 deletions spire/templates/dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ Parameters:

NetworksPublicWebTargetGroupFullName: { Type: String }

PlayProxyTargetGroupFullName: { Type: String }
PlayWebTargetGroupFullName: { Type: String }

ProxyApiDefaultEndpoint: { Type: String }
Expand Down Expand Up @@ -169,7 +168,6 @@ Resources:
[ "AWS/ApplicationELB", "RequestCount", "TargetGroup", "${IframelyTargetGroupFullName}", "LoadBalancer", "${SharedAlbFullName}", { "label": "Iframely" } ],
[ "AWS/ApplicationELB", "RequestCount", "TargetGroup", "${MetricsTargetGroupFullName}", "LoadBalancer", "${SharedAlbFullName}", { "label": "Metrics" } ],
[ "AWS/ApplicationELB", "RequestCount", "TargetGroup", "${NetworksPublicWebTargetGroupFullName}", "LoadBalancer", "${SharedAlbFullName}", { "label": "Networks" } ],
[ "AWS/ApplicationELB", "RequestCount", "TargetGroup", "${PlayProxyTargetGroupFullName}", "LoadBalancer", "${SharedAlbFullName}", { "label": "Play::Proxy" } ],
[ "AWS/ApplicationELB", "RequestCount", "TargetGroup", "${PlayWebTargetGroupFullName}", "LoadBalancer", "${SharedAlbFullName}", { "label": "Play::Web" } ],
[ "AWS/ApiGateway", "Count", "ApiId", "${ProxyApiId}", { "label": "Proxy" } ],
[ "AWS/ApplicationELB", "RequestCount", "TargetGroup", "${PublishTargetGroupFullName}", "LoadBalancer", "${SharedAlbFullName}", { "label": "Publish" } ],
Expand Down
1 change: 0 additions & 1 deletion spire/templates/root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,6 @@ Resources:

NetworksPublicWebTargetGroupFullName: !GetAtt Apps200AStack.Outputs.NetworksPublicWebTargetGroupFullName

PlayProxyTargetGroupFullName: !GetAtt Apps100AStack.Outputs.PlayProxyTargetGroupFullName
PlayWebTargetGroupFullName: !GetAtt Apps100AStack.Outputs.PlayWebTargetGroupFullName

ProxyApiDefaultEndpoint: !GetAtt Apps300AStack.Outputs.ProxyApiDefaultEndpoint
Expand Down

0 comments on commit e6daf75

Please sign in to comment.