-
Notifications
You must be signed in to change notification settings - Fork 0
/
CDK-lite-template.yaml
172 lines (158 loc) · 5.32 KB
/
CDK-lite-template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
AWSTemplateFormatVersion: 2010-09-09
Description: >-
Create resources and deploy Conduktor
As per: https://docs.conduktor.io/platform/installation/get-started/AWS/
This template will assume you have a VPC (+subnet),Security Group, RDS Database and a ECS cluster running!
This template will deploy the following:
- Service (Fargate)
- Service Task
- Log group for your service
- IAM (ECS Task Execution Role)
**Please fill the values below**
Parameters:
ClusterArn:
Type: String
AllowedPattern: arn:aws:ecs:.*:.*:cluster/.*
Description: The ARN value for your cluster
SecurityGroup:
Type: String
AllowedPattern: sg-.*
Description: The Security Group to have access to this ECS service
Subnet:
Type: String
AllowedPattern: subnet-.*
Description: The Subnet you want to use for this ECS service
DatabaseName:
Type: String
AllowedPattern: .+
Description: The name of the database
DatabaseUsername:
Type: String
AllowedPattern: .+
Description: The username for the database
DatabasePassword:
Type: String
AllowedPattern: .+
Description: The password for the database
DatabaseEndpoint:
Type: String
AllowedPattern: .*:.*:.*:.*:.*
Description: The endpoint for the database
Resources:
ECSService:
Type: AWS::ECS::Service
Properties:
Cluster: !Ref ClusterArn
DesiredCount: 1
LaunchType: FARGATE
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: ENABLED
SecurityGroups:
- !Ref SecurityGroup
Subnets:
- !Ref Subnet
TaskDefinition: !Ref 'ECSTaskDefinition'
ServiceName: !Sub ${AWS::StackName}-conduktor-ecs-service
ECSTaskDefinition:
Type: 'AWS::ECS::TaskDefinition'
Properties:
Family: conduktor-console
RequiresCompatibilities:
- FARGATE
NetworkMode: awsvpc
ExecutionRoleArn: !Ref ECSTaskExecutionRole
Cpu: '2048'
Memory: '4096'
RuntimePlatform:
CpuArchitecture: X86_64
OperatingSystemFamily: LINUX
ContainerDefinitions:
- Name: conduktor-console
Image: conduktor/conduktor-console:1.25.1
Essential: true
Environment:
- Name: CDK_DATABASE_HOST
Value: !Ref DatabaseEndpoint
- Name: CDK_MONITORING_ALERT-MANAGER-URL
Value: http://localhost:9010/
- Name: CDK_MONITORING_CORTEX-URL
Value: http://localhost:9009/
- Name: CDK_DATABASE_PORT
Value: '5432'
- Name: CDK_DATABASE_USERNAME
Value: !Ref 'DatabaseUsername'
- Name: CDK_DATABASE_PASSWORD
Value: !Ref 'DatabasePassword'
- Name: CDK_MONITORING_CALLBACK-URL
Value: http://localhost:8080/monitoring/api/
- Name: CDK_DATABASE_NAME
Value: !Ref DatabaseName
- Name: CDK_MONITORING_NOTIFICATIONS-CALLBACK-URL
Value: http://localhost:8080
PortMappings:
- Name: console-8080-tcp
ContainerPort: 8080
HostPort: 8080
Protocol: tcp
HealthCheck:
Command: ['CMD-SHELL',
'curl --fail http://localhost:${CDK_LISTENING_PORT:-8080}/platform/api/modules/health/live']
Interval: 5
Retries: 2
Timeout: 3
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-region: !Ref AWS::Region
awslogs-group: !Ref LogGroup
awslogs-stream-prefix: ecs
- Name: conduktor-monitoring
Image: conduktor/conduktor-console-cortex:1.25.1
Environment:
- Name: CDK_CONSOLE-URL
Value: http://localhost:8080
PortMappings:
- Name: conduktor-cortex-9090-tcp
ContainerPort: 9090
HostPort: 9090
- Name: conduktor-cortex-9010-tcp
ContainerPort: 9010
HostPort: 9010
- Name: conduktor-cortex-9009-tcp
ContainerPort: 9009
HostPort: 9009
HealthCheck:
Command: ['CMD-SHELL',
'curl --fail http://localhost:${CDK_LISTENING_PORT:-8080}/platform/api/modules/health/live']
Interval: 5
Retries: 2
Timeout: 3
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-region: !Ref AWS::Region
awslogs-group: !Ref LogGroup
awslogs-stream-prefix: ecs
LogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: Sub ${AWS::StackName}-conduktor-lite
Tags:
- Key: Name
Value: ConduktorConsoleLogGroup
ECSTaskExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
Action: 'sts:AssumeRole'
ManagedPolicyArns:
# https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonECSTaskExecutionRolePolicy.html
- 'arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy'
Tags:
- Key: Name
Value: ConduktorConsoleECSTaskExecutionRole