Date : 2021.02.03
Author: jwensh
关键词: gitbook webhook jenkins nginx wiki
cnpm install -g gitbook-cli && cnpm install -g gitbook-summary
gitbook init
warn: no summary file in this book
info: create README.md
info: create SUMMARY.md
info: initialization is finished
在gitlab对应项目上,设置webhook
,填写对应jenkins的hook地址和token:为了git push
触发更新
在jenkins中的shell中设置gitbook
的shell操作步骤
使用gitbook-summary
插件生成SUMMARY.md
文件
文件增量更新示例: rsync -vaci --delete --delete-after --exclude=patten origin dist
jenkins的shell
BUILD_ID=DONTKILLME
S=`pwd`
gitbook install
book sm
gitbook build
rsync -vaci --delete --delete-after $S/_book /data/wiki/
jenkins job build后会将markdown文档转为html文件
nginx.conf
文件server {
listen 80;
server_name wiki.***.***;
...省略
location / {
alias /usr/share/nginx/html/wiki/;
index index.html index.htm;
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
nginxgateway:
container_name: nginxgateway
restart: always
image: nginx:1.15
privileged: true
volumes:
- ./common/config/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./common/config/nginx/nginxgateway.conf:/etc/nginx/conf.d/default.conf
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
- /data/wiki/_book:/usr/share/nginx/html/wiki
ports:
- 80:80
- 443:443
dns:
- 8.8.8.8
typora
或vs code
来编辑这个工程{
"title" : "zYue wiki",
"author" : "Jwensh",
"description": "zYue,一个自定义知识wiki,是成长的记录",
"language" : "zh-hans",
"root": ".",
"links": {
"sidebar": {
}
},
"style": {
"website": "styles/website.css",
"ebook": "styles/ebook.css",
"pdf": "styles/pdf.css",
"mobi": "styles/mobi.css",
"epub": "styles/epub.css"
},
"plugins": [
"-search",
"-sharing",
"-lunr",
"-highlight",
"search-pro",
"insert-logo",
"back-to-top-button",
"chapter-fold",
"expandable-chapters",
"splitter",
"lightbox",
"favicon",
"hide-element",
"pageview-count",
"signature",
"page-toc-button",
"simple-page-toc",
"emphasize",
"prism",
"flexible-alerts",
"code",
"theme-hqbook",
"expandable-chapters-samll",
"tbfed-pagefooter",
"page-treeview",
"anchor-navigation-ex",
"page-toc-button",
"ancre-navigation"
],
"pluginsConfig": {
"tbfed-pagefooter": {
"copyright": "Copyright & jwensh 2021",
"modify_label": "该文件修订时间:",
"modify_format": "YYYY-MM-DD HH:mm:ss"
},
"anchor-navigation-ex": {
"showLevel": false,
"showGoTop": false
},
"page-toc-button": {
"maxTocDepth": 2,
"minTocSize": 2
},
"hide-element": {
"elements": [".gitbook-link", ".copyright"]
},
"insert-logo": {
"url": "x***",
"style": "background: none; max-height: 38px; min-height: 38px"
},
"gitbook-plugin-signature":{
"autoTimeStamp":{
"color":"gray",
"timeStampFormat": "YYYY/MM/DD HH:mm:ss"
},
"autoCopyright":{
"color":"gray",
"owner":"Jwensh",
"center":true
},
"signature":{
"key": "Jwensh wiki"
}
},
"simple-page-toc": {
"maxDepth": 5,
"skipFirstH1": true
},
"prism": {
"css": [
"prismjs/themes/prism-solarizedlight.css"
]
},
"flexible-alerts": {
"style": "flat"
},
"code": {
"copyButtons": false
},
"theme-hqbook":{
"favicon": "./favicon.ico",
"logo":"./logo.png",
"search-placeholder":"输入关键字搜索",
"copyButtons": true,
"copyLines": true,
"dragSplitter": true,
"hide-elements": [
".summary .gitbook-link"
],
"flexible-linkcard": {
"title": "flexible-linkcard",
"hrefUrl": "https://github.com/HaoqiangChen/gitbook-plugin-flexible-linkcard",
"target": "_blank",
"imgSrc": "./book/logo.png",
"imgClass": "rect"
}
}
}
}