BookStack & mindoc 部署 - 文档管理系统 开源软件


https://github.com/TruthHun/BookStack

https://github.com/truthhun/BookChat

https://github.com/truthhun/BookChatApp

https://hub.docker.com/r/willdockerhub/bookstack

https://github.com/willzhang/docker-bookstackcn

https://www.github.com/willzhang/docker-images

https://github.com/easy-docker/mindoc

https://hub.docker.com/r/ghostry/mindoc


docker run -d  --name bookstack  --hostname bookstack --restart=always  --privileged=true --user=root  -e TZ='Asia/Shanghai'   --ulimit nofile=262144:262144   --network mgr  --ip 172.18.0.181   -v /data/site/eduboo.www/conf:/bookstack/conf:ro  -v /data/site/eduboo.www/static:/bookstack/static:ro -v  /data/site/eduboo.www/views:/bookstack/views:ro  -v /data/site/eduboo.www/uploads:/bookstack/uploads  -v /data/site/eduboo.www/store:/bookstack/store  -v /data/site/eduboo.www/version_control:/bookstack/version_control  -v /data/site/eduboo.www/logs:/bookstack/logs  hub.htmltoo.com:5000/http:bookstack-7.20.0


docker run -d  --name bookstack  --hostname bookstack   --restart=always  --privileged=true --user=root  -e TZ='Asia/Shanghai'   --ulimit nofile=262144:262144  --network mgr  --ip 172.18.0.181  -v /data/site/eduboo.www/conf:/bookstack/conf:ro  -v /data/site/eduboo.www/static:/bookstack/static:ro -v  /data/site/eduboo.www/views:/bookstack/views:ro  -v /data/site/eduboo.www/uploads:/bookstack/uploads  -v /data/site/eduboo.www/store:/bookstack/store  -v /data/site/eduboo.www/version_control:/bookstack/version_control  -v /data/site/eduboo.www/logs:/bookstack/logs    willdockerhub/bookstack:v2.10_node


-

-p 8181:8181


docker exec -it bookstack /bin/bash

docker logs -f --tail="30" bookstack 

apt-get update -y

apt-get install -y wget vim net-tools curl git cron  iproute2

apt-get dist-upgrade -y

apt-get upgrade -y

apt-get autoremove

apt-get update -y -qqy

apt-get install -y ttf-wqy-zenhei fonts-wqy-microhei

apt-get install -y wget unzip git python xdg-utils xz-utils imagemagick

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime


wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub |  apt-key add


---升级12

-异常

init-system-helpers  

-升级

usrmerge

sed -i 's/bookworm-security/bullseye-security/g' /etc/apt/sources.list  

sed -i 's/bookworm/bullseye/g' /etc/apt/sources.list


Dockerfile:

FROM buildkite/puppeteer:7.1.0
ENV BOOKSTACK_VERSION=2.9 \
   .UTF-8 \
    QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox"
WORKDIR /bookstack
RUN apt-get update -y \
    && apt-get install -y tzdata git \
    && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && apt-get install -y ttf-wqy-zenhei fonts-wqy-microhei \
    && apt-get install -y python3 unzip xz-utils \
    && wget -qO /usr/local/bin/envsubst https://github.com/a8m/envsubst/releases/download/v1.2.0/envsubst-Linux-x86_64 \    
    && chmod +x /usr/local/bin/envsubst \
    && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sh /dev/stdin \
    && wget https://github.com/TruthHun/BookStack/releases/download/v${BOOKSTACK_VERSION}/BookStack.V${BOOKSTACK_VERSION}_Linux_amd64.zip \
    && unzip BookStack.V${BOOKSTACK_VERSION}_Linux_amd64.zip \
    && chmod +x BookStack \
    && rm -rf BookStack.V${BOOKSTACK_VERSION}_Linux_amd64.zip \
    && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
COPY conf/ /tmp/conf
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 8181
CMD ["/bookstack/BookStack"]

conf/app.conf

