-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathbaota-on-ecs.yml
580 lines (577 loc) · 13.8 KB
/
baota-on-ecs.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 部署宝塔服务。
en: Deploy the BaoTa Panel Free service.
Parameters:
InstanceSource:
Type: String
Default: CreateNew
Label:
zh-cn: 实例来源
en: Instance Source
AllowedValues:
- CreateNew
- UseExisted
AssociationPropertyMetadata:
ValueLabelMapping:
CreateNew:
zh-cn: 创建新实例
en: Create New Instance
UseExisted:
zh-cn: 选择已有实例
en: Select Existed Instance
ZoneId:
Type: String
Default: null
Required: true
Label:
en: Availability Zone
zh-cn: 可用区
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
AssociationPropertyMetadata:
AutoSelectFirst: true
Visible:
Condition:
Fn::Equals:
- ${InstanceSource}
- CreateNew
ImageId:
Type: String
Default: aliyun_3_x64_20G_alibase_20240819.vhd
Required: true
Label:
en: Image of Instance
zh-cn: 实例镜像
AllowedValues:
- aliyun_3_x64_20G_alibase_20240819.vhd
AssociationPropertyMetadata:
ValueLabelMapping:
aliyun_3_x64_20G_alibase_20240819.vhd:
zh-cn: Alibaba Cloud Linux 3
en: Alibaba Cloud Linux 3
Visible:
Condition:
Fn::Equals:
- ${InstanceSource}
- CreateNew
InstanceType:
Type: String
Default: null
Required: true
Label:
en: Instance Type
zh-cn: 实例类型
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${ZoneId}
SpotStrategy: SpotAsPriceGo
InstanceChargeType: PostPaid
SystemDiskCategory: cloud_essd
Visible:
Condition:
Fn::Equals:
- ${InstanceSource}
- CreateNew
InstancePassword:
Type: String
NoEcho: true
Default: null
Confirm: true
Required: true
Description:
en: >-
Server login password, Length 8-30, must contain three(Capital letters,
lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special
symbol in)
zh-cn: >-
服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/
中的特殊符号)
Label:
en: Instance Password
zh-cn: 实例密码
ConstraintDescription:
en: >-
Length 8-30, must contain three(Capital letters, lowercase letters,
numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)
zh-cn: '长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/ 中的特殊符号)'
AssociationProperty: 'ALIYUN::ECS::Instance::Password'
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${InstanceSource}
- CreateNew
EcsInstanceId:
Type: String
Default: null
Label:
en: ECS Instance ID
zh-cn: ECS实例ID
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
Status: Running
Visible:
Condition:
Fn::Equals:
- ${InstanceSource}
- UseExisted
CommonName:
Type: String
Default: deploy_baota_panel_free_by_ros
Conditions:
CreateInstance:
Fn::Equals:
- Ref: InstanceSource
- CreateNew
UseExistedInstance:
Fn::Equals:
- Ref: InstanceSource
- UseExisted
Resources:
Vpc:
Type: 'ALIYUN::ECS::VPC'
Condition: CreateInstance
Properties:
CidrBlock: 192.168.0.0/16
VpcName:
Fn::Sub: ${CommonName}-vpc
VSwitch:
Type: 'ALIYUN::ECS::VSwitch'
Condition: CreateInstance
Properties:
VpcId:
Ref: Vpc
CidrBlock: 192.168.0.0/24
ZoneId:
Ref: ZoneId
VSwitchName:
Fn::Sub: ${CommonName}-vsw
SecurityGroup:
Type: 'ALIYUN::ECS::SecurityGroup'
Condition: CreateInstance
Properties:
VpcId:
Ref: Vpc
SecurityGroupName:
Fn::Sub: ${CommonName}-sg
SecurityGroupIngress:
- PortRange: 443/443
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
- PortRange: 8888/8888
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
- PortRange: '-1/-1'
SourceCidrIp: 0.0.0.0/0
IpProtocol: icmp
EcsInstance:
Type: 'ALIYUN::ECS::InstanceGroup'
Condition: CreateInstance
Properties:
VpcId:
Ref: Vpc
ZoneId:
Ref: ZoneId
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId:
Ref: ImageId
InstanceName:
Fn::Sub: ${CommonName}-ecs
InstanceType:
Ref: InstanceType
SystemDiskCategory: cloud_essd
MaxAmount: 1
InternetMaxBandwidthOut: 100
SpotStrategy: SpotAsPriceGo
Password:
Ref: InstancePassword
ModuleInstallBaoTaPanelFree:
Version: default
Type: 'MODULE::ACS::OOS::Extension'
Properties:
EcsInstanceIds:
- Fn::If:
- UseExistedInstance
- Ref: EcsInstanceId
- Ref: EcsInstance
PackageName: ACS-Extension-BaoTaPanelFree-One-Click-1853370294850618
GetBaoTaPanelLoginInfo:
Type: ALIYUN::ECS::RunCommand
DependsOn: ModuleInstallBaoTaPanelFree
Properties:
Type: RunShellScript
CommandContent:
Fn::Sub: |
#!/bin/sh
PUBLIC_URL=`bt default | grep 外网面板地址 | awk -F " " '{print $2}'`
PRIVATE_URL=`bt default | grep 内网面板地址 | awk -F " " '{print $2}'`
USERNAME=`bt default | grep username | awk -F " " '{print $2}'`
PASSWORD=`bt default | grep password | awk -F " " '{print $2}'`
${GetBaoTaPanelLoginInfoWaitConditionHandle.CurlCli} --data-binary '{"status": "SUCCESS", "data": "'$PUBLIC_URL'", "id": "PUBLIC_URL"}'
${GetBaoTaPanelLoginInfoWaitConditionHandle.CurlCli} --data-binary '{"status": "SUCCESS", "data": "'$PRIVATE_URL'", "id": "PRIVATE_URL"}'
${GetBaoTaPanelLoginInfoWaitConditionHandle.CurlCli} --data-binary '{"status": "SUCCESS", "data": "'$USERNAME'", "id": "USERNAME"}'
${GetBaoTaPanelLoginInfoWaitConditionHandle.CurlCli} --data-binary '{"status": "SUCCESS", "data": "'$PASSWORD'", "id": "PASSWORD"}'
InstanceIds:
- Fn::If:
- UseExistedInstance
- Ref: EcsInstanceId
- Ref: EcsInstance
Timeout: 60
GetBaoTaPanelLoginInfoWaitConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties:
Mode: Increment
GetBaoTaPanelLoginInfoWaitCondition:
Type: ALIYUN::ROS::WaitCondition
DependsOn: GetBaoTaPanelLoginInfo
Properties:
Handle:
Ref: GetBaoTaPanelLoginInfoWaitConditionHandle
Timeout: 60
Count: 4
DsEcs:
Type: 'DATASOURCE::ECS::Instances'
Properties:
InstanceIds:
- Fn::If:
- UseExistedInstance
- Ref: EcsInstanceId
- Ref: EcsInstance
SecurityGroupIngress_443:
Type: ALIYUN::ECS::SecurityGroupIngress
Condition: UseExistedInstance
Properties:
SecurityGroupId:
Fn::Jq:
- First
- .[0].SecurityGroupIds[0]
- Fn::GetAtt:
- DsEcs
- Instances
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
NicType: intranet
PortRange: 443/443
SecurityGroupIngress_8888:
Type: ALIYUN::ECS::SecurityGroupIngress
Condition: UseExistedInstance
Properties:
SecurityGroupId:
Fn::Jq:
- First
- .[0].SecurityGroupIds[0]
- Fn::GetAtt:
- DsEcs
- Instances
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
NicType: intranet
PortRange: 8888/8888
SecurityGroupIngress_-1:
Type: ALIYUN::ECS::SecurityGroupIngress
Condition: UseExistedInstance
Properties:
SecurityGroupId:
Fn::Jq:
- First
- .[0].SecurityGroupIds[0]
- Fn::GetAtt:
- DsEcs
- Instances
SourceCidrIp: 0.0.0.0/0
IpProtocol: icmp
NicType: intranet
PortRange: -1/-1
Outputs:
EcsLoginAddress:
Description:
en: Ecs login address.
zh-cn: ECS登录地址。
Value:
Fn::Sub:
- https://ecs-workbench.aliyun.com/?from=EcsConsole&instanceType=ecs®ionId=${ALIYUN::Region}&instanceId=${InstanceId}
- InstanceId:
Fn::If:
- UseExistedInstance
- Ref: EcsInstanceId
- Ref: EcsInstance
Console@PublicURL:
Description:
en: The public network can be accessed through this address.
zh-cn: 公网可通过此地址访问。
Label:
en: PublicURL
zh-cn: 公网面板地址
Value:
Fn::Jq:
- First
- .PUBLIC_URL
- Fn::GetAtt:
- GetBaoTaPanelLoginInfoWaitCondition
- Data
Console@PRIVATE_URL:
Description:
en: Internal network access can be accessed through this address.
zh-cn: 内网可通过此地址访问。
Label:
en: PRIVATE_URL
zh-cn: 内网面板地址
Value:
Fn::Jq:
- First
- .PRIVATE_URL
- Fn::GetAtt:
- GetBaoTaPanelLoginInfoWaitCondition
- Data
Console@USERNAME:
Description:
en: USERNAME
zh-cn: 默认用户名
Label:
en: USERNAME
zh-cn: 默认用户名
Value:
Fn::Jq:
- First
- .USERNAME
- Fn::GetAtt:
- GetBaoTaPanelLoginInfoWaitCondition
- Data
Console@PASSWORD:
Description:
en: The default initial password can only be obtained correctly before logging into the panel for the first time. Please use the bt 5 command to change the password at other times.
zh-cn: 默认初始密码仅在首次登录面板前能正确获取,其它时间请通过 bt 5 命令修改密码。
Label:
en: PASSWORD
zh-cn: 默认密码
NoEcho: true
Value:
Fn::Jq:
- First
- .PASSWORD
- Fn::GetAtt:
- GetBaoTaPanelLoginInfoWaitCondition
- Data
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- InstanceSource
- ZoneId
- ImageId
- InstanceType
- InstancePassword
- EcsInstanceId
Hidden:
- CommonName
TemplateTags:
- acs:document-help:ecs:部署宝塔服务
ALIYUN::ROS::Composer:
86eb3bf8:
Rect:
- 765
- 697
- 8
- 138
- 1
- 0
ResT: Composer::ROSParameter::AlibabaCloud
6d4518b2:
Parent: 86eb3bf8
Rect:
- 722
- 610
- 24
- 195
- 2
- 0
ResT: Composer::ROSParameter::Region
ff8af71b:
Res:
- Vpc
Parent: 6d4518b2
Rect:
- 480
- 340
- 140
- 260
- 3
- 0
8d3dfeeb:
Parent: 6d4518b2
Rect:
- 40
- 40
- 441
- 708
- 3
- 0
ResT: MODULE::ACS::OOS::Extension
daa5909c:
Res:
- GetBaoTaPanelLoginInfo
Parent: 6d4518b2
Rect:
- 40
- 40
- 57
- 448
- 3
- 0
ea41c8da:
Res:
- GetBaoTaPanelLoginInfoWaitCondition
Parent: 6d4518b2
Rect:
- 40
- 40
- 660
- 310
- 3
- 0
57d9c314:
Parent: 6d4518b2
Rect:
- 40
- 40
- 226
- 620
- 3
- 0
ResT: DATASOURCE::ECS::Instances
92e7c185:
Res:
- GetBaoTaPanelLoginInfoWaitConditionHandle
Parent: 6d4518b2
Rect:
- 40
- 40
- 660
- 520
- 3
- 0
16d55f2d:
Res:
- SecurityGroupIngress_8888
Parent: 6d4518b2
Rect:
- 40
- 40
- 314
- 708
- 3
- 0
be668a11:
Res:
- SecurityGroupIngress_443
Parent: 6d4518b2
Rect:
- 40
- 40
- 140
- 708
- 3
- 0
2f70583a:
Res:
- SecurityGroupIngress_-1
Parent: 6d4518b2
Rect:
- 40
- 40
- 226
- 708
- 3
- 0
8e9b0bef:
Res:
- ZoneId
Parent: ff8af71b
Rect:
- 440
- 270
- 160
- 310
- 4
- 0
ResT: Composer::ROSParameter::Zone
1be339b8:
Res:
- VSwitch
Parent: 8e9b0bef
Rect:
- 400
- 200
- 180
- 360
- 5
- 0
1d8b6481:
Res:
- SecurityGroup
Parent: ff8af71b
Rect:
- 223
- 117
- 244
- 419
- 10
- 0
7aa5adbe:
Parent: 6d4518b2
Edge:
- 8d3dfeeb
- ebd3144e
Line: 0:0:0:gray:0
2b6c70d0:
Parent: 6d4518b2
Edge:
- daa5909c
- ebd3144e
Line: 0:0:0:gray:0
d43a78b0:
Parent: 6d4518b2
Edge:
- ea41c8da
- 92e7c185
Line: 0:0:0:gray:0
2c919f9f:
Parent: 6d4518b2
Edge:
- 57d9c314
- ebd3144e
Line: 0:0:0:gray:0
6c21b1ff:
Parent: 6d4518b2
Edge:
- be668a11
- 57d9c314
Line: 0:0:0:gray:0
dc57ee22:
Parent: 6d4518b2
Edge:
- 16d55f2d
- 57d9c314
Line: 0:0:0:gray:0
fe4c41f8:
Parent: 6d4518b2
Edge:
- 2f70583a
- 57d9c314
Line: 0:0:0:gray:0
ebd3144e:
Res:
- EcsInstance
Parent: 1be339b8
Rect:
- 40
- 40
- 336
- 448
- 11
- 0
Layer:
- 1d8b6481