forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
single-available-zone-building-application.yml
1186 lines (1176 loc) · 36.2 KB
/
single-available-zone-building-application.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
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: The cross-zone disaster recover solution 2.0 demonstrates data migration and
system switchover from a single zone to multiple zones. This template uses WordPress
as an example to help you understand the architecture of this solution. You must
log on to the management console of the required services to manually switch over
your system. This template is used to build an application in a single zone.
zh-cn: 同地域跨可用区容灾的解决方案2.0,介绍单可用区到跨可用区的迁移及切换演练,以模拟wordpress应用服务为例,帮助客户更清晰地了解方案架构;切换演练需要手动到对应产品的控制台操作,此模版完成单可用区应用搭建。
Conditions:
CreateCentOSImage:
Fn::Equals:
- centos_7
- Ref: EcsGroupImage
Parameters:
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:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
VSwZone:
Type: String
Label:
en: VSwitch 1 Available Zone
zh-cn: 交换机1可用区
Description:
en: Availability Zone ID,<br><b>note: <font color='blue'>Before selecting, please
confirm that the Availability Zone supports the specification of creating
REDIS、SLB and ECS resources</font></b>
zh-cn: 可用区ID。<br><b>注: <font color='blue'>选择可用区前请确认该可用区是否支持创建REDIS、SLB及ECS资源的规格</font></b>
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
VSwCidrBlock:
Type: String
Label:
en: VSwitch 1 CIDR Block
zh-cn: 交换机1网段
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
EipBandwidth:
Type: Number
Label:
en: EIP Bandwidth
zh-cn: 弹性公网IP带宽值
Description:
en: 'Elastic public network IP bandwidth,Value range [1, 1000], Unit: Mbps.'
zh-cn: 弹性公网IP带宽值,取值范围[1, 1000],单位:Mbps。
Default: 2
MinValue: 1
MaxValue: 1000
EipInternetChargeType:
Type: String
Label:
en: EIP Charge Type
zh-cn: 弹性公网IP计费方式
Description:
en: '<font color=''blue''><b>Optional values: </b></font><br>[PayByBandwidth:<font
color=''green''>Pay-by-bandwidth</font>]<br>[PayByTraffic:<font color=''green''>Pay-by-data-transfer</font>]<br><font
color=''blue''></a>'
zh-cn: '<font color=''blue''><b>可选值: </b></font><br>[PayByBandwidth:<font color=''green''>按固定带宽计费</font>]<br>[PayByTraffic:<font
color=''green''>按流量计费</font>]<br><font color=''blue''></a>'
Default: PayByTraffic
AllowedValues:
- PayByTraffic
- PayByBandwidth
EcsGroupInstanceType:
Type: String
Label:
en: Specifications
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: VSwZone
EcsGroupSystemDiskCategory:
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_efficiency
- cloud_ssd
- cloud
- cloud_essd
- ephemeral_ssd
EcsGroupSystemDiskSize:
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
MinValue: 40
MaxValue: 500
EcsGroupMaxAmount:
Type: Number
Label:
en: Amount
zh-cn: 实例数量
Description:
en: Number of instances, range 1-100.
zh-cn: 创建实例的数量,范围1-100。
Default: 1
MinValue: 1
MaxValue: 100
EcsGroupImage:
Type: String
Label:
en: Image
zh-cn: 镜像
Description:
en: 'Server Instance Image ID, Use centos_7 mirror to install the app, and the
other images are not installed, 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: 服务器镜像,使用centos_7镜像安装相关应用,其他镜像不安装,详见:<b><a href='https://help.aliyun.com/document_detail/112977.html'
target='_blank'><font color='blue'>查找镜像</font></a></b>
Default: centos_7
EcsGroupPassword:
Type: String
Label:
en: Login 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
EcsGroupName:
Type: String
Label:
en: Instance/Host Name
zh-cn: 实例名/主机名
Description:
en: 'Instance Name/Host Name.Default: WP1, create successful display [wp1-000,
wp1-001...].'
zh-cn: 实例名/主机名。默认:WP1,创建成功显示[WP1-000, WP1-001....]。
Default: WP1
LoadBalancerSpec:
Type: String
Label:
en: Specifications
zh-cn: 规格
Description:
en: Instance specifications, see detail:</b><a href='https://www.alibabacloud.com/help/en/doc-detail/85939.html'
target='_blank'><b><font color='blue'>Performance support type</b></font></a>
zh-cn: 实例规格,详见:</b><a href='https://help.aliyun.com/document_detail/85939.html'
target='_blank'><b><font color='blue'>性能保障型</b></font></a>
Default: slb.s1.small
AllowedValues:
- slb.s1.small
- slb.s2.small
- slb.s2.medium
- slb.s3.small
- slb.s3.medium
- slb.s3.large
SlbListenerPort:
Type: Number
Label:
en: Listening Port
zh-cn: 监听端口
Description:
en: 'SLB externally provided ports.Default: 80,range of values:1-65535.'
zh-cn: 前端使用的端口。默认值:80, 取值:1-65535。
Default: 80
MinValue: 1
MaxValue: 65535
SlbListenerBackendServerPort:
Type: Number
Label:
en: SLB Backend Server Port
zh-cn: 后端服务器的端口
Description:
en: 'Default: 80. value range: 1-65535.'
zh-cn: 默认:80。取值范围1-65535。
Default: 80
MinValue: 1
MaxValue: 65535
DBInstanceEngineAndVersion:
Type: String
Label:
en: Type And Version
zh-cn: 类型与版本号
Description:
en: Database type and version number.
zh-cn: 数据库类型与版本号。
Default: MySQL-5.6
AllowedValues:
- MySQL-5.5
- MySQL-5.6
- MySQL-5.7
- MySQL-8.0
RdsDBInstanceClass:
Type: String
Label:
en: Specifications
zh-cn: 规格
Description:
en: 'Select the instance specification based on the type of database engine
and the available area support;<br>see detail: <a href=''https://www.alibabacloud.com/help/en/doc-detail/26350.html''
target=''_blank''><b><font color=''blue''>Instance specification sheet</font></b></a>'
zh-cn: 根据数据库引擎的类型和可用的区域支持选择实例规格;<br>请参见详细信息:<a href='https://help.aliyun.com/document_detail/26350.html'
target='_blank'><b><font color='blue'>实例规格表</font></b></a>
Default: rds.mysql.s2.large
RdsDBInstanceStorage:
Type: Number
Label:
en: Storage Space
zh-cn: 存储空间
Description:
en: 'Database storage space, units: GB, per 5GB increment, value range: 20-1000.'
zh-cn: 数据库存储空间, 单位:GB, 每5GB进行递增,取值范围:20-1000。
Default: 20
MinValue: 20
MaxValue: 1000
RdsDBName:
Type: String
Label:
en: Database Name
zh-cn: 数据库名称
Description:
en: The database name created by the instance, consisting of lowercase letters,
numbers, underscores, and middle lines, beginning with letters, ending with
letters or numbers, up to 64 characters.
zh-cn: 实例创建的数据库名称,由小写字母、数字、下划线、中划线组成,以字母开头,字母或数字结尾,最多64个字符。
Default: wordpress
DBCharacterSetName:
Type: String
Label:
en: Database Character Set
zh-cn: 数据库字符集
Description:
en: See details: <a href= 'https://www.alibabacloud.com/help/en/doc-detail/99716.html
' target='_blank' ><b><font color='blue'>Set the table</font></b></a>
zh-cn: 详见: <a href= 'https://help.aliyun.com/document_detail/99716.html ' target='_blank'
><b><font color='blue'>字符集表</font></b></a>
Default: utf8
RdsAccountName:
Type: String
Label:
en: Database Account
zh-cn: 数据库账号
Description:
en: Database read-write account with a maximum of 16 characters, consisting
of lowercase letters, Numbers, underscores, beginning letters, and ending
letters or Numbers.
zh-cn: 数据库可读写的账号,最长16个字符, 由小写字母,数字、下划线组成、字母开头,字母或数字结尾。
Default: wp_admin
MinLength: 3
MaxLength: 16
RdsAccountPwd:
Type: String
Label:
en: Database Account Password
zh-cn: 数据库帐号密码
Description:
en: Length 8-32 characters, can contain size letters, Numbers and special symbols
(including:!@#$%^&*-+=_).
zh-cn: 长度8-32个字符,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
ConstraintDescription:
en: 8-32 characters, can contain size letters, Numbers and special symbols (including:!@#$%^&*-+=_).
zh-cn: 8-32个字符,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
MinLength: '8'
MaxLength: '32'
NoEcho: true
RedisInstanceClass:
Type: String
Label:
en: Specifications
zh-cn: 规格
Description:
en: 'Fill in instance specifications based on database type and availability
zone support;<br>see detail: <a href=''https://www.alibabacloud.com/help/en/doc-detail/26350.html''
target=''_blank''><b><font color=''blue''>Specification inquiry</font></b></a>'
zh-cn: 根据数据库类型和可用区支持的情况填写实例规格;<br>请参见详细信息:<a href='https://help.aliyun.com/document_detail/26350.html'
target='_blank'><b><font color='blue'>规格查询</font></b></a>
Default: redis.master.stand.default
RedisEngineVersion:
Type: String
Label:
en: Database Version
zh-cn: 数据库版本
Description:
en: 'Redis database version.Default: 4.0.'
zh-cn: Redis数据库版本。默认值:4.0。
Default: '4.0'
AllowedValues:
- '2.8'
- '4.0'
- '5.0'
RedisPassword:
Type: String
Label:
en: Instance Password
zh-cn: 实例密码
Description:
en: 'The password can be 8 to 32 characters in length and must contain three
of the following conditions: uppercase letters, lowercase letters, numbers,
and special characters ( !@#$%^&*()_+-= ).'
zh-cn: 密码长度可以是8到32个字符,并且必须包含以下三种情况:大写字母、小写字母、数字和特殊字符(!@#$%^&*()_+-=)。
ConstraintDescription:
en: 'The password can be 8 to 32 characters in length and must contain three
of the following conditions: uppercase letters, lowercase letters, numbers,
and special characters ( !@#$%^&*()_+-= ).'
zh-cn: 密码长度可以是8到32个字符,并且必须包含以下三种情况:大写字母、小写字母、数字和特殊字符(!@#$%^&*()_+-=)。
MinLength: 8
MaxLength: 32
NoEcho: true
VpcDescription:
Type: String
Label:
en: VPC Description
zh-cn: VPC 描述
Description:
en: VPC description.The length is [2, 256].Can not begin with http:// and https://.
zh-cn: VPC描述, 长度为 [2, 256]。不能以 http:// 和 https:// 开头。
Default: VPC用于同地域可用区灾备2.0-迁移演练
Resources:
EcsVpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: b9820522-e318-4d4d-9574-02ba55d76c8a
EcsSecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: EcsVpc
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: 3389/3389
Priority: 1
SourceCidrIp: 0.0.0.0/0
SecurityGroupName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Tags:
- Key: best_practice
Value: '057'
DependsOn: EcsVpc
Metadata:
ALIYUN::ROS::Designer:
id: a1e0ee8f-3ca1-4142-a901-cf066b4da978
EcsVSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: VSwZone
VpcId:
Ref: EcsVpc
CidrBlock:
Ref: VSwCidrBlock
VSwitchName:
Fn::Join:
- '-'
- - VSwtich1
- StackId
- Ref: ALIYUN::StackId
DependsOn: EcsVpc
Metadata:
ALIYUN::ROS::Designer:
id: 6d16e5ec-55af-4409-b0c6-84b9ef40d5fe
Rds:
Type: ALIYUN::RDS::DBInstance
Properties:
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: EcsVSwitch
DBInstanceClass:
Ref: RdsDBInstanceClass
DBInstanceStorage:
Ref: RdsDBInstanceStorage
DBMappings:
- CharacterSetName:
Ref: DBCharacterSetName
DBName:
Ref: RdsDBName
Engine:
Fn::Select:
- '0'
- Fn::Split:
- '-'
- Ref: DBInstanceEngineAndVersion
EngineVersion:
Fn::Select:
- '1'
- Fn::Split:
- '-'
- Ref: DBInstanceEngineAndVersion
SecurityIPList:
Ref: VpcCidrBlock
Tags:
Key: best_practice
Value: '057'
Metadata:
ALIYUN::ROS::Designer:
id: 0f65c728-7a2f-4a69-929f-707960b55549
Redis:
Type: ALIYUN::REDIS::Instance
Properties:
ZoneId:
Ref: VSwZone
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: EcsVSwitch
EngineVersion:
Ref: RedisEngineVersion
InstanceClass:
Ref: RedisInstanceClass
InstanceName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Password:
Ref: RedisPassword
DependsOn: EcsVSwitch
Metadata:
ALIYUN::ROS::Designer:
id: c2a3ce3a-410e-4a45-b2ff-bed578ba0aed
EcsInstanceGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: EcsVSwitch
SecurityGroupId:
Ref: EcsSecurityGroup
ImageId:
Ref: EcsGroupImage
AllocatePublicIP: false
HostName:
Fn::Join:
- ''
- - Ref: EcsGroupName
- -[0,3]
InstanceChargeType: PostPaid
InstanceName:
Fn::Join:
- ''
- - Ref: EcsGroupName
- -[0,3]
InstanceType:
Ref: EcsGroupInstanceType
IoOptimized: optimized
MaxAmount:
Ref: EcsGroupMaxAmount
Password:
Ref: EcsGroupPassword
SystemDiskCategory:
Ref: EcsGroupSystemDiskCategory
SystemDiskSize:
Ref: EcsGroupSystemDiskSize
Tags:
- Key: best_practice
Value: '057'
UserData:
Fn::If:
- CreateCentOSImage
- Fn::Replace:
- ros-notify:
Fn::GetAtt:
- RosWaitConditionHandle
- CurlCli
- Fn::Join:
- ''
- - "#!/bin/sh \n"
- db_wordpress=
- Ref: RdsDBName
- " \n"
- user_wordpress=
- Ref: RdsAccountName
- " \n"
- pwd_wordpress=
- Ref: RdsAccountPwd
- " \n"
- charset=
- Ref: DBCharacterSetName
- " \n"
- host=
- Fn::GetAtt:
- Rds
- InnerConnectionString
- " \n"
- redis_host=
- Fn::GetAtt:
- Redis
- ConnectionDomain
- " \n"
- redis_password=
- Ref: RedisPassword
- " \n"
- "sleep 180 \n"
- "WebRootPath='/var/www/html' \n"
- "ApacheIndex='Options Indexes FollowSymLinks' \n"
- "ApacheIndexReplace='Options FollowSymLinks' \n"
- "mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup\
\ \n"
- "wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo\
\ \n"
- "yum makecache \n"
- "yum install -y unzip zip \n"
- "yum install -y curl httpd mysql-server php56 php56-php-mysql \n"
- "#yum install -y php56-php-gd php56-php-imap php56-php-ldap php56-php-odbc\
\ php56-php-xmlrpc \n"
- "rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm \n"
- "rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm\
\ \n"
- "yum install -y php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64\
\ php56w-gd.x86_64 php56w-imap.x86_64 php56w-ldap.x86_64 php56w-mysql.x86_64\
\ php56w-pdo.x86_64 php56w-odbc.x86_64 php56w-process.x86_64 php56w-xml.x86_64\
\ php56w-xmlrpc.x86_64 \n"
- "systemctl restart httpd \n"
- "chkconfig httpd on \n"
- "# Download WordPress \n"
- "wget https://ros-template-resources.oss-cn-beijing.aliyuncs.com/WordPress/WordPress.zip\
\ \n"
- "unzip WordPress.zip \n"
- "mv WordPress-master wordpress \n"
- 'sed -i "s/database_name_here/$db_wordpress/" wordpress/wp-config-sample.php
'
- 'sed -i "s/username_here/$user_wordpress/" wordpress/wp-config-sample.php
'
- 'sed -i "s/password_here/$pwd_wordpress/" wordpress/wp-config-sample.php
'
- 'sed -i "s/utf8/$charset/" wordpress/wp-config-sample.php
'
- "sed -i \"s/localhost/$host/\" wordpress/wp-config-sample.php \n"
- "sed -i \"20a\\define('WP_REDIS_PASSWORD', 'redis_password');\" wordpress/wp-config-sample.php\
\ \n"
- "sed -i \"20a\\define('WP_REDIS_DATABASE', '10');\" wordpress/wp-config-sample.php\
\ \n"
- "sed -i \"20a\\define('WP_REDIS_PORT', '6379');\" wordpress/wp-config-sample.php\
\ \n"
- "sed -i \"20a\\define('WP_REDIS_HOST', 'redis_host');\" wordpress/wp-config-sample.php\
\ \n"
- "sed -i \"20a\\/** Redis conf **/\" wordpress/wp-config-sample.php\
\ \n"
- "sed -i \"s%redis_host%$redis_host%\" wordpress/wp-config-sample.php\
\ \n"
- "sed -i \"s%redis_password%$redis_password%\" wordpress/wp-config-sample.php\
\ \n"
- "echo \"Conf redis finished\" > /tmp/report.log \n"
- "cat wordpress/wp-config-sample.php | tr -d '\r' > redis-wp-config.php\
\ \n"
- "cat redis-wp-config.php > wordpress/wp-config-sample.php \n"
- 'mv wordpress/wp-config-sample.php wordpress/wp-config.php
'
- 'cp -a wordpress/* $WebRootPath
'
- 'rm -rf wordpress*
'
- "systemctl stop httpd \n"
- 'usermod -d $WebRootPath apache &>/dev/null
'
- 'chown apache:apache -R $WebRootPath
'
- 'sed -i "s/$ApacheIndex/$ApacheIndexReplace/" /etc/httpd/conf/httpd.conf
'
- "echo \"install wordPress finished\" > /tmp/report.log \n"
- "# Download WordPress redis-cache \n"
- "wget https://ros-template-resources.oss-cn-beijing.aliyuncs.com/WordPress/redis-cache.zip\
\ \n"
- "unzip redis-cache.zip \n"
- "mv redis-cache-master redis-cache \n"
- "cp -rf redis-cache /var/www/html/wp-content/plugins/ \n"
- "cp /var/www/html/wp-content/plugins/redis-cache/includes/object-cache.php\
\ /var/www/html/wp-content/ \n"
- "systemctl start httpd \n"
- "ros-notify -d \"{\\\"Data\\\" : \\\"SUCCESS\\\", \\\"Status\\\" :\
\ \\\"SUCCESS\\\"}\" \n"
- Ref: ALIYUN::NoValue
DependsOn:
- Rds
- Redis
Metadata:
ALIYUN::ROS::Designer:
id: d1600d3c-9502-41d4-a820-d6191f18d5c7
VpcEip:
Type: ALIYUN::VPC::EIP
Properties:
Bandwidth:
Ref: EipBandwidth
InternetChargeType:
Ref: EipInternetChargeType
Metadata:
ALIYUN::ROS::Designer:
id: b6e9f6c2-67e8-4d7d-921e-8420851eeb72
EipBind:
Type: ALIYUN::VPC::EIPAssociation
Properties:
InstanceId:
Fn::Select:
- '0'
- Fn::GetAtt:
- EcsInstanceGroup
- InstanceIds
AllocationId:
Ref: VpcEip
DependsOn: EcsInstanceGroup
Metadata:
ALIYUN::ROS::Designer:
id: b36a6115-8a3d-46ae-9da6-81067d5001cb
RdsAccount:
Type: ALIYUN::RDS::Account
Properties:
AccountName:
Ref: RdsAccountName
AccountPassword:
Ref: RdsAccountPwd
AccountType: Normal
DBInstanceId:
Ref: Rds
DependsOn: Rds
Metadata:
ALIYUN::ROS::Designer:
id: e4261848-fea6-4a89-8c04-76badeef0065
RdsAccountPrivilege:
Type: ALIYUN::RDS::AccountPrivilege
Properties:
AccountName:
Ref: RdsAccountName
AccountPrivilege: ReadWrite
DBInstanceId:
Ref: Rds
DBName:
Ref: RdsDBName
DependsOn: RdsAccount
Metadata:
ALIYUN::ROS::Designer:
id: e70877d3-f588-41fb-aa34-5f35cc4a3384
RedisWhitelist:
Type: ALIYUN::REDIS::Whitelist
Properties:
InstanceId:
Ref: Redis
SecurityIps:
Ref: VpcCidrBlock
DependsOn:
- Redis
Metadata:
ALIYUN::ROS::Designer:
id: f0c9dd1d-9bff-4aa5-a8a2-ce8359d8d578
RosWaitConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Condition: CreateCentOSImage
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: 8b8a7d0d-b449-4d6b-9848-b1e7aebac91f
RosWaitCondition:
Type: ALIYUN::ROS::WaitCondition
Condition: CreateCentOSImage
Properties:
Count: 1
Handle:
Ref: RosWaitConditionHandle
Timeout: 3600
Metadata:
ALIYUN::ROS::Designer:
id: 0a28ac3e-7797-47ac-b8d9-9172a472b2fe
Slb:
Type: ALIYUN::SLB::LoadBalancer
Properties:
AddressType: internet
LoadBalancerName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
LoadBalancerSpec:
Ref: LoadBalancerSpec
MasterZoneId:
Ref: VSwZone
PayType: PayOnDemand
Tags:
- Key: best_practice
Value: '057'
Metadata:
ALIYUN::ROS::Designer:
id: a6b3e3a3-ba70-42c1-8a44-c0b6b2d90244
SlbBackendServerAttachment:
Type: ALIYUN::SLB::BackendServerAttachment
Properties:
BackendServerList:
Fn::GetAtt:
- EcsInstanceGroup
- InstanceIds
BackendServerWeightList:
- 100
LoadBalancerId:
Ref: Slb
DependsOn:
- EcsInstanceGroup
Metadata:
ALIYUN::ROS::Designer:
id: 323e7370-3fc5-43e9-bffc-c64c51235a68
SlbListener:
Type: ALIYUN::SLB::Listener
Properties:
BackendServerPort:
Ref: SlbListenerBackendServerPort
Bandwidth: -1
HealthCheck:
HealthyThreshold: 3
HttpCode: http_2xx,http_3xx,http_4xx,http_5xx
Interval: 2
Port: 80
Timeout: 5
URI: /
UnhealthyThreshold: 3
ListenerPort:
Ref: SlbListenerPort
LoadBalancerId:
Ref: Slb
Persistence:
CookieTimeout: 60
PersistenceTimeout: 180
StickySession: 'on'
StickySessionType: insert
XForwardedFor: 'off'
Protocol: http
Metadata:
ALIYUN::ROS::Designer:
id: 2140f4ac-07bf-45cf-b57f-f91f428f4ffa
Outputs:
EcsHostNames:
Description:
en: List of host names for cloud server instances
zh-cn: 云服务器实例的主机名称列表
Value:
Fn::GetAtt:
- EcsInstanceGroup
- HostNames
EcsInstanceIds:
Description:
en: List of cloud server instance IDs
zh-cn: 云服务器实例ID列表
Value:
Fn::GetAtt:
- EcsInstanceGroup
- InstanceIds
EcsPrivateIps:
Description:
en: Private network IP list of cloud server instances
zh-cn: 云服务器实例的私网IP列表
Value:
Fn::GetAtt:
- EcsInstanceGroup
- PrivateIps
Eip:
Description:
en: Eip IP
zh-cn: 弹性公网IP。
Value:
Fn::GetAtt:
- VpcEip
- EipAddress
RdsDBInstanceId:
Description:
en: RDS DB Instance ID
zh-cn: 数据库实例ID。
Value:
Fn::GetAtt:
- Rds
- DBInstanceId
RdsInnerConnectionString:
Description:
en: Database instance Intranet connection string
zh-cn: 数据库实例内网连接串。
Value:
Fn::GetAtt:
- Rds
- InnerConnectionString
RdsInnerIPAddress:
Description:
en: Database instance Intranet IP
zh-cn: 数据库实例内网IP。
Value:
Fn::GetAtt:
- Rds
- InnerIPAddress
RdsInnerPort:
Description:
en: Intranet port for the database instance
zh-cn: 数据库实例的内网端口。
Value:
Fn::GetAtt:
- Rds
- InnerPort
RdsNormalAccountName:
Description:
en: Database ordinary account name
zh-cn: 数据库普通账号名称
Value:
Fn::GetAtt:
- RdsAccount
- AccountName
SLbNetworkType:
Description:
en: SLB Network Type
zh-cn: 负载均衡网络类型。
Value:
Fn::GetAtt:
- Slb
- NetworkType
SgId:
Description:
en: Security Group ID
zh-cn: 安全组ID
Value:
Fn::GetAtt:
- EcsSecurityGroup
- SecurityGroupId
SlbAddressType:
Description:
en: SLB address type
zh-cn: 负载均衡地址类型。
Value:
Fn::GetAtt:
- Slb
- AddressType
SlbBackendServers:
Description:
en: SLB Backend Servers
zh-cn: 负载均衡后端服务器组。
Value:
Fn::GetAtt:
- SlbBackendServerAttachment
- BackendServers
SlbInstanceId:
Description:
en: SLB Instance ID
zh-cn: 负载均衡实例ID。
Value:
Fn::GetAtt:
- Slb
- LoadBalancerId
SlbIpAddress:
Description:
en: SLB IP Address
zh-cn: 负载均衡IP地址
Value:
Fn::GetAtt:
- Slb
- IpAddress
SlbListenerPortsAndProtocol:
Description:
en: SLB ports and protocols
zh-cn: 负载均衡端口和协议
Value:
Fn::GetAtt:
- SlbListener
- ListenerPortsAndProtocol
VpcId:
Description:
en: Virtual proprietary network instance ID
zh-cn: 虚拟专有网络实例ID。
Value:
Fn::GetAtt:
- EcsVpc
- VpcId
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcCidrBlock
- VSwZone
- VSwCidrBlock
- EipBandwidth
- EipInternetChargeType
Label:
default: VPC
- Parameters:
- EcsGroupInstanceType
- EcsGroupSystemDiskCategory
- EcsGroupSystemDiskSize
- EcsGroupMaxAmount
- EcsGroupImage
- EcsGroupPassword
- EcsGroupName
Label:
default: ECS
- Parameters:
- LoadBalancerSpec
- SlbListenerPort
- SlbListenerBackendServerPort
Label:
default: SLB
- Parameters:
- DBInstanceEngineAndVersion
- RdsDBInstanceClass
- RdsDBInstanceStorage
- RdsDBName
- DBCharacterSetName
- RdsAccountName
- RdsAccountPwd
Label:
default: RDS
- Parameters:
- RedisInstanceClass
- RedisEngineVersion
- RedisPassword
Label:
default: REDIS
TemplateTags:
- acs:solution:备份&容灾:同地域跨可用区容灾方案2.0-单可用区应用搭建
ALIYUN::ROS::Designer:
00dee6e9-cf2d-4847-9e3b-5ff5b7c99e53:
source:
id: 0a28ac3e-7797-47ac-b8d9-9172a472b2fe
target:
id: 8b8a7d0d-b449-4d6b-9848-b1e7aebac91f
z: 1
05e15b79-239a-45fb-bc95-14ae111d628c:
source:
id: d1600d3c-9502-41d4-a820-d6191f18d5c7