forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
spring-cloud-netflix-migrate-edas.yml
551 lines (551 loc) · 17.3 KB
/
spring-cloud-netflix-migrate-edas.yml
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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: This template seamlessly migrates Spring Cloud applications to Container Service
for Kubernetes at low costs, without changes to the calling method between applications.
Kubernetes is a natural fit for microservices. This template takes full advantage
of the elasticity of Kubernetes to meet application scale-out requirements. After
Spring Cloud applications are containerized, resource utilization is greatly improved.
zh-cn: 无需改造即可迁移,应用间的调用都是原来的方式;平滑迁移,迁移成本小;kubernetes天然适合微服务框架;充分利用kubernetes的弹性,满足应用弹性扩容需求;容器化后,资源利用率获得极大提升。
Parameters:
VSwitchZoneId:
Type: String
Label:
en: VSwitch Availability Zone
zh-cn: 交换机可用区
Description:
en: Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please
confirm that the Availability Zone supports the specification of creating
ECS resources,which is recommended to be different from other VSwitch Availability
Zone</font></b>
zh-cn: 可用区ID。<br><b>注: <font color='blue'>选择前请确认该可用区是否支持创建ECS资源的规格,建议与其他交换机可用区不同</font></b>
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
VpcCidrBlock:
Type: String
Label:
en: VPC CIDR Block
zh-cn: 专有网络网段
Description:
en: 'The IP address range of the VPC in the CIDR Block form; <br>you can use
the following IP address ranges: <br><font color=''green''>[10.0.0.0/8]</font><br><font
color=''green''>[172.16.0.0/12]</font><br><font color=''green''>[192.168.0.0/16]</font>'
zh-cn: 专有网络IP地址段范围,<br>您可以使用以下的IP地址段:<br><font color='green'>[10.0.0.0/8]</font><br><font
color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>
Default: 192.168.0.0/16
AllowedValues:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
VSwitchCidrBlock:
Type: String
Label:
en: VSwitch CIDR Block
zh-cn: 交换机网段
Description:
en: Must be a sub-network segment of the proprietary network and is not occupied
by other VSwitches.
zh-cn: 必须是所属专有网络的子网段,并且没有被其他交换机占用。
Default: 192.168.1.0/24
ImageId:
Type: String
Label:
en: Image
zh-cn: 镜像
Description:
en: Image ID,see detail:<b><a href='https://www.alibabacloud.com/help/en/doc-detail/112977.html'
target='_blank'><font color='blue'>Find the mirror</font></a></b>
zh-cn: 镜像ID, 详见:<b><a href='https://help.aliyun.com/document_detail/112977.html'
target='_blank'><font color='blue'>查找镜像</font></a></b>
Default: centos_7
InstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例规格
Description:
en: 'Fill in the specifications that can be used under the VSwitch availability
zone;</b></font><br>general specifications:<font color=''red''><b>ecs.c5.large</b></font><br>note:
a few zones do not support general specifications<br>see detail: <a href=''https://www.alibabacloud.com/help/en/doc-detail/25378.html''
target=''_blank''><b><font color=''blue''>Instance Specification Family</font></a></b>'
zh-cn: 填写VSwitch可用区下可使用的规格;<br>通用规格:<font color='red'><b>ecs.c5.large</b></font><br>注:可用区可能不支持通用规格<br>规格详见:<a
href='https://help.aliyun.com/document_detail/25378.html' target='_blank'><b><font
color='blue'>实例规格族</font></a></b>
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: VSwitchZoneId
SystemDiskCategory:
Type: String
Label:
en: System Disk Type
zh-cn: 系统盘类型
Description:
en: '<font color=''blue''><b>Optional values:</b></font><br>[cloud_efficiency:
<font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD
Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud:
<font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local
SSD Cloud Disk</font>]'
zh-cn: '<font color=''blue''><b>可选值:</b></font><br>[cloud_efficiency: <font
color=''green''>高效云盘</font>]<br>[cloud_ssd: <font color=''green''>SSD云盘</font>]<br>[cloud_essd:
<font color=''green''>ESSD云盘</font>]<br>[cloud: <font color=''green''>普通云盘</font>]<br>[ephemeral_ssd:
<font color=''green''>本地SSD盘</font>]'
Default: cloud_efficiency
AllowedValues:
- cloud_auto
- cloud_efficiency
- cloud_ssd
- cloud
- cloud_essd
- ephemeral_ssd
SystemDiskSize:
Type: Number
Label:
en: System Disk Space
zh-cn: 系统盘空间
Description:
en: 'System disk size, range of values: 40-500, units: GB.'
zh-cn: 系统盘大小, 取值范围:[40, 500], 单位:GB。
Default: 40
GroupMaxAmount:
Type: Number
Label:
en: ECS Amount
zh-cn: ECS实例数量
Description:
en: 'Number of instances,value range: 1~100.'
zh-cn: 实例数量,取值范围:1~100。
Default: 1
MinValue: 1
MaxValue: 100
Password:
Type: String
Label:
en: Instance Password
zh-cn: 实例密码
Description:
en: Server login password, Length 8-30, must contain three(Capital letters,
lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol
in).
zh-cn: 服务器登录密码,长度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
RegionName:
Type: String
Label:
en: Namespace Name
zh-cn: 命名空间名称
Description:
en: Logical region (or namespace) name
zh-cn: 逻辑区域(或名称空间)名称
Default: pig
OversoldFactor:
Type: Number
Label:
en: Oversold Factor
zh-cn: 超卖因素
Description:
en: 'Docker CPU cluster oversold. Support 2 (1: 2 ratio) / 4 (1: 4 ratio) /
8 (1: 8 ratio).'
zh-cn: Docker CPU集群超卖。 支持2(1:2比例)/ 4(1:4比例)/ 8(1:8比例)。
Default: 2
AllowedValues:
- 2
- 4
- 8
ClusterName:
Type: String
Label:
en: Cluster Name
zh-cn: 集群名称
Description:
en: Cluster Name
zh-cn: 集群名称
Default: pig001
EcsGroupMaxAmount:
Type: Number
Label:
en: ECS Amount
zh-cn: ECS实例数量
Description:
en: 'Number of instances,value range: 1~100.'
zh-cn: 实例数量,取值范围:1~100。
Default: 5
MinValue: 1
MaxValue: 100
KeyPairName:
Type: String
Label:
en: Key Pair Name
zh-cn: 密钥对名称
Description:
en: Name of the key pair bound to the ECS instance.
zh-cn: ECS实例绑定的密钥对名称。
Default: edas-key
Resources:
UserDefineRegion:
Type: ALIYUN::EDAS::UserDefineRegion
Properties:
RegionName:
Ref: RegionName
RegionTag:
Fn::Join:
- ':'
- - Ref: ALIYUN::Region
- Ref: RegionName
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName:
Fn::Join:
- '-'
- - Vpc
- Ref: ALIYUN::StackId
Cluster:
Type: ALIYUN::EDAS::Cluster
Properties:
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
ClusterName:
Ref: ClusterName
ClusterType: 2
LogicalRegionId:
Fn::Join:
- ':'
- - Ref: ALIYUN::Region
- Ref: RegionName
NetworkMode: 2
OversoldFactor:
Ref: OversoldFactor
DependsOn: UserDefineRegion
SSHKeyPair:
Type: ALIYUN::ECS::SSHKeyPair
Properties:
KeyPairName:
Ref: KeyPairName
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
SecurityGroupIngress:
- IpProtocol: tcp
NicType: intranet
PortRange: 22/22
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: tcp
NicType: intranet
PortRange: 80/80
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: tcp
NicType: intranet
PortRange: 443/443
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: icmp
NicType: intranet
PortRange: -1/-1
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: tcp
NicType: intranet
PortRange: 4000/9000
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: tcp
NicType: intranet
PortRange: 15672/15672
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: all
NicType: intranet
Policy: drop
PortRange: -1/-1
Priority: 10
SourceCidrIp: 0.0.0.0/0
Tags:
- Key: best_practice
Value: '149'
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: VSwitchZoneId
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
CidrBlock:
Ref: VSwitchCidrBlock
VSwitchName:
Fn::Join:
- '-'
- - VSwitch
- Ref: ALIYUN::StackId
EcsGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
AllocatePublicIP: false
InstanceName:
Fn::Join:
- ''
- - edas[1,
- Ref: EcsGroupMaxAmount
- ']'
InstanceType:
Ref: InstanceType
IoOptimized: optimized
KeyPairName:
Fn::GetAtt:
- SSHKeyPair
- KeyPairName
MaxAmount:
Ref: EcsGroupMaxAmount
SystemDiskCategory:
Ref: SystemDiskCategory
SystemDiskSize:
Ref: SystemDiskSize
Tags:
- Key: best_practice
Value: '149'
DependsOn: Cluster
ClusterMember:
Type: ALIYUN::EDAS::ClusterMember
Properties:
InstanceIds:
Fn::GetAtt:
- EcsGroup
- InstanceIds
ClusterId:
Fn::GetAtt:
- Cluster
- ClusterId
Password:
Ref: Password
DependsOn:
- Cluster
- EcsGroup
MongoDBServer:
Type: ALIYUN::ECS::InstanceGroup
Properties:
ZoneId:
Ref: VSwitchZoneId
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
AllocatePublicIP: true
InstanceName: MongoDBServer
InstanceType:
Ref: InstanceType
MaxAmount:
Ref: GroupMaxAmount
Password:
Ref: Password
SystemDiskCategory:
Ref: SystemDiskCategory
SystemDiskSize:
Ref: SystemDiskSize
Tags:
- Key: best_practice
Value: '149'
UserData:
Fn::Replace:
- ros-notify:
Fn::GetAtt:
- WaitConditionHandle
- CurlCli
- Fn::Join:
- ''
- - '#!/bin/sh'
- " \n"
- "wget https://ros-template-resources.oss-cn-beijing.aliyuncs.com/MongoDB/mongodb-linux-x86_64-3.0.6.tgz\
\ \n"
- "tar -zxvf mongodb-linux-x86_64-3.0.6.tgz \n"
- "mv mongodb-linux-x86_64-3.0.6 /usr/local/mongodb \n"
- "mkdir -p /data/mongodb \n"
- "mkdir -p /data/logs/mongodb \n"
- "touch /data/logs/mongodb/mongodb.log \n"
- "touch /usr/local/mongodb/bin/mongodb.conf \n"
- "chmod -R 777 /data/logs/mongodb/mongodb.log \n"
- "chmod -R 777 /usr/local/mongodb/bin/mongodb.conf \n"
- "cd /usr/local/mongodb/bin/ \n"
- "echo 'port=27017' >> /usr/local/mongodb/bin/mongodb.conf \n"
- "echo 'dbpath=/data/mongodb' >> /usr/local/mongodb/bin/mongodb.conf\
\ \n"
- "echo 'logpath=/data/logs/mongodb/mongodb.log' >> /usr/local/mongodb/bin/mongodb.conf\
\ \n"
- "echo 'fork=true' >> /usr/local/mongodb/bin/mongodb.conf \n"
- "echo 'maxConns=5000' >> /usr/local/mongodb/bin/mongodb.conf \n"
- "echo 'storageEngine=mmapv1' >> /usr/local/mongodb/bin/mongodb.conf\
\ \n"
- "iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 27017\
\ -j ACCEPT \n"
- "/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb.conf\
\ \n"
- "netstat -anpt | grep mongod \n"
- "ros-notify -d \"{\\\"Data\\\" : \\\"SUCCESS\\\", \\\"Status\\\" : \\\
\"SUCCESS\\\"}\" \n"
DependsOn: VSwitch
RabbitMQServer:
Type: ALIYUN::ECS::InstanceGroup
Properties:
ZoneId:
Ref: VSwitchZoneId
VpcId:
Fn::GetAtt:
- Vpc
- VpcId
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
AllocatePublicIP: true
InstanceName: RabbitMQServer
InstanceType:
Ref: InstanceType
MaxAmount:
Ref: GroupMaxAmount
Password:
Ref: Password
SystemDiskCategory:
Ref: SystemDiskCategory
SystemDiskSize:
Ref: SystemDiskSize
Tags:
- Key: best_practice
Value: '149'
UserData:
Fn::Replace:
- ros-notify:
Fn::GetAtt:
- WaitConditionHandle
- CurlCli
- Fn::Join:
- ''
- - '#!/bin/sh'
- " \n"
- "yum update -y \n"
- "sed '$i[rabbitmq-erlang]' /etc/yum.repos.d/rabbitmq-erlang.repo \n"
- "sed '$iname=rabbitmq-erlang' /etc/yum.repos.d/rabbitmq-erlang.repo\
\ \n"
- "sed '$ibaseurl=https://dl.bintray.com/rabbitmq/rpm/erlang/20/el/7'\
\ /etc/yum.repos.d/rabbitmq-erlang.repo \n"
- "sed '$igpgcheck=1' /etc/yum.repos.d/rabbitmq-erlang.repo \n"
- "sed '$igpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc'\
\ /etc/yum.repos.d/rabbitmq-erlang.repo \n"
- "sed '$irepo_gpgcheck=0' /etc/yum.repos.d/rabbitmq-erlang.repo \n"
- "sed '$ienabled=1' /etc/yum.repos.d/rabbitmq-erlang.repo \n"
- "yum -y install erlang socat \n"
- "wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-3.6.10-1.el7.noarch.rpm\
\ \n"
- "rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc\
\ \n"
- "rpm -Uvh rabbitmq-server-3.6.10-1.el7.noarch.rpm \n"
- "service rabbitmq-server start \n"
- "service rabbitmq-server status \n"
- "rabbitmq-plugins enable rabbitmq_management \n"
- "sed -i '36s/<<\"guest\">>//g' /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.10/ebin/rabbit.app\
\ \n"
- "service rabbitmq-server restart \n"
- "ros-notify -d \"{\\\"Data\\\" : \\\"SUCCESS\\\", \\\"Status\\\" : \\\
\"SUCCESS\\\"}\" \n"
DependsOn: VSwitch
WaitConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
WaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 2
Handle:
Ref: WaitConditionHandle
Timeout: 1800
Outputs:
ClusterId:
Description: EDAS cluster ID
Value:
Fn::GetAtt:
- Cluster
- ClusterId
ClusterName:
Description: EDAS Cluster Name
Value:
Fn::GetAtt:
- Cluster
- ClusterName
EDASClusterInstanceIds:
Description: ECS instance IDs in EDAS cluster
Value:
Fn::GetAtt:
- ClusterMember
- InstanceIds
MongoDBServerPublicIp:
Description: MongoDB Server Public IP.
Value:
Fn::GetAtt:
- MongoDBServer
- PublicIps
RabbitMQServerPublicIp:
Description: RabbitMQ Server Public IP.
Value:
Fn::GetAtt:
- RabbitMQServer
- PublicIps
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VSwitchZoneId
- VpcCidrBlock
- VSwitchCidrBlock
Label:
default: VPC
- Parameters:
- ImageId
- InstanceType
- SystemDiskCategory
- SystemDiskSize
- GroupMaxAmount
- Password
Label:
default: ECS
- Parameters:
- RegionName
- OversoldFactor
- ClusterName
- EcsGroupMaxAmount
- KeyPairName
Label:
default: EDAS
TemplateTags:
- SpringCloud应用托管到ACK服务