Coding 网站托管迁移腾讯云云开发 Webify

2021-12-27 12:18:05 浏览数 (2)

0x00.前言

谈起自己的 blog,搭建之初是在上大学的时候,源码自然是放到了 gh 上,然后在设置里面开启 Pages 就可以获取到 blog 的外网访问链接。毕竟是静态页面不需要任何计算环境,只要是个能托管网页的云服务都可以。最开始的时候还是在本地 hexo g 生成页面,然后再将 public 文件夹 git push 到 gh 上。后来学会用 Travis-CI 持续集成来跑 hexo g,这样就再也不用在本地 hexo g 了,只需要将 .md 格式的文章 git push 到仓库上,Travis-CI 就会开始 Run 起来,不过用的毕竟是免费的 Travis-CI,SLA 不是特别的高,有时候就会遇到推送了半天任务还是在 pending 状态,一直在排队影响使用体验……再后来 gh 推出了 Actions,果断将 Travis-CI 迁移到了 Actions,毕竟是原生的服务虽然刚上手的时候不太习惯,但是照着各种例子编写 .yml 文件很快就搞定了。

最后,因为 gh Pages 的托管服务器在海外的原因,国内访问的速度并不理想,这时候看到国内有类似的代码平台,并且也提供托管服务,没错说的就是 coding.net,说实话 coding 确实挺良心的,静态托管一直都不需要花钱,最开始托管服务器是在 HK,大陆访问速度还真可以,网页托管再到后面进行了几次升级,其实也是换汤不换药,换成了更友好更自定义的方式,最后升级到基于腾讯云 serverless 源码放在 COS 上并且有国内 CDN 加速,直到最近看到公告说要正式停止服务了……

因产品战略调整,CODING 网站托管将于2021 年 12 月 30 日正式停止服务,推荐您使用腾讯云旗下专为 Web 开发者打造的应用托管平台 - 「云开发 Webify」

虽然换到了腾讯云云开发 Webify,但是针对开发者也同样推出了「Webify 个人站点扶持计划」,那么就可以放心迁移了

0x01.使用

那么话不多说,直接进入正题开始迁移,首先进入到你云「Web 应用托管」的控制台

点击新建应用

这里使用从 gh 导入,选择 blog 所在的仓库,导入

blog 还是基于老生常谈的 hexo,自动识别到框架预设是 Hexo,也不需要再修改构建相关参数了,部署应用

确认创建

然后,部署出错了,可以看到还是 coding 的 Jenkins 那套方案

代码语言:javascript复制
[2021-12-23 21:31:45]
Thu Dec 23 2021 13:31:44 GMT 0000 (Coordinated Universal Time) 29.6 CloudBase Framework::info running 'npx hexo generate'
[2021-12-23 21:31:46]
INFO Add lazy load attribute to all post
[2021-12-23 21:31:46]
INFO Add fallback lazy load using lazysizes
[2021-12-23 21:31:46]
INFO Start processing
[2021-12-23 21:31:47]
Version 9 of Highlight.js has reached EOL and is no longer supported.
[2021-12-23 21:31:47]
Please upgrade or ask whatever dependency you are using to upgrade.
[2021-12-23 21:31:47]
https://github.com/highlightjs/highlight.js/issues/2877
[2021-12-23 21:31:48]
Thu Dec 23 2021 13:31:48 GMT 0000 (Coordinated Universal Time) 33.1 CloudBase Framework::error (node:168) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
[2021-12-23 21:31:48]
(Use `node --trace-warnings ...` to show where the warning was created)
[2021-12-23 21:31:48]
(node:168) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
[2021-12-23 21:31:48]
(node:168) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
[2021-12-23 21:31:48]
(node:168) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
[2021-12-23 21:31:48]
(node:168) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
[2021-12-23 21:31:48]
(node:168) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
[2021-12-23 21:31:48]
fatal: not a git repository (or any of the parent directories): .git
[2021-12-23 21:31:48]
fatal: not a git repository (or any of the parent directories): .git
[2021-12-23 21:31:48]
fatal: not a git repository (or any of the parent directories): .git
[2021-12-23 21:31:48]
fatal: not a git repository (or any of the parent directories): .git
[2021-12-23 21:31:48]
fatal: not a git repository (or any of the parent directories): .git
……
[2021-12-23 21:31:48]
fatal: not a git repository (or any of the parent directories): .git
[2021-12-23 21:31:48]
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
[2021-12-23 21:31:48]
Error: Command failed: git log --follow -1 --format="�" -- /root/cloudbase-workspace/source/_posts/she.md
[2021-12-23 21:31:48]
fatal: not a git repository (or any of the parent directories): .git
[2021-12-23 21:31:48]
[2021-12-23 21:31:48]
at checkExecSyncError (child_process.js:760:11)
[2021-12-23 21:31:48]
at execSync (child_process.js:833:15)
[2021-12-23 21:31:48]
at getUpdated (/root/cloudbase-workspace/node_modules/hexo-filter-date-from-git/index.js:37:19)
[2021-12-23 21:31:48]
at Hexo.<anonymous> (/root/cloudbase-workspace/node_modules/hexo-filter-date-from-git/index.js:17:22)
[2021-12-23 21:31:48]
at Hexo.tryCatcher (/root/cloudbase-workspace/node_modules/bluebird/js/release/util.js:16:23)
[2021-12-23 21:31:48]
at Hexo.<anonymous> (/root/cloudbase-workspace/node_modules/bluebird/js/release/method.js:15:34)
[2021-12-23 21:31:48]
at /root/cloudbase-workspace/node_modules/hexo/lib/extend/filter.js:62:52
[2021-12-23 21:31:48]
at tryCatcher (/root/cloudbase-workspace/node_modules/bluebird/js/release/util.js:16:23)
[2021-12-23 21:31:48]
at Object.gotValue (/root/cloudbase-workspace/node_modules/bluebird/js/release/reduce.js:166:18)
[2021-12-23 21:31:48]
at Object.gotAccum (/root/cloudbase-workspace/node_modules/bluebird/js/release/reduce.js:155:25)
[2021-12-23 21:31:48]
at Object.tryCatcher (/root/cloudbase-workspace/node_modules/bluebird/js/release/util.js:16:23)
[2021-12-23 21:31:48]
at Promise._settlePromiseFromHandler (/root/cloudbase-workspace/node_modules/bluebird/js/release/promise.js:547:31)
[2021-12-23 21:31:48]
at Promise._settlePromise (/root/cloudbase-workspace/node_modules/bluebird/js/release/promise.js:604:18)
[2021-12-23 21:31:48]
at Promise._settlePromise0 (/root/cloudbase-workspace/node_modules/bluebird/js/release/promise.js:649:10)
[2021-12-23 21:31:48]
at Promise._settlePromises (/root/cloudbase-workspace/node_modules/bluebird/js/release/promise.js:729:18)
[2021-12-23 21:31:48]
at _drainQueueStep (/root/cloudbase-workspace/node_modules/bluebird/js/release/async.js:93:12)
[2021-12-23 21:31:48]
at _drainQueue (/root/cloudbase-workspace/node_modules/bluebird/js/release/async.js:86:9)
[2021-12-23 21:31:48]
at Async._drainQueues (/root/cloudbase-workspace/node_modules/bluebird/js/release/async.js:102:5)
[2021-12-23 21:31:48]
at Immediate.Async.drainQueues [as _onImmediate] (/root/cloudbase-workspace/node_modules/bluebird/js/release/async.js:15:14)
[2021-12-23 21:31:48]
at processImmediate (internal/timers.js:464:21)

