Closed wanghaoxi3000 closed 5 years ago
你是使用的 Docker 镜像还是自己编译的呢?如果是 Docker 镜像的话,可能是因为 COS 的 Go SDK 有不兼容的升级更新,参见 https://github.com/CFETeam/weapp-demo-album/issues/4
这个我明天有空的话看下具体原因吧,然后再看看能不能修。
使用的是 Docker 镜像, 之前使用 PicGO 的腾讯COS 插件还需要配置一个地域参数, 感觉应该是 SDK 有更新吧. 很好的项目, 辛苦了.
@wanghaoxi3000
新发了一版 Docker Image 0.5.0,这次更新用最新的 go 版本编译,用到的包也都更新了版本,另外换用了 alpine 做 runtime image,体积减小到只有十几 MB 了~
可以用新版本试一下。我本地试了下 COS 能上传成功来着。
如果还有问题的话麻烦连同 docker logs <container-name>
显示的日志一起发上来,我再看下啥问题吧。
@7sDream 我试了下新的 docker 版本还是不能上传...
docker 的部分运行日志:
[INFO] [Entry] 2019/03/04 10:00:33 Args bindIP = :
[INFO] [Entry] 2019/03/04 10:00:33 Args port = 0
[INFO] [Entry] 2019/03/04 10:00:33 Args password = test
[INFO] [Entry] 2019/03/04 10:00:33 Args maxFileSize = 5 MB
[INFO] [Entry] 2019/03/04 10:00:33 Args loggerLevel = 1
[INFO] [Entry] 2019/03/04 10:00:33 Args https = false
[INFO] [Entry] 2019/03/04 10:00:33 Args cert dir = .
[INFO] [Entry] 2019/03/04 10:00:33 Args plugin = tccos
[INFO] [Entry] 2019/03/04 10:00:33 Check runtime environment
[INFO] [Entry] 2019/03/04 10:00:33 All runtime environment check passed
[INFO] [Entry] 2019/03/04 10:00:33 Start rikka with arg: bind to socket :80 , with password test , max file size 5 MB , plugin tccos , log level 1
[INFO] [Entry] 2019/03/04 10:00:33 Load plugin...
[INFO] [Plugins] [TC-COS] 2019/03/04 10:00:33 Start plugin tencent cloud object storage
[INFO] [Plugins] 2019/03/04 10:00:33 Args bucket name = test-1256611153
[INFO] [Plugins] 2019/03/04 10:00:33 Args bucket host =
[INFO] [Plugins] 2019/03/04 10:00:33 Args bucket path = img/rikka/
[INFO] [Plugins] [TC-COS] 2019/03/04 10:00:33 Args AppID = 10000*******
[INFO] [Plugins] [TC-COS] 2019/03/04 10:00:33 Args SecretID = AKIDJ*******************************
[INFO] [Plugins] [TC-COS] 2019/03/04 10:00:33 Args SecretKey = zwmV3***************************
[INFO] [Plugins] [TC-COS] 2019/03/04 10:00:33 Tencent cloud object storage plugin start successfully
[INFO] [Server] 2019/03/04 10:00:33 Start web server...
[INFO] [Server] [Web] 2019/03/04 10:00:33 Args wsroot = server/webserver
[INFO] [Server] [Web] 2019/03/04 10:00:33 Check needed files
[INFO] [Server] [Web] 2019/03/04 10:00:33 Check needed files successfully
[INFO] [Server] [Web] 2019/03/04 10:00:33 Rikka web server start successfully
[INFO] [Server] 2019/03/04 10:00:33 Start API server
[INFO] [Server] [API] 2019/03/04 10:00:33 API server start successfully
[INFO] [Server] 2019/03/04 10:00:33 Rikka is listening :80
[INFO] [Server] [Web] 2019/03/04 10:03:07 Receive a template render request of index.html from ip 171.221.147.182
[INFO] [Server] [Web] 2019/03/04 10:03:07 Render template index.html to 171.221.147.182 successfully
[INFO] [Server] [API] 2019/03/04 10:03:54 Receive file upload request from ip 171.221.147.182
[INFO] [Server] [API] 2019/03/04 10:04:03 Receive task ID request by 171.221.147.182 from plugin manager: 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png
[INFO] [Plugins] [TC-COS] 2019/03/04 10:04:03 Get sha256 of task 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png : 42EB9144743EE283079BF1DE3F8F51DE012CBC6E
[INFO] [Server] [Web] 2019/03/04 10:04:03 Receive a view request of task 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png from ip 171.221.147.182
[WARN] [Plugins] 2019/03/04 10:04:03 Task 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png not finished, can't get url
[WARN] [Server] [Web] 2019/03/04 10:04:03 Can't get url of task 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png : task is not finished
[WARN] [Server] [Web] 2019/03/04 10:04:03 Render template view.html
[INFO] [Server] [Web] 2019/03/04 10:04:03 Render template view.html to 171.221.147.182 successfully
[INFO] [Server] [API] 2019/03/04 10:04:03 Receive a state request of task 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png from ip 171.221.147.182
[INFO] [Server] [API] 2019/03/04 10:04:04 Receive a state request of task 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png from ip 171.221.147.182
[INFO] [Server] [API] 2019/03/04 10:04:05 Receive a state request of task 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png from ip 171.221.147.182
[INFO] [Server] [API] 2019/03/04 10:04:06 Receive a state request of task 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png from ip 171.221.147.182
[INFO] [Plugins] [TC-COS] 2019/03/04 10:04:07 Get response json: map[string]interface {}{"code":-97, "message":"ERROR_PROXY_AUTH_FAILED"}
[ERROR] [Plugins] [TC-COS] 2019/03/04 10:04:07 Error happened when upload 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png : ERROR_PROXY_AUTH_FAILED
[ERROR] [Plugins] [TC-COS] 2019/03/04 10:04:07 Error happened when upload image 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png to cos: ERROR_PROXY_AUTH_FAILED
[INFO] [Server] [API] 2019/03/04 10:04:07 Receive a state request of task 93e4dc89-3157-4680-8b56-fd3bcd2c3a55.png from ip 171.221.147.182
我想起来了,之前写的时候好像 COS 还没有 SDK,我是自己写的……
貌似现在 COS 更新了版本,最新版是 V5 了?我用的是 V4 版,可能是这里不一样。
麻烦确认下你的 COS 控制面版上这里是不是 V5?
如果是的话可能这个插件需要重写一下。
不过我看现在也出了 COS 的 SDK 了,应该改改也还好。
应该就是这个问题,我的对象存储服务已经是V5版本了
那可能得等一会,工作日应该是没啥时间了,我周末看有没有时间加一下……
@ilumer 提了个 PR 做了 COS v5 的支持,我明天抽时间合到 master,测下没问题的话就发个版本,应该下版本就可以用了。
如果你愿意的话也可以 dev 分支测试先~
@wanghaoxi3000 已发布 0.6.0
可以拉取最新镜像试一下。
注意需要加上命令行参数 -tccosVer v5
以及环境变量 RIKKA_TENCENT_REGION=ap-beijing
(以实际为准)。
我更新了下还是不能上传... 日志显示 403 AccessDenied
我的启动命令是
docker run -td --name rikka -p 3020:80 -e RIKKA_TENCENT_APPID=100** -e RIKKA_TENCENT_SECRETID=AKID** -e RIKKA_TENCENT_SECRETKEY=zwmV** -e RIKKA_TENCENT_REGION=ap-chengdu 7sdream/rikka -pwd *** -plugin tccos -bname da*** -tccosVer v5 -bpath img/rikka
部分日志信息:
[INFO] [Entry] 2019/03/12 16:56:40 Args bindIP = :
[INFO] [Entry] 2019/03/12 16:56:40 Args port = 0
[INFO] [Entry] 2019/03/12 16:56:40 Args password = test
[INFO] [Entry] 2019/03/12 16:56:40 Args maxFileSize = 5 MB
[INFO] [Entry] 2019/03/12 16:56:40 Args loggerLevel = 1
[INFO] [Entry] 2019/03/12 16:56:40 Args https = false
[INFO] [Entry] 2019/03/12 16:56:40 Args cert dir = .
[INFO] [Entry] 2019/03/12 16:56:40 Args plugin = tccos
[INFO] [Entry] 2019/03/12 16:56:40 Check runtime environment
[INFO] [Entry] 2019/03/12 16:56:40 All runtime environment check passed
[INFO] [Entry] 2019/03/12 16:56:40 Start rikka with arg: bind to socket :80 , with password test , max file size 5 MB , plugin tccos , log level 1
[INFO] [Entry] 2019/03/12 16:56:40 Load plugin...
[INFO] [Plugins] [TC-COS] 2019/03/12 16:56:40 Start plugin tencent cloud object storage
[INFO] [Plugins] 2019/03/12 16:56:40 Args bucket name = da***
[INFO] [Plugins] 2019/03/12 16:56:40 Args bucket host =
[INFO] [Plugins] 2019/03/12 16:56:40 Args bucket path = img/rikka
[INFO] [Plugins] [TC-COS] 2019/03/12 16:56:40 Args AppID = 10000*******
[INFO] [Plugins] [TC-COS] 2019/03/12 16:56:40 Args SecretID = AKIDJ*******************************
[INFO] [Plugins] [TC-COS] 2019/03/12 16:56:40 Args SecretKey = zwmV3***************************
[INFO] [Plugins] [TC-COS] 2019/03/12 16:56:40 Args Region = ap-ch*****
[INFO] [Plugins] [TC-COS] 2019/03/12 16:56:40 Tencent cloud object storage plugin start successfully
[INFO] [Server] 2019/03/12 16:56:40 Start web server...
[INFO] [Server] [Web] 2019/03/12 16:56:40 Args wsroot = server/webserver
[INFO] [Server] [Web] 2019/03/12 16:56:40 Check needed files
[INFO] [Server] [Web] 2019/03/12 16:56:40 Check needed files successfully
[INFO] [Server] [Web] 2019/03/12 16:56:40 Rikka web server start successfully
[INFO] [Server] 2019/03/12 16:56:40 Start API server
[INFO] [Server] [API] 2019/03/12 16:56:40 API server start successfully
[INFO] [Server] 2019/03/12 16:56:40 Rikka is listening :80
[INFO] [Server] [API] 2019/03/12 16:57:12 Receive file upload request from ip 171.221.143.231
[INFO] [Server] [API] 2019/03/12 16:57:12 Receive task ID request by 171.221.143.231 from plugin manager: 251ceaf5-9ca8-4a4b-a7c3-8e9a4930e5eb.png
[INFO] [Server] [Web] 2019/03/12 16:57:12 Receive a view request of task 251ceaf5-9ca8-4a4b-a7c3-8e9a4930e5eb.png from ip 171.221.143.231
[WARN] [Plugins] 2019/03/12 16:57:12 Task 251ceaf5-9ca8-4a4b-a7c3-8e9a4930e5eb.png not finished, can't get url
[WARN] [Server] [Web] 2019/03/12 16:57:12 Can't get url of task 251ceaf5-9ca8-4a4b-a7c3-8e9a4930e5eb.png : task is not finished
[WARN] [Server] [Web] 2019/03/12 16:57:12 Render template view.html
[INFO] [Server] [Web] 2019/03/12 16:57:12 Render template view.html to 171.221.143.231 successfully
[ERROR] [Plugins] [TC-COS] 2019/03/12 16:57:12 Error happened when upload image 251ceaf5-9ca8-4a4b-a7c3-8e9a4930e5eb.png to cos: PUT http://dar***.cos.ap-chengdu.myqcloud.com/img/rikka//251ceaf5-9ca8-4a4b-a7c3-8e9a4930e5eb.png: 403 AccessDenied(Message: Access Denied., RequestId: NWM4N2U0ZThfMjViMjU4NjRfNDM0ZF8xNjkzY2E3, TraceId: OGVmYzZiMmQzYjA2OWNhODk0NTRkMTBiOWVmMDAxODc0OWRkZjk0ZDM1NmI1M2E2MTRlY2MzZDhmNmI5MWI1OTQyYWVlY2QwZTk2MDVmZDQ3MmI2Y2I4ZmI5ZmM4ODFjMGU5NjQzNGY1N2ZkZTM2MmQ2NzI2NGU1ZGIyNDgxZDc=)
[INFO] [Server] [API] 2019/03/12 16:57:12 Receive a state request of task 251ceaf5-9ca8-4a4b-a7c3-8e9a4930e5eb.png from ip 171.221.143.231
我看了下日志中的上传路径是 /img/rikka//251ceaf5-9ca8-4a4b-a7c3-8e9a4930e5eb.png
, rikka 后多了一个/
, 不知道是不是这有问题
我在本地测试了master分支和docker 镜像都没有问题,要不你看看是不是这里的错误码中存在的问题,是不是appid设置错误。这里的路径确实有问题,但好像不影响上传(我的锅)。
AccessDenied | 签名或者权限不正确,拒绝访问 | 403 Forbidden |
---|
仔细看了下文档,原来 V5 的 APPID 就是存储桶后面跟着的那串 ID, 我写成账号 ID 了... 现在已经可以上传了, 感谢 @ilumer @7sDream
根据教程部署了一个使用腾讯对象储存服务 Cloud Object Service 插件的服务, 不过上传图像失败, 看了下日志提示 ERROR_PROXY_AUTH_FAILED :
[INFO] [Plugins] [TC-COS] 2019/02/16 14:40:19 Get response json: map[string]interface {}{"code":-97, "message":"ERROR_PROXY_AUTH_FAILED"}
确定了配置的各项参数都是对的, 是不是还需要配置地域的参数呀