Skip to content

Commit

Permalink
优化seo
Browse files Browse the repository at this point in the history
  • Loading branch information
yunnysunny committed Jan 26, 2024
1 parent e637160 commit adf64ef
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 6 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"license": "MIT",
"devDependencies": {
"markdown-it-disable-url-encode": "^1.0.1",
"vuepress": "^1.9.10"
"vuepress": "^1.9.10",
"vuepress-plugin-autometa": "^0.1.13",
"vuepress-plugin-sitemap": "^2.3.1"
}
}
16 changes: 16 additions & 0 deletions text/.vuepress/config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
const toc = require('./toc')
const base = process.env.CI ? '/nodebook/' : '/'
const baseUrl = 'https://blog.whyun.com/nodebook'
module.exports = {
 title: 'nodebook',
 description: 'Node 基础教程',
base,
dest: 'output',
markdown: {
lineNumbers: true,
externalLinks: { target: '_blank', rel: 'nofollow noopener noreferrer' },
extendMarkdown: md => {
md.use(require('markdown-it-disable-url-encode'));
}
Expand All @@ -28,6 +30,20 @@ module.exports = {
    { text: 'github', link: 'https://github.com/yunnysunny/nodebook' },
    { text: '博客', link: 'https://blog.whyun.com' },
  ]
},
plugins:{
autometa: {
site: {
name: 'nodebook',
twitter: 'yunnysunny',
},
canonical_base: baseUrl,
},
// 'sitemap': {
// hostname: baseUrl,
// // 排除无实际内容的页面
// exclude: ["/404.html"]
// }
}

}
15 changes: 10 additions & 5 deletions text/a7_easy_monitor_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ grant all privileges on xprofiler_console.* to 'easy'@'%';
grant all privileges on xprofiler_logs.* to 'easy'@'%';
flush privileges;
```
#### 7.3.2 启动服务器端
##### 7.3.2.1 启动容器
#### A 7.3.2 启动服务器端
##### A 7.3.2.1 启动容器
为了简化部署,笔者做了一个集成 xtransit-server xprofiler-console xtransit-mannager 三个服务的 docker 容器,是基于官方的 [all-in-one](https://github.com/X-Profiler/all-in-one) 项目优化而来。之所以重新做一个镜像出来,是由于官方镜像将配置信息采用磁盘文件映射的方式来提供,不是很贴合传统运维使用习惯,所以这里提供了一版全部通过环境变量来设置的镜像。
> 镜像项目地址为 [whyun-docker/node (github.com)](https://github.com/whyun-docker/node)
Expand All @@ -58,7 +58,7 @@ REDIS_PASSWORD=redis 密码
CONSOLE_BASE_URL=console 服务的访问地址,例如 http://xxx-console.domian.com
```
然后我们可以通过 `sudo docker run --env-file ./.env -p 8443:8443 -p 8543:8543 -p 9190:9190 --name=easy-monitor -d yunnysunny/easy-monitor` 来启动服务。
##### 7.3.2.2 配置nginx
##### A 7.3.2.2 配置nginx
如果当前网络拓扑结构中不需要配置 nginx,可以跳过此小节。如果需要配置 nginx 的话,则需要添加反向代理配置。其中对于 xprofiler-console 来说给出如下配置示例:
```nginx
server
Expand Down Expand Up @@ -112,7 +112,7 @@ server
}
```
首先反向代理的的 HTTP 协议版本要选择 1.1,其次要设置 Upgrade 和 Connection 两个头信息来请求 Node 服务,否则无法正常完成 WebSocket 的握手过程。
### 7.4 配置客户端
### A 7.4 配置客户端
为了方便读者使用,这里我将继承 xtransit 继承的 node 镜像也制作出来了。可以先通过一个 dockerfile 文件了解一下使用步骤:
```dockerfile
ARG IMAGE_VERSION
Expand Down Expand Up @@ -151,9 +151,14 @@ require('xprofiler').start();
```
> xprofiler 安装时要下载原生代码的预编译库,默认从 github 下载,考虑到众所周知原因,下载比较慢。`yunnysunny/node-xtransit` 镜像基于 `yunnysunny/node` 构建,里面配置 npm config 选项,将其下载地址指向阿里云,有效的解决了这个问题。
### A 7.5 疑难解答
#### A 7.5.1 找不到应用实例

