forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exclusive-qa-service.yml
241 lines (238 loc) · 7.8 KB
/
exclusive-qa-service.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建VPC、ECS实例、DashVector集群,配置安全组和网络,部署基于DashVector和通义千问的问答服务应用。
en: Create a Virtual Private Cloud (VPC), Elastic Compute Service (ECS) instances,
and DashVector cluster, configure security groups and networking, and deploy a
question-and-answer service application based on DashVector and Qwen.
Parameters:
BaiLianApiKey:
Type: String
Label:
en: BaiLian API-KEY
zh-cn: 百炼 API-KEY
Description:
zh-cn: >-
开通百炼模型服务,并获得 API-KEY,请参考:
<a href="https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key"
target="_blank">获取 API-KEY</a>。
en: >-
Activate BaiLian and obtain the API-KEY. Please refer to:
<a href="https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key"
target="_blank">Get API-KEY</a>.
DashVectorApiKey:
Type: String
AssociationProperty: 'ALIYUN::DashVector::ApiKey'
Label:
en: DashVector API-KEY
zh-cn: DashVector API-KEY
Description:
zh-cn: >-
开通DashVector向量检索服务,并获得 API-KEY,请参考:
<a href="https://help.aliyun.com/document_detail/2510230.html"
target="_blank">开通DashVector并创建API-KEY</a>。
en: >-
Activate DashVector and obtain the API-KEY. Please refer to:
<a href="https://help.aliyun.com/document_detail/2510230.html"
target="_blank">Activate DashVector and create API-KEY</a>.
ClusterName:
Type: String
Label:
en: Name of DashVector Cluster
zh-cn: DashVector集群名称
AllowedPattern: '[-a-zA-Z0-9_]{3,32}'
AssociationProperty: AutoCompleteInput
AssociationPropertyMetadata:
Length: 5
Prefix: exclusive-qa-server-
CharacterClasses:
- Class: lowercase
min: 1
ConstraintDescription:
zh-cn: 由大小写字母、数字、下划线(_)、中划线(-)组成,长度[3, 32]。
en: It consists of uppercase and lowercase letters, numbers, underline (_), and dash (-). The length is [3, 32]
Description:
zh-cn: 本方案会创建一个免费版的集群,如果您账号下已经创建好了免费版的集群,请输入免费版集群的名称。
en: >-
This solution will create a free version cluster. If you have already created
a free version cluster under your account, please enter the name of the free version cluster.
ZoneId:
Type: String
AssociationProperty: 'ALIYUN::ECS::Instance::ZoneId'
AssociationPropertyMetadata:
AutoSelectFirst: true
Label:
en: Availability Zone
zh-cn: 可用区
InstanceType:
Type: String
AssociationProperty: 'ALIYUN::ECS::Instance::InstanceType'
AssociationPropertyMetadata:
SpotStrategy: SpotAsPriceGo
InstanceChargeType: PostPaid
SystemDiskCategory: cloud_essd
ZoneId: ${ZoneId}
Label:
en: Instance Type
zh-cn: 实例规格
Description:
zh-cn: 本方案会创建一个抢占式实例,并且自动部署专属问答服务。
en: >-
This solution will create a spot instance and automatically deploy a
exclusive question and answer service.
Default: ecs.c7.large
InstancePassword:
NoEcho: true
Type: String
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'
Default: null
Resources:
Vpc:
Type: 'ALIYUN::ECS::VPC'
Properties:
CidrBlock: 192.168.0.0/16
VSwitch:
Type: 'ALIYUN::ECS::VSwitch'
Properties:
VpcId:
Ref: Vpc
CidrBlock: 192.168.0.0/24
ZoneId:
Ref: ZoneId
SecurityGroup:
Type: 'ALIYUN::ECS::SecurityGroup'
Properties:
VpcId:
Ref: Vpc
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: dashVector
InstanceType:
Ref: InstanceType
SystemDiskCategory: cloud_essd
MaxAmount: 1
InternetMaxBandwidthOut: 100
SpotStrategy: SpotAsPriceGo
Password:
Ref: InstancePassword
DashVectorCluster:
Type: 'ALIYUN::DashVector::Cluster'
Properties:
IgnoreExisting: true
ReplicaCount: 1
ClusterName:
Ref: ClusterName
ClusterType: Serverless
RunCommand:
Type: 'ALIYUN::ECS::RunCommand'
Properties:
InstanceIds:
Fn::GetAtt:
- EcsInstance
- InstanceIds
Type: RunShellScript
Sync: true
Timeout: 3600
CommandContent:
Fn::Sub: |-
#!/bin/bash
# script exit code:
# 0 - success
# 1 - unsupported system
# 2 - network not available
# 3 - failed to git clone
# 4 - failed to init python environment
# 5 - failed to embedding data
# 6 - failed to init git
# 7 - failed to run flask app
# 环境变量配置
# 环境变量配置
cat << EOF >> ~/.bash_profile
export PATH=/usr/local/bin:$PATH
export BAILIAN_API_KEY=${BaiLianApiKey}
export DASHVECTOR_API_KEY=${DashVectorApiKey}
export DASHVECTOR_CLUSTER_ENDPOINT=${DashVectorCluster.Endpoint}
export ROS_DEPLOY=true
EOF
source ~/.bash_profile
curl -fsSL https://help-static-aliyun-doc.aliyuncs.com/install-script/dashvector/install.sh|bash
Outputs:
WebUrl:
Description:
zh-cn: Web 访问地址。
en: The Addresses of Web.
Value:
'Fn::Sub':
- 'http://${ServerAddress}'
- ServerAddress:
'Fn::Select':
- 0
- 'Fn::GetAtt':
- EcsInstance
- PublicIps
EcsLoginAddress:
Description:
zh-cn: ECS登录地址。
en: Ecs login address.
Value:
'Fn::Sub':
- >-
https://ecs-workbench.aliyun.com/?from=EcsConsole&instanceType=ecs®ionId=${Region}&instanceId=${InstanceId}
- InstanceId:
'Fn::Select':
- 0
- 'Fn::GetAtt':
- EcsInstance
- InstanceIds
Region:
Ref: 'ALIYUN::Region'
Metadata:
'ALIYUN::ROS::Interface':
ParameterGroups:
- Parameters:
- BaiLianApiKey
- DashVectorApiKey
- ClusterName
Label:
default:
en: ApiKey
zh-cn: ApiKey配置
- Parameters:
- ZoneId
- InstanceType
- InstancePassword
Label:
default:
en: Ecs Instance
zh-cn: ECS实例配置
TemplateTags:
- acs:technical-solution:ai:向量检索与通义千问搭建专属问答服务-tech_solu_109