Add redis service
This commit is contained in:
@@ -3,7 +3,7 @@ Description: Deploy robot shop services to a given ECS cluster
|
|||||||
Parameters:
|
Parameters:
|
||||||
StackName:
|
StackName:
|
||||||
Type: String
|
Type: String
|
||||||
Default: production
|
Default: ecs-ec2-robotshop
|
||||||
Description: The name of the parent cluster stack that you created. Necessary
|
Description: The name of the parent cluster stack that you created. Necessary
|
||||||
to locate and reference resources created by that stack.
|
to locate and reference resources created by that stack.
|
||||||
WebServiceName:
|
WebServiceName:
|
||||||
@@ -14,6 +14,10 @@ Parameters:
|
|||||||
Type: String
|
Type: String
|
||||||
Default: mongodb
|
Default: mongodb
|
||||||
Description: The mongodb service name
|
Description: The mongodb service name
|
||||||
|
RedisServiceName:
|
||||||
|
Type: String
|
||||||
|
Default: redis
|
||||||
|
Description: The redis service name
|
||||||
ImageUrl:
|
ImageUrl:
|
||||||
Type: String
|
Type: String
|
||||||
Default: nginx
|
Default: nginx
|
||||||
@@ -27,6 +31,10 @@ Parameters:
|
|||||||
Type: Number
|
Type: Number
|
||||||
Default: 27017
|
Default: 27017
|
||||||
Description: What port number the application inside the docker container is binding to
|
Description: What port number the application inside the docker container is binding to
|
||||||
|
RedisContainerPort:
|
||||||
|
Type: Number
|
||||||
|
Default: 6379
|
||||||
|
Description: What port number the application inside the docker container is binding to
|
||||||
ContainerCpu:
|
ContainerCpu:
|
||||||
Type: Number
|
Type: Number
|
||||||
Default: 256
|
Default: 256
|
||||||
@@ -93,6 +101,38 @@ Resources:
|
|||||||
DesiredCount: 1
|
DesiredCount: 1
|
||||||
TaskDefinition: !Ref 'MongoDbTaskDefinition'
|
TaskDefinition: !Ref 'MongoDbTaskDefinition'
|
||||||
|
|
||||||
|
# Redis service
|
||||||
|
RedisTaskDefinition:
|
||||||
|
Type: AWS::ECS::TaskDefinition
|
||||||
|
Properties:
|
||||||
|
Family: !Ref 'RedisServiceName'
|
||||||
|
Cpu: !Ref 'ContainerCpu'
|
||||||
|
Memory: !Ref 'ContainerMemory'
|
||||||
|
TaskRoleArn:
|
||||||
|
Fn::If:
|
||||||
|
- 'HasCustomRole'
|
||||||
|
- !Ref 'Role'
|
||||||
|
- !Ref "AWS::NoValue"
|
||||||
|
ContainerDefinitions:
|
||||||
|
- Name: !Ref 'RedisServiceName'
|
||||||
|
Cpu: !Ref 'ContainerCpu'
|
||||||
|
Memory: !Ref 'ContainerMemory'
|
||||||
|
Image: redis:4.0.6
|
||||||
|
PortMappings:
|
||||||
|
- ContainerPort: !Ref 'RedisContainerPort'
|
||||||
|
LogConfiguration:
|
||||||
|
LogDriver: json-file
|
||||||
|
RedisService:
|
||||||
|
Type: AWS::ECS::Service
|
||||||
|
DependsOn: LoadBalancerRule
|
||||||
|
Properties:
|
||||||
|
ServiceName: !Ref 'RedisServiceName'
|
||||||
|
Cluster:
|
||||||
|
Fn::ImportValue:
|
||||||
|
!Join [':', [!Ref 'StackName', 'ClusterName']]
|
||||||
|
DesiredCount: 1
|
||||||
|
TaskDefinition: !Ref 'RedisTaskDefinition'
|
||||||
|
|
||||||
WebTaskDefinition:
|
WebTaskDefinition:
|
||||||
Type: AWS::ECS::TaskDefinition
|
Type: AWS::ECS::TaskDefinition
|
||||||
Properties:
|
Properties:
|
||||||
|
Reference in New Issue
Block a user