如果构建完镜像后,容器运行完之后,xprofile-console 后台中迟迟看不到启动容器的监控实例。则需要查看容器的 ~/.xtransit.log 文件,比如说在启用 nginx 的情况下,反向代理配置错误,忘记添加 Upgrade 头信息了,就会报如下错误:
```
[2024-01-19 01:31:10] [2.4.1] [info] [36] websocket client connecting to ws://ezm-ws.your-domain.com...
[2024-01-19 01:31:10] [2.4.1] [warn] [36] websocket client error: Error: Unexpected server response: 404.
```
通过日志我们就可以更快的定位问题所在。
通过日志我们就可以更快的定位问题所在。
### A 7.6 未尽事宜
由于本篇教程仅仅涉及部署内容,关于 easy-monitor 的操作指南,还请参照[官方文档](https://www.yuque.com/hyj1991/easy-monitor)
106 changes: 106 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5393,6 +5393,11 @@ lodash._reinterpolate@^3.0.0:
resolved "https://registry.npmmirror.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
integrity sha512-xYHt68QRoYGjeeM/XOE1uJtvXQAgvszfBhjV4yvsQH0u2i9I6cI6c6/eG4Hh3UAOVn0y/xAXwmTzEay49Q//HA==

lodash.chunk@^4.2.0:
version "4.2.0"
resolved "https://registry.npmmirror.com/lodash.chunk/-/lodash.chunk-4.2.0.tgz#66e5ce1f76ed27b4303d8c6512e8d1216e8106bc"
integrity sha512-ZzydJKfUHJwHa+hF5X66zLFCBrWn5GeF28OHEr4WVWtNDXlQ/IjWKPBiikqKo2ne0+v6JgCgJ0GzJp8k8bHC7w==

lodash.clonedeep@^4.5.0:
version "4.5.0"
resolved "https://registry.npmmirror.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
Expand All @@ -5403,6 +5408,21 @@ lodash.debounce@^4.0.8:
resolved "https://registry.npmmirror.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==

[email protected]:
version "4.6.1"
resolved "https://registry.npmmirror.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6"
integrity sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==

[email protected]:
version "4.6.0"
resolved "https://registry.npmmirror.com/lodash.findindex/-/lodash.findindex-4.6.0.tgz#a3245dee61fb9b6e0624b535125624bb69c11106"
integrity sha512-9er6Ccz6sEST3bHFtUrCFWk14nE8cdL/RoW1RRDV1BxqN3qsmsT56L14jhfctAqhVPVcdJw4MRxEaVoAK+JVvw==

[email protected]:
version "4.4.0"
resolved "https://registry.npmmirror.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e"
integrity sha512-oKMuF3xEeqDltrGMfDxAPGIVMSSRv8tbRSODbrs4KGsRRLEhrW8N8Rd4DRgB2+621hY8A8XwwrTVhXWpxFvMzg==

lodash.kebabcase@^4.1.1:
version "4.1.1"
resolved "https://registry.npmmirror.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36"
Expand All @@ -5413,6 +5433,16 @@ lodash.memoize@^4.1.2:
resolved "https://registry.npmmirror.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==

lodash.padstart@^4.6.1:
version "4.6.1"
resolved "https://registry.npmmirror.com/lodash.padstart/-/lodash.padstart-4.6.1.tgz#d2e3eebff0d9d39ad50f5cbd1b52a7bce6bb611b"
integrity sha512-sW73O6S8+Tg66eY56DBk85aQzzUJDtpoXFBgELMd5P/SotAguo+1kYO6RuYgXxA4HJH3LFTFPASX6ET6bjfriw==

lodash.sortby@^4.7.0:
version "4.7.0"
resolved "https://registry.npmmirror.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==

lodash.template@^4.5.0:
version "4.5.0"
resolved "https://registry.npmmirror.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab"
Expand All @@ -5428,6 +5458,16 @@ lodash.templatesettings@^4.0.0:
dependencies:
lodash._reinterpolate "^3.0.0"

lodash.trimend@^4.5.1:
version "4.5.1"
resolved "https://registry.npmmirror.com/lodash.trimend/-/lodash.trimend-4.5.1.tgz#12804437286b98cad8996b79414e11300114082f"
integrity sha512-lsD+k73XztDsMBKPKvzHXRKFNMohTjoTKIIo4ADLn5dA65LZ1BqlAvSXhR2rPEC3BgAUQnzMnorqDtqn2z4IHA==

lodash.trimstart@^4.5.1:
version "4.5.1"
resolved "https://registry.npmmirror.com/lodash.trimstart/-/lodash.trimstart-4.5.1.tgz#8ff4dec532d82486af59573c39445914e944a7f1"
integrity sha512-b/+D6La8tU76L/61/aN0jULWHkT0EeJCmVstPBn/K9MtD2qBW83AsBNrr63dKuWYwVMO7ucv13QNO/Ek/2RKaQ==

lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.npmmirror.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
Expand Down Expand Up @@ -7004,6 +7044,11 @@ [email protected]:
resolved "https://registry.npmmirror.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
integrity sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==

[email protected]:
version "0.3.0"
resolved "https://registry.npmmirror.com/remove-markdown/-/remove-markdown-0.3.0.tgz#5e4b667493a93579728f3d52ecc1db9ca505dc98"
integrity sha512-5392eIuy1mhjM74739VunOlsOYKjsH82rQcTBlJ1bkICVC3dQ3ksQzTHh4jGHQFnM+1xzLzcFOMH+BofqXhroQ==

remove-trailing-separator@^1.0.1:
version "1.1.0"
resolved "https://registry.npmmirror.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef"
Expand Down Expand Up @@ -7394,6 +7439,16 @@ simple-swizzle@^0.2.2:
dependencies:
is-arrayish "^0.3.1"

sitemap@^3.0.0:
version "3.2.2"
resolved "https://registry.npmmirror.com/sitemap/-/sitemap-3.2.2.tgz#3f77c358fa97b555c879e457098e39910095c62b"
integrity sha512-TModL/WU4m2q/mQcrDgNANn0P4LwprM9MMvG4hu5zP4c6IIKs2YLTu6nXXnNr8ODW/WFtxKggiJ1EGn2W0GNmg==
dependencies:
lodash.chunk "^4.2.0"
lodash.padstart "^4.6.1"
whatwg-url "^7.0.0"
xmlbuilder "^13.0.0"

slash@^1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
Expand Down Expand Up @@ -7746,6 +7801,11 @@ strip-json-comments@~2.0.1:
resolved "https://registry.npmmirror.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==

[email protected]:
version "3.1.1"
resolved "https://registry.npmmirror.com/striptags/-/striptags-3.1.1.tgz#c8c3e7fdd6fb4bb3a32a3b752e5b5e3e38093ebd"
integrity sha512-3HVl+cOkJOlNUDAYdoCAfGx/fzUzG53YvJAl3RYlTvAcBdPqSp1Uv4wrmHymm7oEypTijSQqcqplW8cz0/r/YA==

stylehacks@^4.0.0:
version "4.0.3"
resolved "https://registry.npmmirror.com/stylehacks/-/stylehacks-4.0.3.tgz#6718fcaf4d1e07d8a1318690881e8d96726a71d5"
Expand Down Expand Up @@ -7972,6 +8032,13 @@ tough-cookie@~2.5.0:
psl "^1.1.28"
punycode "^2.1.1"

tr46@^1.0.1:
version "1.0.1"
resolved "https://registry.npmmirror.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09"
integrity sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==
dependencies:
punycode "^2.1.0"

[email protected]:
version "0.0.0"
resolved "https://registry.npmmirror.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
Expand Down Expand Up @@ -8417,6 +8484,19 @@ vuepress-html-webpack-plugin@^3.2.0:
toposort "^1.0.0"
util.promisify "1.0.0"

vuepress-plugin-autometa@^0.1.13:
version "0.1.13"
resolved "https://registry.npmmirror.com/vuepress-plugin-autometa/-/vuepress-plugin-autometa-0.1.13.tgz#44a63e9fefb4feff88c00678d4d2b3d8e413209d"
integrity sha512-yhd8smLhbCO0+gc3FRNjOyffdGl12gUkv60UqdtEUCojEy4s7APDJ2pt85cSLASMdnWaY7EcMibMRkqeUOVAKg==
dependencies:
lodash.defaultsdeep "4.6.1"
lodash.findindex "4.6.0"
lodash.isempty "4.4.0"
lodash.trimend "^4.5.1"
lodash.trimstart "^4.5.1"
remove-markdown "0.3.0"
striptags "3.1.1"

vuepress-plugin-container@^2.0.2:
version "2.1.5"
resolved "https://registry.npmmirror.com/vuepress-plugin-container/-/vuepress-plugin-container-2.1.5.tgz#37fff05662fedbd63ffd3a5463b2592c7a7f3133"
Expand All @@ -8425,6 +8505,13 @@ vuepress-plugin-container@^2.0.2:
"@vuepress/shared-utils" "^1.2.0"
markdown-it-container "^2.0.0"

vuepress-plugin-sitemap@^2.3.1:
version "2.3.1"
resolved "https://registry.npmmirror.com/vuepress-plugin-sitemap/-/vuepress-plugin-sitemap-2.3.1.tgz#51298aca77a5de96396fdbd1103e1637dd61ae6a"
integrity sha512-n+8lbukhrKrsI9H/EX0EBgkE1pn85LAQFvQ5dIvrZP4Kz6JxPOPPNTQmZMhahQV1tXbLZQCEN7A1WZH4x+arJQ==
dependencies:
sitemap "^3.0.0"

vuepress-plugin-smooth-scroll@^0.0.3:
version "0.0.3"
resolved "https://registry.npmmirror.com/vuepress-plugin-smooth-scroll/-/vuepress-plugin-smooth-scroll-0.0.3.tgz#6eff2d4c186cca917cc9f7df2b0af7de7c8c6438"
Expand Down Expand Up @@ -8470,6 +8557,11 @@ wbuf@^1.1.0, wbuf@^1.7.3:
dependencies:
minimalistic-assert "^1.0.0"

webidl-conversions@^4.0.2:
version "4.0.2"
resolved "https://registry.npmmirror.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==

webpack-chain@^4.9.0:
version "4.12.1"
resolved "https://registry.npmmirror.com/webpack-chain/-/webpack-chain-4.12.1.tgz#6c8439bbb2ab550952d60e1ea9319141906c02a6"
Expand Down Expand Up @@ -8616,6 +8708,15 @@ websocket-extensions@>=0.1.1:
resolved "https://registry.npmmirror.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42"
integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==

whatwg-url@^7.0.0:
version "7.1.0"
resolved "https://registry.npmmirror.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06"
integrity sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==
dependencies:
lodash.sortby "^4.7.0"
tr46 "^1.0.1"
webidl-conversions "^4.0.2"

when@~3.6.x:
version "3.6.4"
resolved "https://registry.npmmirror.com/when/-/when-3.6.4.tgz#473b517ec159e2b85005497a13983f095412e34e"
Expand Down Expand Up @@ -8705,6 +8806,11 @@ xdg-basedir@^4.0.0:
resolved "https://registry.npmmirror.com/xdg-basedir/-/xdg-basedir-4.0.0.tgz#4bc8d9984403696225ef83a1573cbbcb4e79db13"
integrity sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==

xmlbuilder@^13.0.0:
version "13.0.2"
resolved "https://registry.npmmirror.com/xmlbuilder/-/xmlbuilder-13.0.2.tgz#02ae33614b6a047d1c32b5389c1fdacb2bce47a7"
integrity sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ==

xtend@^4.0.0, xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.npmmirror.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
Expand Down

0 comments on commit adf64ef

Please sign in to comment.