报错的是 fatal: not a git repository(or any of the parent directories):.git,确认到 hexo-filter-date-from-git 这个插件,它会根据 git 的历史来更新文章中的上次更新时间戳,而看起来本地并不是 git 的仓库,所以报错了……

并且可以看到那里面还有个 git add 的操作

代码语言:javascript复制
[2021-12-23 21:31:06]  cd cloudbase-workspace-private
[2021-12-23 21:31:06]  git config --global user.email tcb@tencent.com
[2021-12-23 21:31:06]  git config --global user.name tcb
[2021-12-23 21:31:06]  git add .
[2021-12-23 21:31:06]  git commit -a -m init

然后到了后面就没有了 .git 文件夹,怪不得报错不是 git 的仓库

代码语言:javascript复制
[2021-12-23 21:31:14]  cd /root/cloudbase-workspace//
[2021-12-23 21:31:14]  pwd
[2021-12-23 21:31:14]/root/cloudbase-workspace
[2021-12-23 21:31:14]  ls -al
[2021-12-23 21:31:14]total 556
[2021-12-23 21:31:14]drwxr-xr-x 6 root root 4096 Dec 23 13:31 .
[2021-12-23 21:31:14]drwx------ 1 root root 4096 Dec 23 13:31 ..
[2021-12-23 21:31:14]drwxr-xr-x 3 root root 4096 Dec 23 13:31 .github
[2021-12-23 21:31:14]-rw-r--r-- 1 root root 90 Dec 23 13:31 .gitignore
[2021-12-23 21:31:14]-rw-r--r-- 1 root root 111 Dec 23 13:31 .gitmodules
[2021-12-23 21:31:14]-rw-r--r-- 1 root root 572 Dec 23 13:31 Jenkinsfile
[2021-12-23 21:31:14]-rw-r--r-- 1 root root 855 Dec 23 13:31 README.md
[2021-12-23 21:31:14]-rw-r--r-- 1 root root 2671 Dec 23 13:31 _config.yml
[2021-12-23 21:31:14]drwxr-xr-x 2 root root 4096 Dec 23 13:31 api
[2021-12-23 21:31:14]-rw-r--r-- 1 root root 403 Dec 23 13:31 deploy.sh
[2021-12-23 21:31:14]-rw-r--r-- 1 root root 508200 Dec 23 13:31 package-lock.json
[2021-12-23 21:31:14]-rw-r--r-- 1 root root 969 Dec 23 13:31 package.json
[2021-12-23 21:31:14]drwxr-xr-x 5 root root 4096 Dec 23 13:31 source
[2021-12-23 21:31:14]drwxr-xr-x 3 root root 4096 Dec 23 13:31 themes
[2021-12-23 21:31:14]-rw-r--r-- 1 root root 2 Dec 23 13:31 vercel.json

这里先 mark 一下,是时候去反馈一下了,等反馈结果出来之后再来更新文章

2021-12-24 20:34:40:反馈结果说后续会进行优化

在等待优化结束前,单独开了一个分支移除 hexo-filter-date-from-git 插件,结果新建应用的时候发现不能选分支……

害得去反馈(

0 人点赞