forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
end-to-end-full-link-tracking-and-diagnosis.yaml
442 lines (439 loc) · 16 KB
/
end-to-end-full-link-tracking-and-diagnosis.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 端到端全链路追踪诊断。
en: End-to-end full-link tracking and diagnosis.
Parameters:
ZoneId:
Type: String
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
Label:
en: VSwitch Availability Zone
zh-cn: 交换机可用区
ECSInstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例规格
Description:
en: <font color='blue'><b>Before selecting a model, please confirm whether the model is in stock in the current availability zone. To save testing costs, it is recommended to use a model with 2 cores and 4G memory, for example:ecs.c7.large</b></font>.
zh-cn: <font color='blue'><b>选择机型前请先确认当前可用区下该机型是否有库存,为节省测试成本,推荐使用2核4G内存的规格,例如:ecs.c7.large</b></font>。
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ZoneId
ECSPassword:
Type: String
Label:
en: root account password
zh-cn: root 账号密码
Description:
en: Server root account login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
zh-cn: 服务器root账号登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
ConstraintDescription:
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
AllowedPattern: '[0-9A-Za-z\_\-\&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$'
MinLength: 8
MaxLength: 30
NoEcho: true
DBInstanceClass:
Type: String
Label:
en: RDS Instance Class
zh-cn: RDS实例规格
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId:
Ref: ZoneId
EngineVersion: '8.0'
DBInstanceStorageType: cloud_essd
Engine: MySQL
Category: Basic
CommodityCode: bards
Default: mysql.n2m.medium.2c
DBAccountName:
Type: String
ConstraintDescription:
en: >-
Consist of 2 to 32 characters of lowercase letters, underline.
Must begin with a letter and be end with an alphanumeric character
zh-cn: >-
由 2 到 32 个小写字母组成,支持小写字母、数字和下划线,以小写字母开头。
Label:
zh-cn: RDS数据库账号
en: RDS DB Username
Default: db_normal_account
AllowedPattern: '^[a-z][a-z0-9_]{0,31}$'
DBPassword:
NoEcho: true
Type: String
Description:
en: >-
RDS user password, Length 8-30, must contain three(Capital letters,
lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special
symbol in)
zh-cn: >-
数据库账号密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
中的特殊符号)
Label:
en: RDS Instance Password
zh-cn: RDS数据库密码
ConstraintDescription:
en: >-
Length 8-30, must contain three(Capital letters, lowercase letters,
numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)
zh-cn: '长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/ 中的特殊符号)'
AssociationProperty: ALIYUN::RDS::Instance::AccountPassword
RedisClass:
Type: String
Label:
en: Tair Specifications
zh-cn: Tair 规格
Description:
en: <font color='blue'><b>Before selecting a model, please confirm whether the model is in stock in the current availability zone. To save testing costs, it is recommended to use a model with 1G memory, for example:redis.shard.small.2.ce</b></font>, see detail:<a href='https://help.aliyun.com/zh/redis/product-overview/cost-efficient-instances' target='_blank'><b><font color='red'>Specification inquiry</font></b></a>.
zh-cn: <font color='blue'><b>选择机型前请先确认当前可用区下该机型是否有库存,为节省测试成本,推荐使用1GB的规格,例如:redis.shard.small.2.ce</b></font>,<a href='https://help.aliyun.com/zh/redis/product-overview/cost-efficient-instances' target='_blank'><b><font color='red'>规格查询</font></b></a>。
AssociationProperty: ALIYUN::REDIS::Instance::InstanceClass
AssociationPropertyMetadata:
Engine: Redis
ProductType: OnECS
InstanceChargeType: PostPaid
ZoneId: ${ZoneId}
OrderType: BUY
Default: redis.shard.small.2.ce
RedisAccountPassword:
NoEcho: true
Type: String
Description:
en: RDS user password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)
zh-cn: 数据库账号密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)
Label:
en: Tair Instance Password
zh-cn: Tair 数据库密码
ConstraintDescription:
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)
zh-cn: 必须包含三种及以上类型:大写字母、小写字母、数字、特殊符号。长度为8~32位。特殊字符包括!@#$%^&*()_+-=
AssociationProperty: ALIYUN::RDS::Instance::AccountPassword
MseLicenseKey:
Type: String
Label:
en: Current MSE region License Key
zh-cn: 当前环境 MSE License Key
Description:
en: Log on <a href="https://mse.console.aliyun.com/#/msc/home" target="_blank"><b><font color='blue'>MSE console </font></a>, Click Governance Center > Overview in the left navigation bar. On the top menu bar, select the region where the ROS resource stack is created. Click the License Key link in the upper right corner of the overview page to obtain the MSE License Key.
zh-cn: 登录<a href='https://mse.console.aliyun.com/#/msc/home' target='_blank'><b><font color='blue'>微服务引擎MSE控制台</font></a>,点击左侧导航栏治理中心 > 概览,在顶部菜单栏,选择创建ROS资源栈对应的地域, 在概览页面点击右上角查看 License Key 链接,获取MSE License Key。
ArmsLicenseKey:
Type: String
Label:
en: Current ARMS region License Key
zh-cn: 当前环境 ARMS License Key
Description:
en: Log on <a href="https://arms.console.aliyun.com/?spm=5176.mse-prod.console-base_search-panel.dtab-product_arms.719f142feXioLD#/intgr/integrations?showIntgrDetail=true&intgrId=apm-java&name=Java+%E5%BA%94%E7%94%A8%E7%9B%91%E6%8E%A7&pageType=console&tab=startIntgr&version=0.0.1" target="_blank"><b><font color='blue'>ARMS console </font></a>, In the Access Center page of the ARMS management console of the real-time application monitoring service, select Server Application > Java Application Monitoring. In the Java Application Monitoring page, select the environment type and set it to Manual Installation. In the Agent Installation step, obtain the value of the variable -Darms.licenseKey.
zh-cn: 登录<a href='https://arms.console.aliyun.com/?spm=5176.mse-prod.console-base_search-panel.dtab-product_arms.719f142feXioLD#/intgr/integrations?showIntgrDetail=true&intgrId=apm-java&name=Java+%E5%BA%94%E7%94%A8%E7%9B%91%E6%8E%A7&pageType=console&tab=startIntgr&version=0.0.1' target='_blank'><b><font color='blue'>ARMS控制台</font></a>,在应用实时监控服务 ARMS 管理控制台接入中心页面选择服务端应用 > Java 应用监控,在Java 应用监控页面开始接入页签中选择所属环境类型设置为手动安装,在安装 Agent步骤中获取变量-Darms.licenseKey对应的值。
Resources:
VPC:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
VpcName:
Fn::Sub: VPC-${ALIYUN::StackId}
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
VSwitchName:
Fn::Sub: vsw_001-${ALIYUN::StackId}
VpcId:
Ref: VPC
CidrBlock: 192.168.1.0/24
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: VPC
SecurityGroupName:
Fn::Sub: SecurityGroup_1-${ALIYUN::StackId}
SecurityGroupIngress:
- PortRange: 80/80
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
ECSInstanceGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId: aliyun_3_9_x64_20G_alibase_
InstanceType:
Ref: ECSInstanceType
IoOptimized: optimized
MaxAmount: 1
Password:
Ref: ECSPassword
SystemDiskCategory: cloud_essd
SystemDiskSize: 40
InternetMaxBandwidthOut: 5
RdsInstance:
Type: 'ALIYUN::RDS::DBInstance'
Properties:
DBInstanceClass:
Ref: DBInstanceClass
ZoneId:
Ref: ZoneId
DBInstanceStorage: 50
Category: Basic
DBInstanceStorageType: cloud_essd
VSwitchId:
Ref: VSwitch
Engine: MySQL
VpcId:
Ref: VPC
EngineVersion: '8.0'
SecurityIPList: '192.168.0.0/16'
RdsAccount:
DependsOn:
- RdsInstance
Type: ALIYUN::RDS::Account
Properties:
DBInstanceId:
Ref: RdsInstance
AccountPassword:
Ref: DBPassword
AccountType: Normal
AccountName:
Ref: DBAccountName
RdsDatabase:
Type: ALIYUN::RDS::Database
Properties:
CharacterSetName: utf8mb4
DBInstanceId:
Ref: RdsInstance
DBName: flashsale
AccountPrivilege:
DependsOn:
- RdsDatabase
- RdsAccount
Type: ALIYUN::RDS::AccountPrivilege
Properties:
AccountPrivilege: ReadWrite
DBInstanceId:
Ref: RdsInstance
DBName: flashsale
AccountName:
Ref: DBAccountName
RedisInstance:
Type: ALIYUN::REDIS::Instance
Properties:
EngineVersion: '5.0'
ZoneId:
Ref: ZoneId
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch
InstanceClass:
Ref: RedisClass
InstanceName:
Fn::Sub: flashsale_redis-${ALIYUN::StackId}
Password:
Ref: RedisAccountPassword
ProductType: OnECS
DeletionForce: true
ShardCount: 1
NodeType: single
RedisWhitelist:
Type: ALIYUN::REDIS::Whitelist
Properties:
InstanceId:
Ref: RedisInstance
SecurityIps: 192.168.0.0/16
MseMicroRegistryInstance:
Type: ALIYUN::MSE::Cluster
Properties:
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch
ClusterAliasName:
Fn::Sub: my_nacos-${ALIYUN::StackId}
MseVersion: mse_dev
InstanceCount: 1
ClusterVersion: NACOS_2_0_0
ClusterType: Nacos-Ans
ClusterSpecification: MSE_SC_1_2_60_c
NetType: privatenet
PubNetworkFlow: 0
AutoEnableService:
Type: 'ALIYUN::ROS::AutoEnableService'
Properties:
ServiceName: RocketMQ
RocketMQ:
Type: ALIYUN::ROCKETMQ5::Instance
Properties:
ProductInfo:
MsgProcessSpec: rmq.s2.2xlarge
InternetInfo:
InternetSpec: disable
FlowOutType: uninvolved
InstanceName:
Fn::Sub: ROCKETMQ5-${ALIYUN::StackId}
SubSeriesCode: cluster_ha
SeriesCode: standard
PaymentType: PayAsYouGo
VpcInfo:
VpcId:
Ref: VPC
VSwitchId:
Ref: VSwitch
DependsOn:
- AutoEnableService
Topic1:
Type: ALIYUN::ROCKETMQ5::Topic
Properties:
InstanceId:
Ref: RocketMQ
Remark: 预扣库存成功后订单创建失败
MessageType: NORMAL
TopicName: order-fail-after-pre-deducted-inventory
Topic2:
Type: ALIYUN::ROCKETMQ5::Topic
Properties:
InstanceId:
Ref: RocketMQ
Remark: 库存系统扣减库存成功后订单创建失败
MessageType: NORMAL
TopicName: order-fail-after-deducted-inventory
Topic3:
Type: ALIYUN::ROCKETMQ5::Topic
Properties:
InstanceId:
Ref: RocketMQ
Remark: 订单创建成功
MessageType: TRANSACTION
TopicName: order-success
ConsumerGroup:
Type: ALIYUN::ROCKETMQ5::ConsumerGroup
Properties:
ConsumerGroupId: flashsale-service-consumer-group
InstanceId:
Ref: RocketMQ
ConsumeRetryPolicy:
RetryPolicy: DefaultRetryPolicy
MaxRetryTimes: 5
DeliveryOrderType: Concurrently
WaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: WaitConditionHandle
Timeout: 1200
DependsOn:
- ConsumerGroup
- AccountPrivilege
- MseMicroRegistryInstance
- RedisInstance
- Topic1
- Topic2
- Topic3
WaitConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
InstanceRunCommand:
Type: ALIYUN::ECS::RunCommand
Properties:
InstanceIds:
- Fn::Select:
- 0
- Fn::GetAtt:
- ECSInstanceGroup
- InstanceIds
CommandContent:
Fn::Sub: |-
#!/bin/bash
cat << EOF >> ~/.bash_profile
export REGION="${ALIYUN::Region}"
export DB_URL="${RdsInstance.InnerConnectionString}:3306/flashsale"
export DB_USERNAME="${DBAccountName}"
export DB_PASSWORD="${DBPassword}"
export REDIS_HOST="${RedisInstance.ConnectionDomain}"
export REDIS_PASSWORD="${RedisAccountPassword}"
export NACOS_URL="${MseMicroRegistryInstance.IntranetDomain}:8848"
export ROCKETMQ_ENDPOINT="${RocketMQ.VpcEndpoint}"
export ROCKETMQ_USERNAME="${RocketMQ.UserName}"
export ROCKETMQ_PASSWORD="${RocketMQ.Password}"
export MSE_LICENSE_KEY="${MseLicenseKey}"
export ARMS_LICENSE_KEY="${ArmsLicenseKey}"
export ROS_DEPLOY=true
EOF
source ~/.bash_profile
curl -fsSL https://help-static-aliyun-doc.aliyuncs.com/install-script/arms-apm/install.sh | bash
# 执行成功回调WaitCondition结束waitCondition的等待
${WaitConditionHandle.CurlCli} -d "{\"Data\" : \"Success\", \"status\" : \"SUCCESS\"}"
Type: RunShellScript
Timeout: '1200'
DependsOn:
- Topic1
- Topic2
- Topic3
Outputs:
ARMSAddress:
Description:
en: ARMS address.
zh-cn: ARMS地址。
Value:
Fn::Sub: https://arms.console.aliyun.com/#/tracing/list/${ALIYUN::Region}
PublicIPAddress:
Description:
zh-cn: 商品秒杀页面地址。
en: The address of the product flash sale page.
Value:
'Fn::Sub':
- 'http://${ServerAddress}'
- ServerAddress:
'Fn::Select':
- 0
- 'Fn::GetAtt':
- ECSInstanceGroup
- PublicIps
Metadata:
'ALIYUN::ROS::Interface':
Outputs:
- PublicIPAddress
- ARMSAddress
ParameterGroups:
- Parameters:
- ZoneId
- ECSInstanceType
- ECSPassword
Label:
default:
zh-cn: ECS 配置
en: ECS Configuration
- Parameters:
- DBInstanceClass
- DBAccountName
- DBPassword
Label:
default:
zh-cn: RDS 配置
en: RDS Configuration
- Parameters:
- RedisClass
- RedisAccountPassword
Label:
default:
zh-cn: Tair 配置
en: Tair Configuration
- Parameters:
- MseLicenseKey
- ArmsLicenseKey
Label:
default:
zh-cn: MSE 和 ARMS 配置
en: MSE and ARMS Configuration
TemplateTags:
- acs:technical-solution:high-availability-architecture:端到端全链路追踪诊断-tech_solu_186