Skip to content

Commit f762bc6

Browse files
committed
Revert "Merge pull request #865 from PRX/wordpress-fargate"
This reverts commit 9a595c3, reversing changes made to 85573a5.
1 parent 9a595c3 commit f762bc6

File tree

3 files changed

+21
-26
lines changed

3 files changed

+21
-26
lines changed

theworld/terra/templates/apps/wordpress.yml

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,13 @@ Parameters:
3333
RootStackName: { Type: String }
3434
RootStackId: { Type: String }
3535
VpcId: { Type: AWS::EC2::VPC::Id }
36-
VpcPublicSubnet1Id: { Type: AWS::EC2::Subnet::Id }
37-
VpcPublicSubnet2Id: { Type: AWS::EC2::Subnet::Id }
38-
VpcPublicSubnet3Id: { Type: AWS::EC2::Subnet::Id }
3936
EcrImageTag: { Type: AWS::SSM::Parameter::Value<String> }
4037
AlbListenerRulePriorityPrefix: { Type: String }
38+
Aarch64AsgCapacityProviderName: { Type: String }
4139
MysqlHostname: { Type: String }
4240
ValkeyHostname: { Type: String }
4341
ValkeyPort: { Type: String }
4442
AlbAccessToken: { Type: AWS::SSM::Parameter::Value<String> }
45-
SharedEcsAsgInstanceSecurityGroupId: { Type: AWS::EC2::SecurityGroup::Id }
4643

4744
Conditions:
4845
IsProduction: !Equals [!Ref EnvironmentType, Production]
@@ -186,7 +183,6 @@ Resources:
186183
TargetGroupAttributes:
187184
- Key: deregistration_delay.timeout_seconds
188185
Value: "30"
189-
TargetType: ip
190186
Tags:
191187
- { Key: Name, Value: !Sub "${RootStackName}_wordpress" }
192188
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
@@ -265,27 +261,24 @@ Resources:
265261
WebEcsService:
266262
Type: AWS::ECS::Service
267263
Properties:
264+
CapacityProviderStrategy:
265+
- Base: 0
266+
CapacityProvider: !Ref Aarch64AsgCapacityProviderName
267+
Weight: 1
268268
Cluster: !Ref EcsClusterArn
269269
DeploymentConfiguration:
270270
MaximumPercent: 200
271271
MinimumHealthyPercent: 50
272272
DesiredCount: !If [IsProduction, 5, 1]
273273
EnableECSManagedTags: true
274274
EnableExecuteCommand: true
275-
LaunchType: FARGATE
276275
LoadBalancers:
277276
- ContainerName: !Ref kWebContainerName
278277
ContainerPort: !Ref kWebApplicationPort
279278
TargetGroupArn: !Ref WebTargetGroup
280-
NetworkConfiguration:
281-
AwsvpcConfiguration:
282-
AssignPublicIp: ENABLED
283-
SecurityGroups:
284-
- !Ref SharedEcsAsgInstanceSecurityGroupId
285-
Subnets:
286-
- !Ref VpcPublicSubnet1Id
287-
- !Ref VpcPublicSubnet2Id
288-
- !Ref VpcPublicSubnet3Id
279+
PlacementConstraints:
280+
- Type: memberOf
281+
Expression: attribute:ecs.cpu-architecture == arm64
289282
PropagateTags: TASK_DEFINITION
290283
Tags:
291284
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
@@ -315,10 +308,9 @@ Resources:
315308
WebTaskDefinition:
316309
Type: AWS::ECS::TaskDefinition
317310
Properties:
318-
Cpu: !If [IsProduction, 2048, 512] # 512 = 0.5 vCPU, 2048 = 2 vCPU, etc
319-
Memory: !If [IsProduction, 8192, 2048]
320311
ContainerDefinitions:
321-
- Environment:
312+
- Cpu: 100 # Currently we don't use CPU reservations for anything meaningful
313+
Environment:
322314
- Name: PRX_ENVIRONMENT
323315
Value: !Ref EnvironmentTypeLowercase
324316
- Name: DB_HOST
@@ -381,10 +373,17 @@ Resources:
381373
awslogs-group: !Ref WebTaskLogGroup
382374
awslogs-region: !Ref AWS::Region
383375
awslogs-stream-prefix: ecs
376+
# Memory and MemoryReservation values are based on current instances
377+
# sizes, ensuring that only 1 WordPress task is running on any
378+
# instance
379+
# Prod: c8g.xlarge => 8 GiB
380+
# Stag: t4g.small => 2 GiB
381+
Memory: !If [IsProduction, 7650, 1800]
382+
MemoryReservation: !If [IsProduction, 4111, 1111]
384383
Name: !Ref kWebContainerName
385384
PortMappings:
386385
- ContainerPort: !Ref kWebApplicationPort
387-
Protocol: tcp
386+
HostPort: 0
388387
Secrets:
389388
- Name: AUTH_KEY
390389
ValueFrom: !Sub /prx/${EnvironmentTypeAbbreviation}/Terra/The_World-WordPress/auth-key
@@ -417,9 +416,7 @@ Resources:
417416
- Name: DB_PASSWORD
418417
ValueFrom: !Sub /prx/${EnvironmentTypeAbbreviation}/Terra/The_World-WordPress/mysql/password
419418
ExecutionRoleArn: !GetAtt ExecutionRole.Arn
420-
NetworkMode: awsvpc
421-
RequiresCompatibilities:
422-
- FARGATE
419+
NetworkMode: bridge
423420
Tags:
424421
- { Key: prx:meta:tagging-version, Value: "2021-04-07" }
425422
- { Key: prx:cloudformation:stack-name, Value: !Ref AWS::StackName }

