-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathdrawing_with_tongyi_wanxiang.yml
412 lines (410 loc) · 10.3 KB
/
drawing_with_tongyi_wanxiang.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建VPC、ECS实例、OSS存储桶,配置安全组和RAM访问权限,安装Java与应用,实现文本绘图与人像美化服务。
en: Create a Virtual Private Cloud (VPC), Elastic Compute Service (ECS) instances,
Object Storage Service (OSS) buckets, configure Security Groups and Resource Access
Management (RAM) permissions, install Java and applications, and implement text
drawing and portrait beautification services.
Parameters:
BucketName:
ConstraintDescription:
zh-cn: 3 到 63 个字符,不以连字符 (-) 开头和结尾,可以包含小写字母、数字和连字符 (-)
en: >-
3 to 63 characters, not beginning and ending with a hyphen (-), can
contain lowercase letters, Numbers and hyphens (-)
Description:
zh-cn: >-
3到63个字符,不以连字符(-)开头和结尾,可以包含小写字母、数字和连字符(-);<br>备注:<font
color='blue'><b>需要保证整个网络的唯一性,已经存在的无法创建</b></font>
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>
MinLength: 3
Label:
zh-cn: 存储空间名称
en: Bucket Name
AllowedPattern: '^[a-z0-9]+[a-z0-9\-]*[a-z0-9]+$'
MaxLength: 63
Type: String
AssociationProperty: AutoCompleteInput
AssociationPropertyMetadata:
Length: 5
Prefix: drawing-with-tongyi-wanxiang-
CharacterClasses:
- Class: lowercase
min: 1
DashScopeApiKey:
Type: String
AssociationProperty: 'ALIYUN::DashScope::ApiKey'
Label:
en: DashScope API-KEY
zh-cn: DashScope API-KEY
Description:
zh-cn: >-
开通灵积模型服务,并获得 API-KEY。请参考:
<a href="https://help.aliyun.com/zh/dashscope/developer-reference/activate-dashscope-and-create-an-api-key"
target="_blank">开通DashScope并创建API-KEY</a>。
en: >-
Activate DashScope and obtain the API-KEY. Please refer to:
<a href="https://help.aliyun.com/zh/dashscope/developer-reference/activate-dashscope-and-create-an-api-key"
target="_blank">Activate DashScope and create API-KEY</a>.
ZoneId:
Type: String
Default: null
Required: true
Label:
en: Availability Zone
zh-cn: 可用区
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
AssociationPropertyMetadata:
AutoSelectFirst: true
InstanceType:
Type: String
Default: null
Required: true
Label:
en: Instance Type
zh-cn: 实例类型
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${ZoneId}
InstanceChargeType: PostPaid
SystemDiskCategory: cloud_essd
InstancePassword:
Type: String
NoEcho: true
Default: null
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'
CommonName:
Type: String
Default: wanxiang
Resources:
Vpc:
Type: 'ALIYUN::ECS::VPC'
Properties:
CidrBlock: 192.168.0.0/16
VpcName:
Fn::Sub: ${CommonName}-vpc
VSwitch:
Type: 'ALIYUN::ECS::VSwitch'
Properties:
VpcId:
Ref: Vpc
CidrBlock: 192.168.0.0/24
ZoneId:
Ref: ZoneId
VSwitchName:
Fn::Sub: ${CommonName}-vsw
SecurityGroup:
Type: 'ALIYUN::ECS::SecurityGroup'
Properties:
VpcId:
Ref: Vpc
SecurityGroupName:
Fn::Sub: ${CommonName}-sg
SecurityGroupIngress:
- PortRange: 80/80
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
EcsInstance:
Type: 'ALIYUN::ECS::InstanceGroup'
Properties:
VpcId:
Ref: Vpc
ZoneId:
Ref: ZoneId
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SecurityGroup
ImageId: aliyun_3_9_x64_20G_alibase_
InstanceName:
Fn::Sub: ${CommonName}-ecs
InstanceType:
Ref: InstanceType
SystemDiskCategory: cloud_essd
MaxAmount: 1
InternetMaxBandwidthOut: 5
Password:
Ref: InstancePassword
Bucket:
Type: 'ALIYUN::OSS::Bucket'
Properties:
BucketName:
Ref: BucketName
DeletionForce: true
User:
Type: ALIYUN::RAM::User
Properties:
UserName:
Fn::Sub: create_by_solution-${ALIYUN::StackId}
PolicyAttachments:
Custom:
- Ref: CustomPolicy
AccessKey:
Type: ALIYUN::RAM::AccessKey
Properties:
UserName:
Ref: User
CustomPolicy:
Type: ALIYUN::RAM::ManagedPolicy
Properties:
PolicyName:
Fn::Sub: create_by_solution-${ALIYUN::StackId}
PolicyDocument:
Version: '1'
Statement:
- Effect: Allow
Action:
- oss:GetObject
- oss:PutObject
Resource:
- Fn::Sub: acs:oss:oss-${ALIYUN::Region}:${ALIYUN::TenantId}:${BucketName}/*
ModuleInstallJava:
Version: default
Type: 'MODULE::ACS::OOS::Extension'
Properties:
EcsInstanceIds:
- Ref: EcsInstance
PackageName: ACS-Extension-java-1853370294850618
InstallApp:
Type: 'ALIYUN::ECS::RunCommand'
DependsOn: ModuleInstallJava
Properties:
InstanceIds:
- Ref: EcsInstance
Type: RunShellScript
Sync: true
Timeout: 3600
CommandContent:
Fn::Sub: |-
#!/bin/bash
cat << EOF >> ~/.bash_profile
export DASHSCOPE_API_KEY=${DashScopeApiKey}
export OSS_ACCESS_KEY_ID=${AccessKey.AccessKeyId}
export OSS_ACCESS_KEY_SECRET=${AccessKey.AccessKeySecret}
export WANX_DEMO_OSS_BUCKET=${BucketName}
export WANX_DEMO_OSS_ENDPOINT=https://oss-${ALIYUN::Region}.aliyuncs.com
EOF
source ~/.bash_profile
wget https://help-static-aliyun-doc.aliyuncs.com/demos/wanx-demo-0.0.1-SNAPSHOT.jar
nohup java -jar wanx-demo-0.0.1-SNAPSHOT.jar > wanx-demo.log 2>&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=${EcsInstance}
ExperienceAddress:
Description:
en: Experience address.
zh-cn: 体验地址。
Value:
Fn::Sub:
- http://${PublicIp}/wanx-demo
- PublicIp:
Fn::Select:
- 0
- Fn::GetAtt:
- EcsInstance
- PublicIps
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- DashScopeApiKey
- BucketName
- ZoneId
- InstanceType
- InstancePassword
Hidden:
- CommonName
TemplateTags:
- acs:technical-solution:ai:通义万相的文本绘图与人像美化之旅-tech_solu_128
ALIYUN::ROS::Composer:
'23220280':
Parent: e8d23603
Rect:
- 40
- 40
- -8
- 442
- 3
- 0
ResT: MODULE::ACS::OOS::Extension
8c5f0f94:
Rect:
- 654
- 510
- -68
- 100
- 1
- 0
ResT: Composer::ROSParameter::AlibabaCloud
e8d23603:
Parent: 8c5f0f94
Rect:
- 597
- 433
- -48
- 150
- 2
- 0
ResT: Composer::ROSParameter::Region
63f1283d:
Res:
- Vpc
Parent: e8d23603
Rect:
- 358
- 356
- 72
- 200
- 3
- 0
c1091400:
Res:
- Bucket
Parent: e8d23603
Rect:
- 40
- 40
- -8
- 250
- 3
- 0
3950e0d6:
Res:
- InstallApp
Parent: e8d23603
Rect:
- 40
- 40
- -8
- 350
- 3
- 0
ef152f1d:
Res:
- CustomPolicy
Parent: e8d23603
Rect:
- 40
- 40
- 468
- 250
- 3
- 0
c291cf84:
Res:
- User
Parent: e8d23603
Rect:
- 40
- 40
- 468
- 347
- 3
- 0
458380c2:
Res:
- AccessKey
Parent: e8d23603
Rect:
- 40
- 40
- 468
- 442
- 3
- 0
Label: AccessKey
18401ef3:
Res:
- ZoneId
Parent: 63f1283d
Rect:
- 317
- 289
- 92
- 250
- 4
- 0
ResT: Composer::ROSParameter::Zone
b6b92362:
Res:
- VSwitch
Parent: 18401ef3
Rect:
- 260
- 221
- 112
- 300
- 5
- 0
9c86f934:
Parent: e8d23603
Edge:
- c291cf84
- ef152f1d
Line: 0:0:0:gray:0
c74292f0:
Parent: e8d23603
Edge:
- 458380c2
- c291cf84
Line: 0:0:0:gray:0
541b6c79:
Parent: e8d23603
Edge:
- '23220280'
- 352ee17d
Line: 0:0:0:gray:0
2645ee1c:
Parent: e8d23603
Edge:
- 3950e0d6
- 352ee17d
Line: 0:0:0:gray:0
20c6183b:
Res:
- SecurityGroup
Parent: 63f1283d
Rect:
- 141
- 133
- 167
- 349
- 13
- 0
352ee17d:
Res:
- EcsInstance
Parent: b6b92362
Rect:
- 40
- 40
- 212
- 395
- 14
- 0
Layer:
- 20c6183b