-
Notifications
You must be signed in to change notification settings - Fork 35
/
use-function-compute-to-deploy-stable-diffusion-for-ai-painting.yml
171 lines (171 loc) · 5.49 KB
/
use-function-compute-to-deploy-stable-diffusion-for-ai-painting.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 部署Stable Diffusion AI绘画函数计算服务,支持自定义模型镜像,含WebUI与管理后台。
en: Deploy the Stable Diffusion AI image generation function computing service,
supporting custom model images, inclusive of a WebUI and administrative backend.
Conditions:
IsCustom:
Fn::Equals:
- Ref: ImageURL
- Custom
Parameters:
ImageURL:
Type: String
Label:
zh-cn: Stable Diffusion镜像地址
en: Stable Diffusion Image URL
Description:
zh-cn: 选择使用函数计算提供的基于开源项目fc-stable-diffusion-plus构建的镜像 或 自定义的Stable Diffusion镜像。
en: Choose to use the image provided by Function Compute based on the open source
project fc-stable-diffusion-plus or the custom Stable Diffusion image.
Default: registry.cn-hangzhou.aliyuncs.com/serverlessdevshanxie/sd-auto-nas:v3
AllowedValues:
- registry.cn-hangzhou.aliyuncs.com/serverlessdevshanxie/sd-auto-nas:v3
- registry.cn-beijing.aliyuncs.com/serverlessdevshanxie/sd-auto-nas:v3
- registry.cn-shanghai.aliyuncs.com/serverlessdevshanxie/sd-auto-nas:v3
- registry.cn-shenzhen.aliyuncs.com/serverlessdevshanxie/sd-auto-nas:v3
- Custom
CustomImageURL:
Type: String
Label:
zh-cn: 自定义Stable Diffusion镜像地址
en: Custom Stable Diffusion image URL
Description:
zh-cn: 关于如何自定义Stable Diffusion镜像,请参见<a href='https://github.com/devsapp/fc-stable-diffusion-plus#readme'
target='_blank'>fc-stable-diffusion-plus帮助文档</a>。
en: For how to customize the Stable Diffusion image, please refer to <a href='https://github.com/devsapp/fc-stable-diffusion-plus#readme'
target='_blank'>fc-stable-diffusion-plus help documentation</a>.
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${ImageURL}
- Custom
Default: registry.cn-hangzhou.aliyuncs.com/serverlessdevshanxie/sd-auto-nas:v3
AllowedPattern: ^registry[.][a-zA-Z0-9_-]+[.]aliyuncs[.]com/.+$
Resources:
EnableNAS:
Type: ALIYUN::ROS::AutoEnableService
Properties:
ServiceName: NAS
AliyunFCServerlessDevsRole:
Type: ALIYUN::RAM::Role
Properties:
RoleName: AliyunFCServerlessDevsRole
Description: 应用中心需要您的角色中包含应用所需策略,推荐创建并使用系统默认角色 AliyunFCServerlessDevsRole。
AssumeRolePolicyDocument:
Version: '1'
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service:
- fc.aliyuncs.com
MaxSessionDuration: 3600
IgnoreExisting: true
DeletionForce: true
PolicyAttachments:
System:
- AliyunNASFullAccess
- AliyunFCFullAccess
- AliyunFCServerlessDevsRolePolicy
- AliyunOSSReadOnlyAccess
- AliyunECSReadOnlyAccess
- AliyunVPCReadOnlyAccess
- AliyunLogReadOnlyAccess
Application:
Type: ALIYUN::FC::Application
Properties:
Name:
Fn::Sub: fc-stable-diffusion-plus-${ALIYUN::StackId}
RoleARN:
Fn::GetAtt:
- AliyunFCServerlessDevsRole
- Arn
Parameters:
serviceName:
Fn::Sub: fc-stable-diffusion-plus-${ALIYUN::StackId}
functionName:
Fn::Sub: fc-stable-diffusion-plus-${ALIYUN::StackId}
region:
Fn::Select:
- 1
- Fn::Split:
- .
- Fn::If:
- IsCustom
- Ref: CustomImageURL
- Ref: ImageURL
imageUrl:
Fn::If:
- IsCustom
- Ref: CustomImageURL
- Ref: ImageURL
Template: fc-stable-diffusion-plus
AutoDeploy: true
DependsOn: EnableNAS
Outputs:
WebUIUrl:
Description:
zh-cn: WebUI访问域名。
en: URL of WebUI.
Value:
Fn::Sub:
- ${protocol}://${domain}
- protocol:
Fn::Select:
- Fn::Jq:
- First
- ."stable-diffusion-sd-server".customDomains[0].protocol
- Fn::GetAtt:
- Application
- Output
- HTTP: http
HTTPS: https
Http: http
Https: https
http: http
https: https
domain:
Fn::Jq:
- First
- ."stable-diffusion-sd-server".customDomains[0].domainName
- Fn::GetAtt:
- Application
- Output
AdminUrl:
Description:
zh-cn: 模型文件以及插件文件的管理后台访问域名。
en: URL for the management background of model files and plug-in files.
Value:
Fn::Sub:
- ${protocol}://${domain}
- protocol:
Fn::Select:
- Fn::Jq:
- First
- ."fc-nas-filemgr".customDomains[0].protocol
- Fn::GetAtt:
- Application
- Output
- HTTP: http
HTTPS: https
Http: http
Https: https
http: http
https: https
domain:
Fn::Jq:
- First
- ."fc-nas-filemgr".customDomains[0].domainName
- Fn::GetAtt:
- Application
- Output
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- ImageURL
- CustomImageURL
TemplateTags:
- acs:technical-solution:ai:基于函数计算部署Stable Diffusion进行AI绘画