# 程序名称
appname = eduboo
# 内容采集转发。如: https://http-transfer.abc.com
# 需要部署`http-transfer`服务:https://github.com/TruthHun/http-transfer
http_transfer =
# 微信小程序 appid
appId=""
# 微信小程序appSecret
appSecret=""
# 是否限制API请求,也就是如果不是上述配置的微信小程序的appId请求的接口,则直接拒绝
limitReferer=false
# API 路由前缀,默认为 bookchat。API访问形式:https://您的域名/bookchat/api/v1/xxx
# 比如您把api前缀改为了 hello,则您在 BookChat 或者 BookChatApp 中,需要把 config.js 中的 host 常量配置为 https://您的域名/hello
apiPrefix=eduboo
# 是否显示小程序阅读码(需要配置了appScecret才会生效)
showWechatCode = false
# 比如你将static目录下的所有静态资源都放到了专门的服务器上,那么这个域名就行用来访问你的静态资源的域名。否则建议填写web网站的域名
# 如果您部署了微信小程序,则该值一定要填写
static_domain=
# 监听端口
httpport = 8181
# 运行模式。开发时,请设置为开发模式"dev",即development;部署时,请设置为产品模式"prod",即product。dev模式下,会打印各种调试信息
runmode = dev
# 是否开启session,这个必须开启,否则没法玩了。
sessionon = true
# session名称,这个你自己定。
sessionname = eduboo
copyrequestbody = true
# 启动gzip压缩,则设置为true,否则设置为false。建议启动
EnableGzip=true
# 要压缩的静态文件扩展名,其中.xml是sitemap站点地图压缩。建议按照这个来就行了
StaticExtensionsToGzip = .css, .js, .xml
#站点地图host(主要用于使用CDN的时候,host与实际host不一样,导致生成的sitemap不一样)
sitemap_host=www.eduboo.com
# 默认Session生成Key的秘钥
beegoserversessionkey=eduboo
########Session储存方式##############
#以文件方式储存
sessionprovider=file
sessionproviderconfig=store/session
# 静态目录。这个是站点地图的静态目录
StaticDir = sitemap:sitemap
# 站点可直接访问的静态文件【注意,这里千万不能配置.conf文件扩展名,否则会把.conf文件当做静态文件而被外部访问,导致数据库账号密码等泄露。按照默认的来即可】
StaticExt=.txt,.xml,.ico,.png,.jpg,.jpeg,.gif,.html
#评论时间间隔,每次发表评论,限定间隔秒数,避免被恶意刷评论
CommentInterval=10
# 生成下载文档时导出pdf文档的配置,这里建议把关于bookstack.cn的信息替换成你自己的就行,其他的建议不要动
exportHeader=<p style='color:#8E8E8E;font-size:12px;'>_SECTION_</p>
exportFooter=<p style='color:#8E8E8E;font-size:12px;'>Source: <a href='http://www.eduboo.com/' style='text-decoration:none;color:#1abc9c;font-weight:bold;' target=_blank>EduBoo.COM</a> <span style='float:right'>- _PAGENUM_ -</span></p>
exportFontSize=13
exportPaperSize=a4
exportCreator=学习吧(EduBoo.COM)
exportMarginLeft=36
exportMarginRight=36
exportMarginTop=36
exportMarginBottom=36
# 是否使用自定义的电子书封面,如果使用,则需要安装并启用puppeteer,否则不生效
exportCustomCover=true
####################MySQL 数据库配置###########################
db_adapter=mysql
# 您的数据库host
db_host=mariadb
#您的数据库端口
db_port=3306
#您的数据库用户名
db_username=root
# 您的数据库密码
db_password=wdqdmm@r
# utf8或者utf8mb4数据库。如果数据库还没创建,并且账号有创建权限,将自动创建。
db_database=dbeduboo
# 谷歌浏览器,用于发布内容的时候渲染未被渲染的markdown。建议安装最新版的Chrome浏览器,并把Chrome浏览器加入系统环境变量。
# 使用Chrome的headless去处理。之前考虑使用phantomjs的,但是phantomjs有些小问题,不如Chrome强大。
# chrome=chromium-browser
chrome=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
# 如果使用 puppeteer,则忽略chrome
puppeteer = false
#书籍默认封面
cover=/static/images/book.png
#默认头像
avatar=/static/images/avatar.png
#默认阅读令牌长度
token_size=12
#上传文件的后缀
upload_file_ext=txt|doc|docx|xls|xlsx|ppt|pptx|pdf|7z|rar|jpg|jpeg|png|gif
####################邮件配置######################
#是否启用邮件
enable_mail=true
#每小时限制指定邮箱邮件发送次数
mail_number=5
#smtp服务用户名
smtp_user_name=
#smtp服务器地址
smtp_host=
#smtp密码
smtp_password=
#端口号
smtp_port=25
#发送邮件的显示名称
form_user_name=
#接收回件的邮箱。留空则表示使用发送邮件的邮箱作为接收回件邮箱
reply_user_name=ihunter@vip.qq.com
#邮件有效期30分钟
mail_expired=30
# 存储类型,后续扩展成本地存储(local)、阿里云OSS存储(oss)、七牛云存储(qiniu)、腾讯云存储(cos)、百度云存储(bos)和又拍云存储(upyun)
# 目前可选项:local、oss
store_type=local
# 不要修改
include "oss.conf"
include "oauth.conf"