theworld/terra/templates/root.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,6 @@ Resources:
440440
EcsClusterName: !GetAtt SharedEcsClusterStack.Outputs.EcsClusterName
441441
EcsClusterArn: !GetAtt SharedEcsClusterStack.Outputs.EcsClusterArn
442442
VpcId: !GetAtt SharedVpcStack.Outputs.VpcId
443-
VpcPublicSubnet1Id: !GetAtt SharedVpcStack.Outputs.PublicSubnet1Id
444-
VpcPublicSubnet2Id: !GetAtt SharedVpcStack.Outputs.PublicSubnet2Id
445-
VpcPublicSubnet3Id: !GetAtt SharedVpcStack.Outputs.PublicSubnet3Id
446443
EcrImageTag: !Sub /prx/${EnvironmentTypeAbbreviation}/Terra/The_World-WordPress/pkg/docker-image-tag
447444
AlbListenerRulePriorityPrefix: !FindInMap [SharedAlbListenerRulePriorityMap, WordPress, prefix]
448445
EnvironmentType: !Ref EnvironmentType
@@ -451,11 +448,11 @@ Resources:
451448
RegionMode: !FindInMap [RegionModeMap, !Ref "AWS::Region", !Ref EnvironmentType]
452449
RootStackName: !Ref AWS::StackName
453450
RootStackId: !Ref AWS::StackId
451+
Aarch64AsgCapacityProviderName: !GetAtt SharedEcsAsgAarch64Stack.Outputs.CapacityProviderName
454452
MysqlHostname: !GetAtt SharedAuroraMysqlStack.Outputs.DbHostname
455453
ValkeyHostname: !GetAtt SharedValkeyStack.Outputs.CacheEndpointAddress
456454
ValkeyPort: !GetAtt SharedValkeyStack.Outputs.CacheEndpointPort
457455
AlbAccessToken: !Sub /prx/${EnvironmentTypeAbbreviation}/Terra/The_World-WordPress/alb-access-token
458-
SharedEcsAsgInstanceSecurityGroupId: !GetAtt SharedEcsAsgSecurityGroupStack.Outputs.InstanceSecurityGroupId
459456
Tags:
460457
"prx:meta:tagging-version": "2021-04-07"
461458
"prx:cloudformation:stack-name": !Ref AWS::StackName

theworld/terra/templates/shared-alb.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Parameters:
2525
CertificateArn: { Type: String }
2626
MaintenanceMode: { Type: String, Default: "Off" }
2727

28+
2829
Conditions:
2930
IsProduction: !Equals [!Ref EnvironmentType, Production]
3031
IsMaintenanceMode: !Equals [!Ref MaintenanceMode, "On"]

0 commit comments

Comments
 (0)