forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wordpress-cluster-phpmyadmin.yml
1564 lines (1411 loc) · 40.1 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
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: Deploys the WordPress site and the phpMyAdmin app.
zh-cn: 部署WordPress网站和phpMyAdmin应用程序。
Parameters:
BucketName:
Type: String
Label:
en: Bucket Name
zh-cn: 存储空间名称
Description:
en: '3 to 63 characters, not beginning and ending with a hyphen (-), can contain
lowercase letters, Numbers and hyphens (-);<br>Note: <font color=''blue''><b>need
whole network uniqueness, already existing can not be created.</b></font>'
zh-cn: 3到63个字符,不以连字符(-)开头和结尾,可以包含小写字母、数字和连字符(-);<br>备注:<font color='blue'><b>需要保证整个网络的唯一性,已经存在的无法创建</b></font>
ConstraintDescription:
en: 3 to 63 characters, not beginning and ending with a hyphen (-), can contain
lowercase letters, Numbers and hyphens (-)
zh-cn: 3 到 63 个字符,不以连字符 (-) 开头和结尾,可以包含小写字母、数字和连字符 (-)
AssociationProperty: AutoCompleteInput
AssociationPropertyMetadata:
Length: 6
Prefix: application-wordpress-oss-
CharacterClasses:
- Class: lowercase
min: 1
AllowedPattern: ^[a-z0-9]+[a-z0-9\-]*[a-z0-9]+$
MinLength: 3
MaxLength: 63
OSSBucketMountPoint:
Type: String
Label:
en: Bucket Mount Point
zh-cn: OSS存储挂载点
Description:
en: OSS bucket mount point, Application file mount point.
zh-cn: OSS存储挂载点,应用程序文件挂载点。
Default: /ossbucket
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
JumpboxDataDiskType:
Type: String
Label:
en: 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
JumpboxDataDiskSize:
Type: Number
Label:
en: Data Disk Size
zh-cn: 数据盘大小
Description:
en: 'Jumpbox data disk size, Disk unit: GB,default is ''100'', 20~32768.'
zh-cn: 堡垒机数据盘大小,磁盘单位: GB, 范围:20-32768。
Default: 100
MinValue: 20
MaxValue: 32768
MountPoint:
Type: String
Label:
en: Data Disk Mount Point
zh-cn: 数据盘挂载点
Description:
en: The mount point of data disk.
zh-cn: 数据盘挂载点
Default: /data
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
DBInstanceNetType:
Type: String
Label:
en: Instance Type
zh-cn: 实例类型
Description:
en: Database instance net type, default is Intranet.Internet for public access,
Intranet for private access.
zh-cn: 数据库实例网络类型,Internet用于公共访问,Intranet用于私有访问。
Default: Intranet
AllowedValues:
- Intranet
- Internet
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: 10
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
TotalDataDisk:
Type: String
Label:
en: Total Data Disk
zh-cn: 总数据盘
Description:
en: The number of disks mounted in instance.
zh-cn: 实例挂载的磁盘数量。
Default: '1'
Resources:
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:
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: VSwitch1
DBInstanceClass:
Ref: DBInstanceClass
DBInstanceNetType:
Ref: DBInstanceNetType
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
OssBucket:
Type: ALIYUN::OSS::Bucket
Properties:
BucketName:
Ref: BucketName
DeletionForce: true
Metadata:
ALIYUN::ROS::Designer:
id: a93c1de5-8a9e-4085-8417-4fa37d754c4c
RamUser:
Type: ALIYUN::RAM::User
Properties:
Policies:
- PolicyDocument:
Statement:
- Action:
- oss:*
Effect: Allow
Resource:
- '*'
Version: '1'
PolicyName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
UserName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: 9736d867-f75b-4f97-8fca-0d9bed345f96
RamAK:
Type: ALIYUN::RAM::AccessKey
Properties:
UserName:
Fn::GetAtt:
- RamUser
- UserName
Metadata:
ALIYUN::ROS::Designer:
id: f10609bb-efaa-4f7a-8d8b-c71094a12db3
DependOn:
- RamUser
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::Join:
- ''
- - '#!/bin/sh
'
- 'logs=/var/log/mount_logs
'
- '#wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
'
- '#rpm -ivh mysql-community-release-el7-5.noarch.rpm
'
- '#yum install mysql-community-client -y
'
- 'ApacheIndexReplace=''Options Indexes FollowSymLinks''
'
- 'mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
'
- 'wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
'
- 'yum makecache
'
- "yum install -y unzip zip \n"
- "yum install -y curl httpd mysql-server php56 php56-php-mysql \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"
- 'chkconfig httpd on
'
- 'i=1
'
- total=
- Ref: TotalDataDisk
- '
'
- mountpoint=
- Ref: MountPoint
- '
'
- 'while [ $i -le $total ]
'
- 'do
'
- ' j=`echo $i|awk ''{printf "%c", 97+$i}''`
'
- 'fdisk -S 56 /dev/vd$j <<ALIYUN
'
- 'n
'
- 'p
'
- '1
'
- '
'
- '
'
- 'w
'
- 'ALIYUN
'
- ' echo "/dev/vd$j is fdisked!" >> $logs
'
- ' mkfs.ext4 /dev/vd${j}1
'
- ' if [ $? -eq 0 ];then
'
- ' echo "/dev/vd${j}1 is formated!" >> $logs
'
- ' fi
'
- ' touch ~/test_ftab
'
- ' mkdir $mountpoint
'
- 'cat << ALIYUN > ~/test_ftab
'
- '/dev/vd${j}1 $mountpoint ext4 defaults 0 0
'
- 'ALIYUN
'
- ' cat ~/test_ftab >> /etc/fstab
'
- ' mount -a
'
- ' chmod -R 777 $mountpoint
'
- ' rm -rf ~/test_ftab
'
- ' echo "/dev/vd${j}1 is mounted!" >> $logs
'
- ' let i+=1
'
- ossbucket=
- Ref: BucketName
- '
'
- ossbucketaccesskey=
- Fn::GetAtt:
- RamAK
- AccessKeyId
- '
'
- ossbucketsecret=
- Fn::GetAtt:
- RamAK
- AccessKeySecret
- '
'
- ossbucketmountpoint=
- Ref: OSSBucketMountPoint
- '
'
- ossbucketendpoint=
- Fn::Join:
- ''
- - oss-
- Ref: ALIYUN::Region
- -internal.aliyuncs.com
- '
'
- DatabaseUser=
- Ref: MasterUserName
- '
'
- DatabasePwd=
- Ref: MasterDBPassword
- '
'
- DatabaseName=
- Ref: DBName
- '
'
- DatabaseHost=
- Fn::GetAtt:
- Database
- InnerConnectionString
- '
'
- 'ApacheIndex=''Options Indexes FollowSymLinks''
'
- 'ApacheIndexReplace=''Options Indexes FollowSymLinks''
'
- '#yum install -y php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
'
- 'yum install -y phpmyadmin
'
- 'sed -i "s%localhost%$DatabaseHost%" /etc/phpMyAdmin/config.inc.php
'
- 'sed -i "s%Deny,Allow%Allow,Deny%" /etc/httpd/conf.d/phpMyAdmin.conf
'
- 'sed -i "s%Deny from All%Allow from All%" /etc/httpd/conf.d/phpMyAdmin.conf
'
- 'sed -i "/<RequireAny>/a Require all Granted" /etc/httpd/conf.d/phpMyAdmin.conf
'
- 'chkconfig httpd on
'
- 'service httpd stop
'
- 'wget https://github.com/aliyun/ossfs/releases/download/v1.80.3/ossfs_1.80.3_centos6.5_x86_64.rpm
'
- 'yum install -y ossfs_1.80.3_centos6.5_x86_64.rpm
'
- 'echo $ossbucket:$ossbucketaccesskey:$ossbucketsecret >> /etc/passwd-ossfs
'
- 'chmod 600 /etc/passwd-ossfs
'
- 'mkdir $ossbucketmountpoint
'
- 'chmod -R 755 $ossbucketmountpoint
'
- 'echo #This script will automount the ossbucket
'
- 'echo umount $ossbucketmountpoint >> /usr/local/bin/ossfs-automount.sh
'
- 'echo #Mounting OSS Bucket
'
- 'echo ossfs $ossbucket $ossbucketmountpoint -ourl=http://$ossbucketendpoint
-o allow_other -o mp_umask=0022 -ouid=48 -ogid=48 >> /usr/local/bin/ossfs-automount.sh
'
- 'chmod 755 /usr/local/bin/ossfs-automount.sh
'
- 'echo /usr/local/bin/ossfs-automount.sh >> /etc/rc.d/rc.local
'
- 'chmod +x /etc/rc.d/rc.local
'
- '/usr/local/bin/./ossfs-automount.sh
'
- '#wget http://wordpress.org/latest.tar.gz
'
- '#tar -xzvf latest.tar.gz
'
- "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%$DatabaseName%" wordpress/wp-config-sample.php
'
- 'sed -i "s%username_here%$DatabaseUser%" wordpress/wp-config-sample.php
'
- 'sed -i "s%password_here%${DatabasePwd:-$DatabasePwdDef}%" wordpress/wp-config-sample.php
'
- 'sed -i "s%localhost%$DatabaseHost%" wordpress/wp-config-sample.php
'
- 'mv wordpress/wp-config-sample.php wordpress/wp-config.php
'
- 'cp -a wordpress/* $ossbucketmountpoint
'
- '#chmod -R 755 /wwwroot/*
'
- "mv wordpress backup-worpress \n"
- '#sed -i "s%/var/www/html%$ossbucketmountpoint%" /etc/httpd/conf/httpd.conf
'
- '#sed -i "s%/var/www%$ossbucketmountpoint%" /etc/httpd/conf/httpd.conf
'
- 'sed -i "s%$ApacheIndex%$ApacheIndexReplace%" /etc/httpd/conf/httpd.conf
'
- 'chown apache:apache -R /var/www/html
'
- 'service httpd start
'
- 'done
'
DependsOn:
- Database
- OssBucket
- RamAK
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
JumpboxDataDisk:
Type: ALIYUN::ECS::Disk
Properties:
ZoneId:
Ref: ZoneId
DiskCategory:
Ref: JumpboxDataDiskType
Size:
Ref: JumpboxDataDiskSize
Metadata:
ALIYUN::ROS::Designer:
id: 0fef5f8a-2c95-4bdd-b20d-586f1388c7c7
JumpboxDataDiskAttachment:
Type: ALIYUN::ECS::DiskAttachment
Properties:
InstanceId:
Ref: Jumpbox
Device: /dev/xvdb
DiskId:
Fn::GetAtt:
- JumpboxDataDisk
- DiskId
Metadata:
ALIYUN::ROS::Designer:
id: aa791fbd-6a56-4cb1-9af6-cf133e63730f
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
DiskMappings:
- Category:
Ref: JumpboxDataDiskType
Device: /dev/xvdb
Size: 100
InstanceType:
Ref: JumpboxInstanceType
ScalingGroupId:
Ref: WebScalingGroup
SystemDiskCategory:
Ref: JumpboxDataDiskType
UserData:
Fn::Join:
- ''
- - '#!/bin/sh
'
- 'i=1
'
- total=
- Ref: TotalDataDisk
- '
'
- mountpoint=
- Ref: MountPoint
- '
'
- 'while [ $i -le $total ]
'
- 'do
'
- ' j=`echo $i|awk ''{printf "%c", 97+$i}''`
'
- 'fdisk -S 56 /dev/vd$j <<ALIYUN
'
- 'n
'
- 'p
'
- '1
'
- '
'
- '
'
- 'w
'
- 'ALIYUN
'
- ' echo "/dev/vd$j is fdisked!" >> $logs
'
- ' mkfs.ext4 /dev/vd${j}1
'
- ' if [ $? -eq 0 ];then
'
- ' echo "/dev/vd${j}1 is formated!" >> $logs
'
- ' fi
'
- ' touch ~/test_ftab
'
- ' mkdir $mountpoint
'
- 'cat << ALIYUN > ~/test_ftab
'
- '/dev/vd${j}1 $mountpoint ext4 defaults 0 0
'
- 'ALIYUN
'
- ' cat ~/test_ftab >> /etc/fstab
'
- ' mount -a
'
- ' chmod -R 777 $mountpoint
'
- ' rm -rf ~/test_ftab
'
- ' echo "/dev/vd${j}1 is mounted!" >> $logs