build_node.sh:

#!/bin/bash
BOOKSTACK_VERSION=v2.9
docker build -t willdockerhub/bookstack:${BOOKSTACK_VERSION}_node -f Dockerfile.node .

entrypoint.sh:

#!/bin/bash
# generate conf
config_files=(app.conf oauth.conf oss.conf)
for file in ${config_files[*]}
do
  if [ ! -f "/bookstack/conf/$file" ]; then
    envsubst < /tmp/conf/${file}.example > /bookstack/conf/${file}
  fi
done
/bookstack/BookStack install
exec "$@"


bookstack:

FROM ubuntu
ENV CALIBRE_URL=https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py \
    BOOKSTACK_VER=v2.3 \
    BOOKSTACK_PKG=BookStack.V2.3_Linux_amd64.zip

RUN apt-get update -y
RUN apt-get install -y wget vim net-tools curl git cron axel zip unzip iproute2  
RUN apt-get install -y libpcre3 libpcre3-dev openssl libssl-dev zlib1g-dev cmake golang python build-essential autoconf automake libtool
RUN apt-get dist-upgrade -y
RUN apt-get upgrade -y
RUN apt-get autoremove
  
RUN apt-get update -qqy \
  && apt-get install -y ttf-wqy-zenhei fonts-wqy-microhei \
  && apt-get install -y wget unzip git python xdg-utils xz-utils imagemagick \
  ###install calibre
  && wget -nv -O- ${CALIBRE_URL} | python -c "import sys; main=lambda:sys.stderr.write('Download failed\n'); exec(sys.stdin.read()); main()";exit 0 \
  && rm -rf /tmp/calibre-installer-cache \
  ###install google-chrome
  && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
  && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
  && apt-get install -y google-chrome-stable \
  && rm -rf /etc/apt/sources.list.d/google-chrome.list \
  ###install bookstack
  && mkdir /opt/bookstack/ \
  && cd /opt/bookstack/ \
  && wget https://github.com/TruthHun/BookStack/releases/download/${BOOKSTACK_VER}/${BOOKSTACK_PKG} \
  && unzip ${BOOKSTACK_PKG} \
  && chmod +x linux \
  && cd linux  && ls | grep -v conf | xargs -I {} mv {} /opt/bookstack/ \
  && cd ../  && ls | grep -v conf | xargs -I {} chmod -R 777 {} && rm -rf ${BOOKSTACK_PKG} linux \
  && rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
  && apt-get clean
  
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
WORKDIR /opt/bookstack/
EXPOSE 8181
ENTRYPOINT [ "/entrypoint.sh" ]

