forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-enterprise-web-with-mobi.yml
284 lines (273 loc) · 8.12 KB
/
build-enterprise-web-with-mobi.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 本模板用于低代码高效构建企业门户网站。
en: This template is used to efficiently build enterprise portals with low code.
Parameters:
ZoneId:
Type: String
Label:
en: Zone ID
zh-cn: 可用区ID
Description:
en: Zone ID.
zh-cn: 可用区ID
AssociationProperty: ZoneId
AssociationPropertyMetadata:
AutoSelectFirst: true
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:
zh-cn: 必须属于VPC的子网段。
en: Must belong to the subnet segment of VPC.
AssociationProperty: ALIYUN::VPC::VSwitch::CidrBlock
Required: true
Default: 192.168.1.0/24
DBInstanceClass:
Type: String
Label:
en: Instance Class
zh-cn: 实例规格
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${ZoneId}
EngineVersion: "8.0"
Engine: MySQL
Category: Basic
InstanceChargeType: Postpaid
DBInstanceStorageType: cloud_essd
CommodityCode: bards
DbUserName:
Type: String
Label:
en: RDS DB Username
zh-cn: RDS数据库账号
ConstraintDescription:
en: Consist of 2 to 16 characters of lowercase letters, underline. Must begin
with a letter and be end with an alphanumeric character.
zh-cn: 由 2 到 16 个小写字母组成,下划线。必须以字母开头,以字母数字字符结尾。
Default: db_user
MinLength: 2
MaxLength: 16
DbPassword:
Type: String
Label:
en: RDS Database Password
zh-cn: RDS数据库密码
Description:
en: "The password must be 8 to 32 characters in length. <br>\nIt must contain\
\ the following character types: uppercase letters, lowercase letters, digits,\
\ and special characters. <br> \nSpecial characters include <span style=\"\
background:#E7E9EB;\"><b>!@#$%^&*()_+-=</b></span>.<br>\n<b>If you repeatedly\
\ provision in this tutorial on the same ECS instance, make sure that the\
\ MySQL database password is exactly the same as the password set when the\
\ template was executed for the first time. Otherwise, the result of provisioning\
\ is unavailable.</b>"
zh-cn: "长度为8~32位,需包含大写字母、小写字母、特殊字符和数字,允许的特殊字符包括<span style=\"background:#E7E9EB;\"\
><b>!@#$%^&*()_+-=</b></span>。<br>"
AssociationProperty: 'ALIYUN::RDS::Instance::AccountPassword'
NoEcho: true
DbName:
Type: String
Label:
en: RDS DB Name
zh-cn: RDS数据库名称
ConstraintDescription:
en: Consist of 2 to 16 characters of lowercase letters, underline. Must begin
with a letter and be end with an alphanumeric character.
zh-cn: 由 2 到 16 个小写字母组成,下划线。必须以字母开头,以字母数字字符结尾。
Default: db_name
MinLength: 2
MaxLength: 16
Locals:
MobiWorkspaces:
Type: DATASOURCE::MOBI::Workspaces
WorkspaceId:
Type: Eval
Value:
Fn::Select:
- 0
- Fn::GetAtt:
- MobiWorkspaces
- WorkspaceIds
Resources:
Vpc:
Type: 'ALIYUN::ECS::VPC'
Properties:
VpcName: vpc
CidrBlock:
Ref: VpcCidrBlock
VSwitch:
Type: 'ALIYUN::ECS::VSwitch'
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: Vpc
VSwitchName: vsw_001
CidrBlock:
Ref: VSwitchCidrBlock
RdsDBInstance:
Type: ALIYUN::RDS::DBInstance
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
DBInstanceClass:
Ref: DBInstanceClass
DBInstanceStorage: 50
Engine: MySQL
EngineVersion: "8.0"
MasterUserType: Normal
MasterUsername:
Ref: DbUserName
MasterUserPassword:
Ref: DbPassword
Category: Basic
DBInstanceStorageType: cloud_essd
AllocatePublicConnection: true
SecurityIPList:
Fn::Join:
- ','
- - Ref: VpcCidrBlock
- 101.200.211.106
DbBase:
Type: ALIYUN::RDS::Database
Properties:
DBInstanceId:
Ref: RdsDBInstance
CharacterSetName: utf8
DBName:
Ref: DbName
DBDescription: tutorial base
RdsAccountPrivilege:
Type: ALIYUN::RDS::AccountPrivilege
Properties:
AccountPrivilege: ReadWrite
DBInstanceId:
Ref: RdsDBInstance
DBName:
Ref: DbName
AccountName:
Ref: DbUserName
DependsOn:
- DbBase
RandomString:
Type: ALIYUN::RandomString
Properties:
length: 7
character_classes:
- class: lowercase
min: 1
- class: digits
min: 1
Mobi:
Type: ALIYUN::MOBI::App
Properties:
AppName:
Fn::Sub: "test_${RandomString.value}"
AppIcon: -1
AppWorkspaceId:
Ref: WorkspaceId
AppType: Web
Template:
TemplateId: e1e78223-38c4-4184-972c-ac0eead93e11
ConnectionsContent:
Fn::Sub: |-
[
{
"name": "企业官网模板_${RandomString.value}",
"connectorType": {
"kind": "mysql",
"name": "mysql"
},
"folderId": "/",
"resourceRequirementId": "7dfe969b-1d54-4cbc-a8fd-209000b30ad0",
"resourceObject": {
"version": "1.0",
"id": "7dfe969b-1d54-4cbc-a8fd-209000b30ad0",
"name": "企业官网模板_20241203160633",
"type": "sql",
"subType": "mysql",
"connectionTemplates": {
"dev": {
"host": "${RdsDBInstance.PublicConnectionString}",
"port": 3306,
"database": "${DbName}",
"username": "${DbUserName}",
"password": "${DbPassword}"
},
"product": {
"host": "${RdsDBInstance.PublicConnectionString}",
"port": 3306,
"database": "${DbName}",
"username": "${DbUserName}",
"password": "${DbPassword}"
}
}
}
}
]
Outputs:
RdsPublicConnectionString:
Description:
zh-cn: 公网连接地址。
en: Rds Public Connection address.
Value:
Fn::GetAtt:
- RdsDBInstance
- PublicConnectionString
MobiUrl:
Description:
zh-cn: Mobi地址。
en: Mobi address.
Value:
Fn::Sub:
- https://mobinext.console.aliyun.com/${WorkspaceId}/app/${MobiId}
- WorkspaceId:
Ref: WorkspaceId
MobiId:
Ref: Mobi
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- ZoneId
- VpcCidrBlock
- VSwitchCidrBlock
Label:
default:
en: VPC
zh-cn: 专有网络配置
- Parameters:
- DBInstanceClass
- DbUserName
- DbPassword
- DbName
Label:
default:
en: RDS
zh-cn: RDS配置
TemplateTags:
- acs:technical-solution:db:低代码高效构建企业门户网站