forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drawing_with_tongyi_wanxiang.yml
250 lines (248 loc) · 7.92 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
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: 22/22
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
- PortRange: 80/80
SourceCidrIp: 0.0.0.0/0
IpProtocol: tcp
- PortRange: '-1/-1'
SourceCidrIp: 0.0.0.0/0
IpProtocol: icmp
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