entrypoint.sh

#!/bin/bash
if [ ! -f /opt/bookstack/dbupdated ]
then
  /opt/bookstack/BookStack install 2>&1 | tee /opt/bookstack/dbupdated
else
  echo "###db had updated,skip bookstack install,just start it!###"
fi
/opt/bookstack/BookStack



docker commit -m="update" -a="htmltoo.com" bookstack  hub.htmltoo.com:5000/http:bookstack-7.20.0

docker push hub.htmltoo.com:5000/http:bookstack-7.20.0


docker save  hub.htmltoo.com:5000/http:bookstack-7.20.0 | gzip > /data/site/htmltoo.f/htmltoo.up/soft/docker.tar/http-bookstack-7.20.0.tar.gz

-

# load - 镜像解压

docker load < /opt/http-bookstack-7.20.0.tar.gz



cd  /data/docker/tools/Dockerfile/bookstack

docker build -t bookstack .

docker tag bookstack:latest hub.htmltoo.com:5000/http:bookstack-20200101

docker push hub.htmltoo.com:5000/http:bookstack-20200101


访问bookstack

默认管理员账号和密码为 admin/admin888

http://ip:8181


# envsubst

https://github.com/a8m/envsubst/releases/

wget -qO /usr/local/bin/envsubst  https://github.com/a8m/envsubst/releases/download/v1.4.2/envsubst-Linux-x86_64

chmod +x /usr/local/bin/envsubst

-envsubst 的版本号。

envsubst -V


# calibre

https://github.com/kovidgoyal/calibre/releases

cd  /opt/calibre

mkdir -p /usr/share/desktop-directories/

wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sh /dev/stdin version=7.20.0

calibre

calibre-uninstall

-版本

ebook-convert --version

-

apt-get install -y   libegl1 libopengl0  libxcb-cursor0

apt-get install -y  calibre

apt remove calibre


# calibre-web

https://github.com/janeczku/calibre-web

apt install python3  python3-pip  python3-venv

git clone   https://github.com/janeczku/calibre-web

cd calibre-web

./venv/bin/python3 -m pip install --upgrade pip

python3 -m venv venv

./venv/bin/python3 -m pip install -r requirements.txt --use-pep517

nohup ./venv/bin/python3 cps.py


mindoc:

docker pull ghostry/mindoc:latest
mkdir -p /data/mindoc
chmod 777 /data/mindoc -R
docker container stop mindoc && docker container rm mindoc && \
docker run --name=mindoc --restart=always \
-v /data/mindoc:/mindocdata \
-p 8181:8181 \
-d ghostry/mindoc:latest

默认程序会自动初始化一个超级管理员用户:admin 密码:123456 。请登录后重新设置密码。


BookChatApp:

二次开发基本步骤

  1. 安装部署BookStack
  2. 克隆下载BookChatApp源码
  3. 使用HBuilderX打开项目文件夹
  4. 将下载程序中的config.example.js文件重命名为config.js文件
  5. 根据自己的开发环境,设置host配置项

如果是在开发环境,请把debug设置为true,编译生成生产程序的时候,把debug设置为false

程序页面

  •  目录页 /pages/menu/menu
  •  书籍阅读页 /pages/read/read
  •  用户中心页 /pages/ucenter/ucenter
  •  首页 /pages/index/index
  •  分类页 /pages/cate/cate
  •  书架页 /pages/bookshelf/bookshelf
  •  列表页 /pages/list/list
  •  个人主页 /pages/me/me
  •  书签页 /pages/bookmarks/bookmarks
  •  搜索结果页 /pages/search/search
  •  内容点评页 /pages/comment/comment
  •  404页 /pages/notfound/notfound
  •  登录页 /pages/login/login
  •  注册页 /pages/register/register
  •  书籍介绍页 /pages/intro/intro


BookStack 开源地址

配套手机APP BookChatApp 开源地址

配套微信小程序 BookChat 开源地址


签名:这个人很懒,什么也没有留下!
最新回复 (0)
返回