到头来还是得从云加社区同步过来草
0x01.公测活动
从云函数和API网关控制台的banner
可以看到,Serverless WordPress
建站提供了公测期间免费体验的活动!





0x02.部署应用
点击 https://console.cloud.tencent.com/sls/create?t=wordpress&from=gw 此链接通过模板创建应用,如下图

输入自定义的应用名称:wordpress
环境选择默认的:开发环境
地域修改为:北京

点击完成,开始部署,可以在部署日志中看到进度,这里需要稍等一段时间(自己部署时卡在Downloading code
一段时间……



可以看到这里报错了,是因为没有授权CFS
,因为之前是需要付费开通的,所以就一直没有授权
1 | [2021-05-06 17:57:07] Error: 获取cfs信息错误。({"Error": {"Code": "AuthFailure.UnauthorizedOperation", "Message": "CAM signature/authentication error: request unauthorized([request id:663878175]you are not authorized to perform operation (cfs:DescribeCfsFileSystems)\nresource (qcs::cfs:ap-beijing:uin/954078278:filesystem/*) has no permission\n)"}, "RequestId": "2105555b-e5a8-4af0-a992-4fd7c144d26b"}) (reqId: d5c8a801-34c9-4bd4-950b-4077f1ad8034) |

部署失败的同时收到了邮件,是代金券到账的消息(好像少了两种服务的优惠券?

随便点到一个云函数里,可以看到关联的文件系统资源

参照https://cloud.tencent.com/document/product/583/46199进行权限追加
在访问管理https://console.cloud.tencent.com/cam/role,的角色中找到SCF_QcsRole
,点击关联策略

添加QcloudCFSReadOnlyAccess
的策略


然后重新部署,第二次部署的时候速度变得很快
1 | Downloading code |
耗时四分钟不到,从日志中可以看到创建了VPC
、CFS
、CynosDB cluster
、apigw
、云函数wpInitFaas
和wpServerFaas
,云函数关联了layer

0x03.初始化应用
进入管理登录地址

填写信息后,点击安装

安装完成之后,即可进入后台管理页面,就可以写文章进行发布了



0x04.后记
趁着这次机会体会到了serverless
和腾讯云其他产品的结合,CFS
和TDSQL-C Serverless
实现了远程挂载和数据存储的需求,因此wordpress
部署在serverless
上才得以实现,对传统服务的流程进行了替换
