|
46 | 46 | "ExistingVpcAndInternetGateway": { |
47 | 47 | "Fn::And": [ { "Condition": "ExistingVpc" }, { "Condition": "InternetGateway" } ] |
48 | 48 | }, |
| 49 | + "BuildUsingFargate": { |
| 50 | + "Fn::And": [ |
| 51 | + { |
| 52 | + "Fn::Equals": [ |
| 53 | + { "Fn::FindInMap": [ "RegionConfig", { "Ref": "AWS::Region" }, "Fargate" ] }, |
| 54 | + "Yes" |
| 55 | + ] |
| 56 | + }, |
| 57 | + { "Fn::Equals": [ { "Ref": "FargateBuild" }, "Yes" ] } |
| 58 | + ] |
| 59 | + }, |
49 | 60 | "HighAvailability": { "Fn::Equals": [ { "Ref": "HighAvailability" }, "true" ] }, |
50 | 61 | "HttpProxy": { "Fn::Not": [ { "Fn::Equals": [ { "Ref": "HttpProxy" }, "" ] } ] }, |
51 | 62 | "InstanceARM": { |
|
433 | 444 | "Value": { "Ref": "AWS::StackName" } |
434 | 445 | }, |
435 | 446 | "RackDomain": { |
436 | | - "Value": { |
| 447 | + "Value": { |
437 | 448 | "Fn::Join": [ ".", [ |
438 | 449 | "rack", |
439 | 450 | { "Fn::Select": [ 0, { "Fn::Split": [ ".", { "Fn::GetAtt": [ "ApiBalancer", "DNSName" ] } ] } ] }, |
|
765 | 776 | "Default": "false", |
766 | 777 | "AllowedValues": [ "true", "false" ] |
767 | 778 | }, |
| 779 | + "FargateBuild": { |
| 780 | + "Type": "String", |
| 781 | + "Description": "Use Fargate for build instances", |
| 782 | + "Default": "No", |
| 783 | + "AllowedValues": [ "Yes", "No" ] |
| 784 | + }, |
768 | 785 | "NoHaInstanceCount": { |
769 | 786 | "Default": "1", |
770 | 787 | "Description": "The number of instances in the runtime cluster for no HighAvailable racks", |
|
3000 | 3017 | { "Key": "Name", "Value": { "Ref": "AWS::StackName" }}, |
3001 | 3018 | { "Key": "Rack", "Value": { "Ref": "AWS::StackName" }}, |
3002 | 3019 | { "Key": "GatewayAttachment", "Value": { "Fn::If": [ "ExistingVpc", "existing",{ "Ref": "GatewayAttachment"}]}}, |
3003 | | - { "Key": "NatGateways", "Value": { "Fn::If": |
| 3020 | + { "Key": "NatGateways", "Value": { "Fn::If": |
3004 | 3021 | [ "PrivateInstances", |
3005 | 3022 | { |
3006 | 3023 | "Fn::Join": [ |
|
3262 | 3279 | { "Key": "Name", "Value": { "Ref": "AWS::StackName" }}, |
3263 | 3280 | { "Key": "Rack", "Value": { "Ref": "AWS::StackName" }}, |
3264 | 3281 | { "Key": "GatewayAttachment", "Value": { "Fn::If": [ "ExistingVpc", "existing",{ "Ref": "GatewayAttachment"}]}}, |
3265 | | - { "Key": "NatGateways", "Value": { "Fn::If": |
| 3282 | + { "Key": "NatGateways", "Value": { "Fn::If": |
3266 | 3283 | [ "PrivateInstances", |
3267 | 3284 | { |
3268 | 3285 | "Fn::Join": [ |
|
3968 | 3985 | "DeploymentConfiguration": { "MinimumHealthyPercent": { "Fn::If": [ "HighAvailability", "50", "0" ] }, "MaximumPercent": "200" }, |
3969 | 3986 | "DesiredCount": { "Fn::If": [ "HighAvailability", { "Ref": "ApiCount" }, 1 ] }, |
3970 | 3987 | "LoadBalancers": [ { "ContainerName": "web", "ContainerPort": "5443", "TargetGroupArn": { "Ref": "ApiBalancerTargetGroup" } }], |
3971 | | - "PlacementConstraints": [ { "Fn::If": ["SpotFleet", { "Type": "memberOf", "Expression": "attribute:asg == primary" }, { "Ref": "AWS::NoValue" }] } ], |
| 3988 | + "PlacementConstraints": [ { "Fn::If": ["SpotFleet", { "Type": "memberOf", "Expression": "attribute:asg == primary" }, { "Ref": "AWS::NoValue" }] } ], |
3972 | 3989 | "Role": { "Fn::GetAtt": [ "ServiceRole", "Arn" ] }, |
3973 | 3990 | "TaskDefinition": { "Ref": "ApiWebTasks" } |
3974 | 3991 | } |
3975 | 3992 | }, |
3976 | 3993 | "ApiBuildTasks": { |
3977 | 3994 | "Type": "AWS::ECS::TaskDefinition", |
3978 | 3995 | "Properties": { |
| 3996 | + "RequiresCompatibilities": [ |
| 3997 | + { "Fn::If": [ "BuildUsingFargate", "FARGATE", "EC2" ] } |
| 3998 | + ], |
| 3999 | + "NetworkMode": { "Fn::If": [ "BuildUsingFargate", "awsvpc", "bridge" ] }, |
| 4000 | + "Cpu": { "Ref": "BuildCpu" }, |
| 4001 | + "Memory": { "Ref": "BuildMemory" }, |
3979 | 4002 | "ContainerDefinitions": [ |
3980 | 4003 | { |
3981 | | - "Cpu": { "Ref": "BuildCpu" }, |
3982 | 4004 | "DockerLabels": { |
3983 | 4005 | "convox.release": { "Ref": "Version" }, |
3984 | 4006 | "rack.ApiBalancerSecurity": { "Ref": "ApiBalancerSecurity" }, |
|
4079 | 4101 | "LinuxParameters": { |
4080 | 4102 | "InitProcessEnabled": "true" |
4081 | 4103 | }, |
4082 | | - "Memory": { "Ref": "BuildMemory" }, |
4083 | 4104 | "ReadonlyRootFilesystem": { "Fn::If": [ "EnableContainerReadonlyRootFilesystem", "true", "false" ] }, |
4084 | | - "MountPoints": [ |
4085 | | - { "SourceVolume": "config", "ContainerPath": "/etc/sysconfig/docker" }, |
4086 | | - { "SourceVolume": "docker", "ContainerPath": "/var/run/docker.sock" }, |
4087 | | - { "SourceVolume": "home", "ContainerPath": "/root/" }, |
4088 | | - { "SourceVolume": "temp", "ContainerPath": "/tmp/" } |
4089 | | - ], |
| 4105 | + "MountPoints": { |
| 4106 | + "Fn::If": [ |
| 4107 | + "BuildUsingFargate", |
| 4108 | + { "Ref": "AWS::NoValue" }, |
| 4109 | + [ |
| 4110 | + { "SourceVolume": "config", "ContainerPath": "/etc/sysconfig/docker" }, |
| 4111 | + { "SourceVolume": "docker", "ContainerPath": "/var/run/docker.sock" }, |
| 4112 | + { "SourceVolume": "home", "ContainerPath": "/root/" }, |
| 4113 | + { "SourceVolume": "temp", "ContainerPath": "/tmp/" } |
| 4114 | + ] |
| 4115 | + ] |
| 4116 | + }, |
4090 | 4117 | "Name": "build", |
4091 | 4118 | "Secrets": [{ |
4092 | 4119 | "Name": "PASSWORD", |
|
4097 | 4124 | "ExecutionRoleArn": { "Fn::GetAtt": [ "ApiRole", "Arn" ] }, |
4098 | 4125 | "Family": { "Fn::Sub": "${AWS::StackName}-build" }, |
4099 | 4126 | "TaskRoleArn": { "Fn::GetAtt": [ "ApiRole", "Arn" ] }, |
4100 | | - "Volumes": [ |
4101 | | - { "Name": "config", "Host": { "SourcePath": "/etc/sysconfig/docker" } }, |
4102 | | - { "Name": "docker", "Host": { "SourcePath": "/var/run/docker.sock" } }, |
4103 | | - { "Name": "home" }, |
4104 | | - { "Name": "temp" } |
4105 | | - ] |
| 4127 | + "Volumes": { |
| 4128 | + "Fn::If": [ |
| 4129 | + "BuildUsingFargate", |
| 4130 | + { "Ref": "AWS::NoValue" }, |
| 4131 | + [ |
| 4132 | + { "Name": "config", "Host": { "SourcePath": "/etc/sysconfig/docker" } }, |
| 4133 | + { "Name": "docker", "Host": { "SourcePath": "/var/run/docker.sock" } }, |
| 4134 | + { "Name": "home" }, |
| 4135 | + { "Name": "temp" } |
| 4136 | + ] |
| 4137 | + ] |
| 4138 | + } |
4106 | 4139 | } |
4107 | 4140 | }, |
4108 | 4141 | "ApiMonitorTasks": { |
|
4515 | 4548 | "VersioningConfiguration": { "Status" : {"Ref": "EnableS3Versioning" } }, |
4516 | 4549 | "LifecycleConfiguration": { "Fn::If": [ "BlankLogRetention", |
4517 | 4550 | { "Rules": [ { "NoncurrentVersionExpiration": { "NewerNoncurrentVersions" : 1, "NoncurrentDays" : 365 }, "Status": "Enabled" } ] }, |
4518 | | - { "Rules": [ |
| 4551 | + { "Rules": [ |
4519 | 4552 | { "ExpirationInDays": { "Ref": "LogRetention" }, "Status": "Enabled" }, |
4520 | 4553 | { "NoncurrentVersionExpiration": { "NewerNoncurrentVersions" : 1, "NoncurrentDays" : 365 }, "Status": "Enabled" } |
4521 | 4554 | ] } |
|
0 commit comments