Skip to content

Commit

Permalink
Merge pull request #1 from fitz-developer/master
Browse files Browse the repository at this point in the history
feat: implement start-oss-cdn app
  • Loading branch information
xsahxl authored Aug 1, 2022
2 parents 4aecca8 + ba6aa57 commit d3c437d
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 10 deletions.
53 changes: 48 additions & 5 deletions start-oss-cdn/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ Tags:
- Web应用
- CDN
Category: Web框架
# Service: # 使用的服务
# Serverless 应用引擎:
# Authorities: #权限描述
# - AliyunCDNFullAccess
Service: # 使用的服务
对象存储:
Authorities: #权限描述
- AliyunOSSFullAccess
CDN:
Authorities: #权限描述
- AliyunCDNFullAccess
Parameters:
type: object
additionalProperties: false # 不允许增加其他属性
required: # 必填项
- region
- bucket
- codeUri
- domainName
properties:
region:
title: 地域
Expand All @@ -28,9 +34,46 @@ Parameters:
- cn-beijing
- cn-hangzhou
- cn-shanghai
- cn-qingdao
- cn-zhangjiakou
- cn-huhehaote
- cn-shenzhen
- cn-guangzhou
- cn-chengdu
- cn-hongkong
- ap-southeast-1
- ap-southeast-2
- ap-southeast-3
- ap-southeast-5
- ap-northeast-1
- eu-central-1
- eu-west-1
- us-west-1
- us-east-1
- ap-south-1
bucket:
title: OSS Bucket
description: OSS Bucket
type: string
codeUri:
title: 本地需要上传的文件目录路径
description: 要上传的目标文件的路径路径,如Vue项目的dist
type: string
indexPage:
title: 默认首页
description: 网站默认首页html
type: string
default: index.html
errorPage:
title: 默认404页面
description: 当页面找不到时跳转到的页面
type: string
default: 404.html
domainName:
title: 加速域名
description: cdn加速域名,必填项
type: string
refreshAfterDeploy:
title: 部署后自动刷新cdn
description: 部署完成后字段cdn的缓存,让cdn的缓存失效,下次访问直接访问源站
type: boolean
default: true
45 changes: 40 additions & 5 deletions start-oss-cdn/src/s.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,48 @@
edition: 1.0.0 # 命令行YAML规范版本,遵循语义化版本(Semantic Versioning)规范
name: functionApp # 项目名称
access: aliyun-release # 秘钥别名
name: start-oss-cdn # 项目名称
access: "{{ access }}" # 秘钥别名

vars: # 全局变量
region: "{{ region }}"
appName: "{{ appName }}"
bucket: "{{ bucket }}"
codeUri: "{{ codeUri }}"
indexPage: "{{ indexPage }}"
errorPage: "{{ errorPage }}"
domainName: "{{ domainName }}"
refreshAfterDeploy: "{{ refreshAfterDeploy }}"

services:
function-test: # 服务名称
component: cdn # 组件名称
oss-website: # oss相关配置
component: oss # 组件名称
props: # 组件的属性值
region: ${vars.region}
bucket: ${vars.bucket}
acl: public-read
codeUri: ${vars.codeUri}
cors: # OSS 设置跨域资源共享规则
[
{
allowedOrigin: [ '*' ],
allowedMethod: [ 'GET', 'PUT', 'DELETE', 'POST', 'HEAD' ],
}
]
website: # OSS 静态网站配置
index: ${vars.indexPage}
error: ${vars.errorPage}
subDir: {
type: redirect
}
cdn-service: # cdn 相关配置
component: devsapp/cdn # 组件名称
props: # 组件的属性值
cdnType: web
domainName: ${vars.domainName}
sources: # 回源地址列表(必填项)
- type: oss # 源站类型(必填项),可选值:ipaddr IP源站、domain 域名源站、oss OSS Bucket为源站、fc_domain 函数计算为源站
content: ${vars.bucket}.oss-${vars.region}.aliyuncs.com # 回源地址(必填项)
refreshConfig:
objectPaths:
- http://${vars.domainName}/
objectType: File
refreshAfterDeploy: ${vars.refreshAfterDeploy}

0 comments on commit d3c437d

Please sign in to comment.