forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wordpress-cluster-phpmyadmin.yml
940 lines (934 loc) · 29.5 KB
/
wordpress-cluster-phpmyadmin.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 部署WordPress和phpMyAdmin应用,含VPC、ECS、RDS、SLB资源,实现自动安装配置与公网访问。
en: Deploy WordPress and phpMyAdmin applications, including VPC, ECS, RDS, and SLB resources, to achieve automatic installation, configuration and public network access.
Parameters:
ZoneId:
Type: String
Label:
en: Zone ID
zh-cn: 可用区ID
Description:
en: Make sure that the available regions support the creation of RDS, SLB, and ECS resource specifications;<br><a href='https://www.alibabacloud.com/help/doc-detail/123712.html' target='_blank'><b><font color='blue'>View region and zone info</font></b></a>.
zh-cn: 确保可用区域支持RDS、SLB和ECS资源规格的创建;<br><a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b><font color='blue'>查看可用区信息</font></b></a>.
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
JumpboxInstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例类型
Description:
en: Please confirm the inventory of this specification under the available area; <br>See detail:<a href='https://www.alibabacloud.com/help/doc-detail/25378.html' target='_blank'><b><font color='blue'>Instance specification family</font></a></b>
zh-cn: 请在可用区域下确认此规格的库存;详见: <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: ZoneId
JumpboxImageId:
Type: String
Label:
en: Image ID
zh-cn: 镜像ID
Description:
en: Image ID,See detail:<b><a href='https://www.alibabacloud.com/help/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>
AssociationProperty: ALIYUN::ECS::Image::ImageId
AssociationPropertyMetadata:
InstanceType: ${JumpboxInstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Default: centos_7_04_64_20G_alibase_201701015.vhd
JumpboxSystemDiskType:
Type: String
Label:
en: System Disk Category
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>]'
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
InstanceType: JumpboxInstanceType
ZoneId: ZoneId
JumpboxPassword:
Type: String
Label:
en: Instance Password
zh-cn: 实例密码
Description:
en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three;<br>special characters include: ()''~!@#$%^&*_-+=|{}[]:;''<>,.?/'
zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号3个;<br>特殊字符包括:()` ~!@#$%^&*_-+=|{}[];` <>,.?/
ConstraintDescription:
en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号三种;特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
AllowedPattern: '[a-zA-Z0-9-\(\)\`\~\!@\#\$%\^&\*-+=\|\{\}\[\]\:\;\‘\,\.\?\/]*'
MinLength: 8
MaxLength: 30
NoEcho: true
LoadBalancerSpec:
Type: String
Label:
en: Specifications
zh-cn: 规格
Description:
en: Instance specifications,</br>see detail:</b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html' target='_blank'><b><font color='blue'>Performance Support Type</b></font></a>
zh-cn: 实例规格,</br>详见:</b><a href='https://help.aliyun.com/document_detail/85939.html' target='_blank'><b><font color='blue'>性能保障型</b></font></a>
Default: slb.s1.small
Category:
AssociationPropertyMetadata:
LocaleKey: RDSCategory
Default: Null
Required: false
AllowedValues:
- Basic
- HighAvailability
- cluster
Label:
zh-cn: 实例系列
en: Category
Type: String
EngineVersion:
Type: String
Label:
en: Engine Version
zh-cn: 数据库引擎版本
Description:
en: RDS MySQL Engine Version
zh-cn: RDS MySQL 数据库版本号
AssociationProperty: ALIYUN::RDS::Engine::EngineVersion
AssociationPropertyMetadata:
Engine: MySQL
Default: '8.0'
DBInstanceClass:
Type: String
Label:
en: Instance Type
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/doc-detail/26312.htm'' target=''_blank''><b><font color=''blue''>Instance specification sheet</font></b></a>.'
zh-cn: '根据数据库引擎类型和可用区域支持选择实例规格;<br>详见: <a href=''https://help.aliyun.com/document_detail/26312.html'' target=''_blank''><b><font color=''blue''>实例规格表</font></b></a>.'
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
Engine: MySQL
Category: ${Category}
EngineVersion: ${EngineVersion}
ZoneId: ${ZoneId}
Default: rds.mysql.s1.small
DBInstanceStorage:
Type: Number
Label:
en: Instance Storage
zh-cn: 存储大小
Description:
en: 'Incrementing in every 5G, unit: GB'
zh-cn: 每5GB进行递增,单位:GB
ConstraintDescription:
en: '[5, 2000] Incrementing in every 5G, unit: GB'
zh-cn: '[5, 2000] 每 5G 递增,单位:GB'
Default: 20
MinValue: 5
MaxValue: 2000
DBName:
Type: String
Label:
en: Database Name
zh-cn: 数据库名称
Description:
en: Consists of lowercase letters, Numbers and special characters (-_).
zh-cn: 由小写字母、数字和特殊字符(-_)组成。
ConstraintDescription:
en: Consists of lowercase letters, Numbers and special characters (-_), beginning with letters, ending with letters or Numbers, up to 64 characters,
zh-cn: 由小写字母、数字和特殊字符(-_)组成,以字母开头,以字母或数字结尾,最多64个字符,
Default: dbname
AllowedPattern: ^[a-z]+[a-z0-9\-\_]*[a-z0-9]+$
MinLength: 1
MaxLength: 63
MasterUserName:
Type: String
Label:
en: User Name
zh-cn: 用户名称
Description:
en: A maximum of 16 characters, consisting of lowercase letters, Numbers, underscores, letters beginning, letters or Numbers ending.
zh-cn: 最多16个字符,包括小写字母、数字、下划线、字母开头、字母或数字结尾。
Default: dbname
MinLength: 1
MaxLength: 16
MasterDBPassword:
Type: String
Label:
en: User Password
zh-cn: 用户密码
Description:
en: Large/lowercase letters, Numbers and special characters take up three kinds, 8-32 bits.
zh-cn: 大/小写字母、数字和特殊字符占3种,8-32位。
ConstraintDescription:
en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers, special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号三种;特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
AllowedPattern: '[a-zA-Z0-9-\!\@\#\$\%\^\&\*\(\)\_\+-=]*'
MinLength: 8
MaxLength: 32
NoEcho: true
Resources:
WebServerConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: { }
RosWaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: WebServerConditionHandle
Timeout: 3600
CreateLoadBalancer:
Type: ALIYUN::SLB::LoadBalancer
Properties:
AddressType: internet
InternetChargeType: paybytraffic
LoadBalancerName: PublicLoadBalancer
LoadBalancerSpec:
Ref: LoadBalancerSpec
MasterZoneId:
Ref: ZoneId
Metadata:
ALIYUN::ROS::Designer:
id: 9771aab8-e10a-40c3-8f4c-5cbe5c7cc900
CreateListener:
Type: ALIYUN::SLB::Listener
Properties:
BackendServerPort: 80
Bandwidth: 1
HealthCheck:
HealthyThreshold: 3
Interval: 2
Timeout: 5
UnhealthyThreshold: 3
ListenerPort: '80'
LoadBalancerId:
Ref: CreateLoadBalancer
Persistence:
PersistenceTimeout: 1
StickySession: 'off'
StickySessionType: insert
XForwardedFor: 'on'
Protocol: tcp
Scheduler: wrr
Metadata:
ALIYUN::ROS::Designer:
id: 38d112d9-01a7-4d67-b933-5a02299dec6d
EcsVpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
VpcName: WordPress-PhpMyAdmin
Metadata:
ALIYUN::ROS::Designer:
id: 374cd7cc-4bd5-4392-949c-e51b1141ac49
VSwitch1:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: EcsVpc
CidrBlock: 192.168.1.0/24
VSwitchName: VSwitch1-x
Metadata:
ALIYUN::ROS::Designer:
id: f8d3243b-66f2-4cf9-9e68-8dfc2a9ae8d1
Database:
Type: ALIYUN::RDS::DBInstance
Properties:
AllocatePublicConnection: true
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: VSwitch1
DBInstanceClass:
Ref: DBInstanceClass
DBInstanceStorage:
Ref: DBInstanceStorage
DBMappings:
- CharacterSetName: utf8
DBName:
Ref: DBName
Engine: MySQL
Category:
Ref: Category
EngineVersion:
Ref: EngineVersion
MasterUserPassword:
Ref: MasterDBPassword
MasterUsername:
Ref: MasterUserName
SecurityIPList: 0.0.0.0/0
Metadata:
ALIYUN::ROS::Designer:
id: 3d0aee34-3a6d-48e7-a0f0-91b21d45c761
NatEip:
Type: ALIYUN::VPC::EIP
Properties:
InternetChargeType: PayByTraffic
Metadata:
ALIYUN::ROS::Designer:
id: c5106c8c-87e8-44e3-9f3b-6a05c9c207e0
NatGateway:
Type: ALIYUN::VPC::NatGateway
Properties:
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: VSwitch1
Description: NAT_Gateway_OSSFS
NatGatewayName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
DependsOn: VSwitch1
Metadata:
ALIYUN::ROS::Designer:
id: 8149252a-29fd-49f8-870d-3659de53b681
EIPBind:
Type: ALIYUN::VPC::EIPAssociation
Properties:
InstanceId:
Ref: NatGateway
AllocationId:
Ref: NatEip
Metadata:
ALIYUN::ROS::Designer:
id: 16e1e20c-8495-4ce8-9442-04b32760a44a
SecurityGroupDefault:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: EcsVpc
SecurityGroupEgress:
- DestCidrIp: 0.0.0.0/0
IpProtocol: all
NicType: internet
PortRange: '-1/-1'
Priority: 1
- DestCidrIp: 0.0.0.0/0
IpProtocol: all
NicType: intranet
PortRange: '-1/-1'
Priority: 1
SecurityGroupIngress:
- IpProtocol: tcp
NicType: internet
PortRange: 22/22
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: tcp
NicType: internet
PortRange: 80/80
Priority: 1
SourceCidrIp: 0.0.0.0/0
SecurityGroupName: WordPress-PhpMyAdmin
Metadata:
ALIYUN::ROS::Designer:
id: 0f18606d-ef61-4f85-b822-e0d0b30b86f8
Jumpbox:
Type: ALIYUN::ECS::Instance
Properties:
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: VSwitch1
SecurityGroupId:
Ref: SecurityGroupDefault
ImageId:
Ref: JumpboxImageId
AllocatePublicIP: false
InstanceType:
Ref: JumpboxInstanceType
Password:
Ref: JumpboxPassword
UserData:
Fn::Sub: |-
#!/bin/bash
if [ ! -f .ros.provision ]; then
echo "Name: wordpress-service" > .ros.provision
fi
name=$(grep "^Name:" .ros.provision | awk -F':' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
if [[ "$name" != "wordpress-service" ]]; then
echo "wordpress-service installed, skip"
exit 0
fi
if ! grep -q "^Step1: Install Environment$" .ros.provision; then
echo "#########################"
echo "# Install Environment"
echo "#########################"
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql sysbench
systemctl start httpd
systemctl enable httpd
systemctl status httpd
yum install -y yum-utils epel-release http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php82
yum -y install php php-opcache php-mysqlnd php-pdo php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
systemctl restart httpd
echo "Step1: Install Environment" >> .ros.provision
else
echo "#########################"
echo "# Environment has been installed"
echo "#########################"
fi
if ! grep -q "^Step2: Install and Config WordPress$" .ros.provision; then
echo "################################"
echo "# Install and Config WordPress"
echo "################################"
wget https://ros-template-resources.oss-cn-beijing.aliyuncs.com/WordPress/wordpress-6.3.1-zh_CN.tar.gz
tar -xvf wordpress-6.3.1-zh_CN.tar.gz -C /var/www/html
mv /var/www/html/wordpress/* /var/www/html
chown -R apache:apache /var/www/html/wordpress
chmod -R 755 /var/www/html/wordpress
mv /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
sed -i 's/localhost/${Database.PublicConnectionString}/' /var/www/html/wp-config.php
sed -i 's/username_here/${MasterUserName}/' /var/www/html/wp-config.php
sed -i 's/password_here/${MasterDBPassword}/' /var/www/html/wp-config.php
sed -i 's/database_name_here/${DBName}/' /var/www/html/wp-config.php
systemctl restart httpd
echo "Step2: Install and Config WordPress" >> .ros.provision
else
echo "#########################"
echo "# WordPress has been installed and configed"
echo "#########################"
fi
${WebServerConditionHandle.CurlCli} --data-binary '{"status": "SUCCESS"}'
SystemDiskCategory:
Ref: JumpboxSystemDiskType
DependsOn:
- Database
Metadata:
ALIYUN::ROS::Designer:
id: 2da08724-689e-49a8-880f-390f6da67297
NewElasticIP:
Type: ALIYUN::VPC::EIP
Properties:
InternetChargeType: PayByTraffic
Metadata:
ALIYUN::ROS::Designer:
id: 042ba09f-a586-44e1-8e9a-37ef6864e275
ElasticIPAssociation:
Type: ALIYUN::VPC::EIPAssociation
Properties:
InstanceId:
Ref: Jumpbox
AllocationId:
Ref: NewElasticIP
Metadata:
ALIYUN::ROS::Designer:
id: 58733be1-49df-4b0d-8e8e-c7948264cdac
SNatTableEntry:
Type: ALIYUN::ECS::SNatEntry
Properties:
SNatIp:
Fn::GetAtt:
- NatEip
- EipAddress
SNatTableId:
Fn::GetAtt:
- NatGateway
- SNatTableId
SourceVSwitchId:
Fn::GetAtt:
- VSwitch1
- VSwitchId
DependsOn: EIPBind
Metadata:
ALIYUN::ROS::Designer:
id: 438b9f7b-b608-47b2-858e-69c53da1ea66
WebScalingGroup:
Type: ALIYUN::ESS::ScalingGroup
Properties:
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: VSwitch1
DBInstanceIds:
- Ref: Database
LoadBalancerIds:
- Ref: CreateLoadBalancer
MaxSize: 2
MinSize: 2
DependsOn:
- Database
- SecurityGroupDefault
Metadata:
ALIYUN::ROS::Designer:
id: 689e36ff-b317-4fc6-9771-300a09309979
WebScalingConfiguration:
Type: ALIYUN::ESS::ScalingConfiguration
Properties:
SecurityGroupId:
Ref: SecurityGroupDefault
ImageId:
Ref: JumpboxImageId
InstanceType:
Ref: JumpboxInstanceType
ScalingGroupId:
Ref: WebScalingGroup
SystemDiskCategory:
Ref: JumpboxSystemDiskType
UserData:
Fn::Sub: |-
#!/bin/bash
if [ ! -f .ros.provision ]; then
echo "Name: wordpress-service" > .ros.provision
fi
name=$(grep "^Name:" .ros.provision | awk -F':' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
if [[ "$name" != "wordpress-service" ]]; then
echo "wordpress-service installed, skip"
exit 0
fi
if ! grep -q "^Step1: Install Environment$" .ros.provision; then
echo "#########################"
echo "# Install Environment"
echo "#########################"
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql sysbench
systemctl start httpd
systemctl enable httpd
systemctl status httpd
yum install -y yum-utils epel-release http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php82
yum -y install php php-opcache php-mysqlnd php-pdo php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
systemctl restart httpd
echo "Step1: Install Environment" >> .ros.provision
else
echo "#########################"
echo "# Environment has been installed"
echo "#########################"
fi
if ! grep -q "^Step2: Install and Config WordPress$" .ros.provision; then
echo "################################"
echo "# Install and Config WordPress"
echo "################################"
wget https://ros-template-resources.oss-cn-beijing.aliyuncs.com/WordPress/wordpress-6.3.1-zh_CN.tar.gz
tar -xvf wordpress-6.3.1-zh_CN.tar.gz -C /var/www/html
mv /var/www/html/wordpress/* /var/www/html
chown -R apache:apache /var/www/html/wordpress
chmod -R 755 /var/www/html/wordpress
mv /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
sed -i 's/localhost/${Database.PublicConnectionString}/' /var/www/html/wp-config.php
sed -i 's/username_here/${MasterUserName}/' /var/www/html/wp-config.php
sed -i 's/password_here/${MasterDBPassword}/' /var/www/html/wp-config.php
sed -i 's/database_name_here/${DBName}/' /var/www/html/wp-config.php
systemctl restart httpd
echo "Step2: Install and Config WordPress" >> .ros.provision
else
echo "#########################"
echo "# WordPress has been installed and configed"
echo "#########################"
fi
Metadata:
ALIYUN::ROS::Designer:
id: 2e9c2d28-87ad-41e7-a8d7-a86a7e7f6ccc
ScalingGroupEnable:
Type: ALIYUN::ESS::ScalingGroupEnable
Properties:
ScalingConfigurationId:
Fn::GetAtt:
- WebScalingConfiguration
- ScalingConfigurationId
ScalingGroupId:
Fn::GetAtt:
- WebScalingGroup
- ScalingGroupId
DependsOn: Jumpbox
Metadata:
ALIYUN::ROS::Designer:
id: 4c0fc3f7-7b2b-4023-88be-8ae4fa5094ad
Outputs:
DBInstanceId:
Description: The instance id of created database instance.
Value:
Fn::GetAtt:
- Database
- DBInstanceId
InnerConnectString:
Description: DB instance connection url by Intranet.
Value:
Fn::GetAtt:
- Database
- InnerConnectionString
JumpboxEipAddress:
Description: IP address of created EIP.
Value:
Fn::GetAtt:
- NewElasticIP
- EipAddress
JumpboxInstanceId:
Description: The instance id of created ecs instance
Value:
Fn::GetAtt:
- Jumpbox
- InstanceId
LoadBalancerIpAddress:
Description: The ip address of the load balancer.
Value:
Fn::GetAtt:
- CreateLoadBalancer
- IpAddress
WordPressUrl:
Description: Wordpress default address.
Value:
Fn::Sub:
- 'http://${IP}'
- IP:
Fn::GetAtt:
- NewElasticIP
- EipAddress
PublicPort:
Description: Internet port of created DB instance.
Value:
Fn::GetAtt:
- Database
- PublicPort
RouteTableId:
Description: The router table id of created VPC.
Value:
Fn::GetAtt:
- EcsVpc
- RouteTableId
SecurityGroupId:
Description: Generated security group id for security group.
Value:
Fn::GetAtt:
- SecurityGroupDefault
- SecurityGroupId
VRouterId:
Description: Router id of created VPC.
Value:
Fn::GetAtt:
- EcsVpc
- VRouterId
VSwitchId:
Description: Id of created VSwitch.
Value:
Fn::GetAtt:
- VSwitch1
- VSwitchId
VpcId:
Description: Id of created VPC.
Value:
Fn::GetAtt:
- EcsVpc
- VpcId
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- ZoneId
- JumpboxInstanceType
- JumpboxImageId
- JumpboxSystemDiskType
- JumpboxPassword
Label:
default: ECS
- Parameters:
- LoadBalancerSpec
Label:
default: SLB
- Parameters:
- Category
- EngineVersion
- DBInstanceClass
- DBInstanceStorage
- DBName
- MasterUserName
- MasterDBPassword
Label:
default: RDS
TemplateTags:
- acs:example:网站:创建一个WordPress可弹性伸缩的集群
ALIYUN::ROS::Designer:
042ba09f-a586-44e1-8e9a-37ef6864e275:
position:
x: 917
'y': 62
size:
height: 60
width: 60
z: 0
04f8322e-7fe1-49f0-a466-405e1acee8e8:
source:
id: 2da08724-689e-49a8-880f-390f6da67297
target:
id: a93c1de5-8a9e-4085-8417-4fa37d754c4c
z: 1
0bf5905a-3c21-4490-a445-8c09d871cba4:
source:
id: 58733be1-49df-4b0d-8e8e-c7948264cdac
target:
id: 2da08724-689e-49a8-880f-390f6da67297
z: 1
0f18606d-ef61-4f85-b822-e0d0b30b86f8:
position:
x: 334
'y': 381
size:
height: 60
width: 60
z: 1
0fef5f8a-2c95-4bdd-b20d-586f1388c7c7:
position:
x: 922
'y': 157
size:
height: 60
width: 60
z: 0
1073bc67-4ae7-478c-9ecf-51a0868bc0ea:
source:
id: 2e9c2d28-87ad-41e7-a8d7-a86a7e7f6ccc
target:
id: 0f18606d-ef61-4f85-b822-e0d0b30b86f8
z: 1
16e1e20c-8495-4ce8-9442-04b32760a44a:
position:
x: 56
'y': 130
size:
height: 60
width: 60
z: 0
1b3a4f9f-1d86-4f12-95c7-b968217d979b:
source:
id: 2da08724-689e-49a8-880f-390f6da67297
target:
id: 3d0aee34-3a6d-48e7-a0f0-91b21d45c761
z: 1
202f07b0-7656-4a70-ac41-0f28726e8983:
source:
id: 58733be1-49df-4b0d-8e8e-c7948264cdac
target:
id: 042ba09f-a586-44e1-8e9a-37ef6864e275
z: 1
21d4f97e-17d2-4837-8cef-6749f670154a:
source:
id: 2da08724-689e-49a8-880f-390f6da67297
target:
id: f10609bb-efaa-4f7a-8d8b-c71094a12db3
z: 1
2da08724-689e-49a8-880f-390f6da67297:
position:
x: 334
'y': 138
size:
height: 60
width: 60
z: 2
2e9c2d28-87ad-41e7-a8d7-a86a7e7f6ccc:
position:
x: 464
'y': 535
size:
height: 60
width: 60
z: 0
374cd7cc-4bd5-4392-949c-e51b1141ac49:
embeds:
- 0f18606d-ef61-4f85-b822-e0d0b30b86f8
- f8d3243b-66f2-4cf9-9e68-8dfc2a9ae8d1
position:
x: 193
'y': 50
size:
height: 435
width: 516.869140625
z: 0
38d112d9-01a7-4d67-b933-5a02299dec6d:
position:
x: 919
'y': 279
size:
height: 60
width: 60
z: 0
3d0aee34-3a6d-48e7-a0f0-91b21d45c761:
position:
x: 469
'y': 194
size:
height: 60
width: 60
z: 2
438b9f7b-b608-47b2-858e-69c53da1ea66:
position:
x: 250
'y': 244
size:
height: 60
width: 60
z: 2
43d3d6c6-db26-4bfb-b98d-a38827f96703:
source:
id: 16e1e20c-8495-4ce8-9442-04b32760a44a
target:
id: 8149252a-29fd-49f8-870d-3659de53b681
z: 1
4c0fc3f7-7b2b-4023-88be-8ae4fa5094ad:
position:
x: 621
'y': 535
size:
height: 60
width: 60
z: 0
58733be1-49df-4b0d-8e8e-c7948264cdac:
position:
x: 777
'y': 62
size:
height: 60
width: 60
z: 0
6138e564-94df-4a43-95b0-5369f48178a9:
source:
id: 2da08724-689e-49a8-880f-390f6da67297
target:
id: 0f18606d-ef61-4f85-b822-e0d0b30b86f8
z: 1
689e36ff-b317-4fc6-9771-300a09309979:
position:
x: 464
'y': 277
size:
height: 60
width: 60
z: 2
723293a4-7b4e-43f8-83a2-9d452aec9a76:
source:
id: f10609bb-efaa-4f7a-8d8b-c71094a12db3
target:
id: 9736d867-f75b-4f97-8fca-0d9bed345f96
z: 1
777bd33a-43c0-482c-bdfb-db77caf57346:
source:
id: aa791fbd-6a56-4cb1-9af6-cf133e63730f
target:
id: 0fef5f8a-2c95-4bdd-b20d-586f1388c7c7
z: 1
8149252a-29fd-49f8-870d-3659de53b681:
position:
x: 250
'y': 130
size:
height: 60
width: 60
z: 2
9736d867-f75b-4f97-8fca-0d9bed345f96:
position:
x: 659
'y': -30
size:
height: 60
width: 60
z: 0
9771aab8-e10a-40c3-8f4c-5cbe5c7cc900:
position:
x: 767
'y': 279
size:
height: 60
width: 60
z: 0
9df7400a-f468-46f7-8588-b596f0c17209:
source:
id: 438b9f7b-b608-47b2-858e-69c53da1ea66
target:
id: c5106c8c-87e8-44e3-9f3b-6a05c9c207e0
z: 1
a55e227d-ec24-4176-9fe3-97e81afffa2c:
source:
id: 16e1e20c-8495-4ce8-9442-04b32760a44a
target:
id: c5106c8c-87e8-44e3-9f3b-6a05c9c207e0
z: 1
a93c1de5-8a9e-4085-8417-4fa37d754c4c:
position:
x: 334
'y': -52
size:
height: 60
width: 60
z: 0
aa791fbd-6a56-4cb1-9af6-cf133e63730f:
position:
x: 777
'y': 157
size:
height: 60
width: 60
z: 0
ae27b5c3-1086-4e79-8500-f2109d90b7f5:
source:
id: aa791fbd-6a56-4cb1-9af6-cf133e63730f
target:
id: 2da08724-689e-49a8-880f-390f6da67297
z: 1
bf250016-70db-46a3-83bc-65fd2ad4d8c8:
source:
id: 4c0fc3f7-7b2b-4023-88be-8ae4fa5094ad
target:
id: 689e36ff-b317-4fc6-9771-300a09309979
z: 1
c5106c8c-87e8-44e3-9f3b-6a05c9c207e0:
position:
x: 56
'y': 244
size:
height: 60
width: 60
z: 0
cbcd72ca-8ac2-4559-adc1-c51e97937e59:
source:
id: 38d112d9-01a7-4d67-b933-5a02299dec6d
target:
id: 9771aab8-e10a-40c3-8f4c-5cbe5c7cc900
z: 1
e7fd569c-8640-4d11-a250-1f1c77815be1:
source:
id: 2e9c2d28-87ad-41e7-a8d7-a86a7e7f6ccc
target:
id: 689e36ff-b317-4fc6-9771-300a09309979
z: 1
ea68d1b7-3667-48e2-bce3-c69d392d1bb0:
source:
id: 4c0fc3f7-7b2b-4023-88be-8ae4fa5094ad
target:
id: 2e9c2d28-87ad-41e7-a8d7-a86a7e7f6ccc
z: 1
f10609bb-efaa-4f7a-8d8b-c71094a12db3:
position:
x: 461
'y': -30
size:
height: 60
width: 60
z: 0
f8d3243b-66f2-4cf9-9e68-8dfc2a9ae8d1:
embeds:
- 8149252a-29fd-49f8-870d-3659de53b681
- 438b9f7b-b608-47b2-858e-69c53da1ea66
- 689e36ff-b317-4fc6-9771-300a09309979
- 2da08724-689e-49a8-880f-390f6da67297
- 3d0aee34-3a6d-48e7-a0f0-91b21d45c761
position:
x: 213
'y': 90
size:
height: 277
width: 363
z: 1
fd62d752-34e7-4ceb-969e-8472facdee3c:
source:
id: 438b9f7b-b608-47b2-858e-69c53da1ea66
target:
id: 8149252a-29fd-49f8-870d-3659de53b681
z: 1