ShowDoc
官網
GitHub
https://github.com/star7th/showdoc
幫助說明
https://www.showdoc.cc/help?page_id=1385767280275683
ShowDoc 是什麼?
每當接手一個他人開發好的模塊或者項目,看着那些沒有寫註釋的代碼,我們都無比抓狂。文檔呢?!文檔呢?!Show me the doc !!
程序員都很希望別人能寫技術文檔,而自己卻很不希望要寫文檔。因爲寫文檔需要花大量的時間去處理格式排版,想着新建的word文檔放在哪個目錄等各種非技術細節。
word文檔零零散散地放在團隊不同人那裏,需要文檔的人基本靠吼,吼一聲然後上qq或者郵箱接收對方丟過來的文檔。這種溝通方式當然可以,只是效率不高。
ShowDoc就是一個非常適合IT團隊的在線文檔分享工具,它可以加快團隊之間溝通的效率。
它都有些什麼功能?
分享與導出
響應式網頁設計,可將項目文檔分享到電腦或移動設備查看。同時也可以將項目導出成word文件,以便離線瀏覽。
權限管理
公開項目與私密項目
ShowDoc上的項目有公開項目和私密項目兩種。公開項目可供任何登錄與非登錄的用戶訪問,而私密項目則需要輸入密碼驗證訪問。密碼由項目創建者設置。
項目轉讓
項目創建者可以自由地把項目轉讓給網站的其他用戶。
項目成員
你可以很方便地爲ShowDoc的項目添加、刪除項目成員。項目成員可以對項目進行編輯,但不可轉讓或刪除項目(只有項目創建者纔有權限)
團隊管理
利用showdoc的團隊功能你可以更好地進行團隊協作
編輯功能
markdown編輯
ShowDoc採用markdown編輯器,無論是編輯還是閱讀體驗都極佳很棒。如果你不瞭解Markdown,請在搜索引擎搜索”認識與入門 Markdown”
模板插入
在ShowDoc的編輯頁面,點擊編輯器上方的按鈕可方便地插入API接口模板和數據字典模板。插入模板後,剩下的就是改動數據了,省去了很多編輯的力氣。
歷史版本
ShowDoc爲頁面提供歷史版本功能,你可以方便地把頁面恢復到之前的版本。
部署到自己的服務器
ShowDoc部署手冊請參考:https://www.showdoc.cc/help?page_id=13732
開源地址:https://github.com/star7th/showdoc 。若覺得showdoc好用,不妨點個star。良好的關注度和參與度有助於開源項目的長遠發展。
二次開發指引
https://www.showdoc.cc/help?page_id=1385576954326448
自動腳本安裝
#下載
sudo wget https://www.showdoc.cc/script/showdoc
# 增加執行權限
sudo chmod +x showdoc
# 安裝軟件
sudo apt install curl
#默認安裝中文版。如果想安裝英文版,請加上 en 參數,如 ./showdoc en
./showdoc
# showdoc 腳本
#!/bin/bash
if [[ -n "$1" ]] ; then
action=$1
else
action='install'
fi
if [ "$action" == "start" ] ;then
sudo -s service docker start
sudo -s docker start showdoc
exit 1
fi
if [ "$action" == "restart" ] ;then
sudo -s docker restart showdoc
exit 1
fi
if [ "$action" == "stop" ] ;then
sudo -s docker stop showdoc
exit 1
fi
if [ "$action" == "update" ] ;then
DATE=$(date +%Y%m%d_%H%M%S_%N)
if [ ! -d "/showdoc_data/html" ]; then
echo "Directory /showdoc_data/html does not exist"
echo "/showdoc_data/html 目錄不存在"
exit 1 ;
fi
rm -f master.tar.gz
wget https://github.com/star7th/showdoc/archive/master.tar.gz
if [ ! -f "master.tar.gz" ]; then
echo "Download file fail"
echo "文件下載失敗"
exit 1
fi
sudo -s docker stop showdoc
sudo -s chmod -R 777 /showdoc_data/
sudo -s mv /showdoc_data/html /showdoc_data/html_bak_${DATE}
tar -zxvf master.tar.gz -C /showdoc_data/
sudo -s mv /showdoc_data/showdoc-master /showdoc_data/html ##// */
if [ ! -d "/showdoc_data/html" ]; then
echo "Directory /showdoc_data/html does not exist"
echo "/showdoc_data/html 目錄不存在"
exit 1 ;
fi
sudo -s chmod -R 777 /showdoc_data/html
sudo -s docker start showdoc
sleep 10
result=$(tail /showdoc_data/html_bak_${DATE}/web/index.html | grep zh)
if [ ! -z "$result" ] ; then
curl http://localhost:4999/install/non_interactive.php?lang=zh
else
curl http://localhost:4999/install/non_interactive.php?lang=en
fi
\cp -f /showdoc_data/html_bak_${DATE}/Sqlite/showdoc.db.php /showdoc_data/html/Sqlite/showdoc.db.php
\cp -r -f /showdoc_data/html_bak_${DATE}/Public/Uploads /showdoc_data/html/Public/
sudo -s curl http://localhost:4999?s=/home/update/db
rm -f master.tar.gz
exit 1
fi
if [ "$action" == "uninstall" ] ;then
echo -e " Showdoc is about to be uninstalled. Are you sure to delete all showdoc data? [Y/n] \n 即將卸載showdoc,你是否確認刪除showdoc所有數據? [Y/n] "
read -r -p '' input
case $input in
[yY][eE][sS]|[yY])
sudo -s docker stop showdoc
sudo -s docker rm showdoc
echo "uninstalling..."
echo "正在卸載..."
sudo -s docker rmi xd2idwf5.mirror.aliyuncs.com/star7th/showdoc
sudo -s docker rmi registry.docker-cn.com/star7th/showdoc
sudo -s docker rmi registry.cn-shenzhen.aliyuncs.com/star7th/showdoc
sudo -s docker rmi star7th/showdoc
sudo -s rm -rf /showdoc_data
echo "Done"
echo "完成"
;;
[nN][oO]|[nN])
;;
*)
exit 1
;;
esac
exit 1
fi
if ! [ -x "$(command -v docker)" ]; then
echo 'It was detected that Docker was not installed. Attempting to install from the network... The time required is related to your network environment.'
echo '檢測到Docker尚未安裝。正在試圖從網絡安裝...所需時間與你的網絡環境有關'
sudo -s curl -sSL https://get.daocloud.io/docker | sh
sudo -s chkconfig docker on
fi
if ! [ -x "$(command -v docker)" ]; then
echo 'It was detected that Docker was not installed. Attempting to install from the network... The time required is related to your network environment.'
echo '檢測到Docker尚未安裝。正在試圖從網絡安裝...所需時間與你的網絡環境有關'
sudo -s curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -
sudo -s chkconfig docker on
fi
if ! [ -x "$(command -v docker)" ]; then
echo 'Docker failed to install automatically. It is recommended that you install the docker environment manually before starting this script.'
echo 'Docker自動安裝失敗,建議你手動安裝好docker環境後再啓動本腳本'
exit 1
fi
if [ "$(docker images |grep showdoc)" ]; then
echo ""
echo "You have installed showdoc image"
echo "If you want to update showdoc, please execute ./showdoc update "
echo "If you want to restart showdoc, please execute ./showdoc restart "
echo "If you want to uninstall showdoc, please execute ./showdoc uninstall "
echo ""
echo "你已經安裝過showdoc鏡像"
echo "如果你想更新showdoc,請執行 ./showdoc update "
echo "如果你想重啓showdoc,請執行 ./showdoc restart "
echo "如果你想卸載showdoc,請執行 ./showdoc uninstall "
exit 1
fi
sudo -s service docker start
echo 'The showdoc image is being retrieved, please wait a moment... The time required is related to your network environment.'
echo '正在拉取showdoc鏡像,請稍後...所需時間與你的網絡環境有關'
if [ "$action" == "en" ] ;then
sudo -s docker pull star7th/showdoc
else
sudo -s docker pull registry.cn-shenzhen.aliyuncs.com/star7th/showdoc
sudo -s docker tag registry.cn-shenzhen.aliyuncs.com/star7th/showdoc:latest star7th/showdoc:latest
fi
sudo -s mkdir /showdoc_data
if [ ! -d "/showdoc_data" ]; then
echo "/showdoc_data directory does not exist. Make sure you have create permissions"
echo "/showdoc_data 目錄不存在,請確保有創建權限"
exit 1 ;
fi
sudo -s mkdir /showdoc_data/html
sudo -s chmod -R 777 /showdoc_data
sudo -s docker run -d --name showdoc -p 4999:80 -v /showdoc_data/html:/var/www/html/ star7th/showdoc
sleep 10
if [ "$action" == "en" ] ;then
sudo -s curl http://localhost:4999/install/non_interactive.php?lang=en
else
sudo -s curl http://localhost:4999/install/non_interactive.php?lang=zh
fi
sudo -s wget http://localhost:4999/install/install.lock
if [ -f "install.lock" ]; then
rm -rf install.lock
if [ "$action" == "en" ] ;then
echo -e "\n \033[32m Successful installation , The address is:http://localhost:4999 (You can also use LAN or public IP / domain name access) \033[0m \n"
echo -e " \033[32m The account password is showdoc/123456 , After you log in, you can see the admin buttun at the top right.Suggested password modification after login \033[0m \n"
echo -e " \033[32m For questions or suggestions on showdoc, please go to https://github.com/star7th/showdoc \033[0m \n"
else
echo -e "\n \033[32m 安裝成功,訪問地址:http://localhost:4999 (你也可以用局域網或者公網IP/域名訪問) \033[0m \n"
echo -e " \033[32m 賬戶密碼是showdoc/123456,登錄後你便可以看到右上方的管理後臺入口。建議登錄後修改密碼。 \033[0m \n"
echo -e " \033[32m 對showdoc的問題或建議請至https://github.com/star7th/showdoc 提issue \033[0m \n"
echo -e " \033[32m 若覺得showdoc好用,不妨到github點個star。良好的關注度和參與度有助於開源項目的長遠發展 \033[0m \n"
fi
fi
# Ubuntu-18 未成功
# CentOS-7.4
It was detected that Docker was not installed. Attempting to install from the network... The time required is related to your network environment.
檢測到Docker尚未安裝。正在試圖從網絡安裝...所需時間與你的網絡環境有關
# Executing docker install script, commit: f45d7c11389849ff46a6b4d94e0dd1ffebca32c1
+ sh -c 'yum install -y -q yum-utils'
軟件包 yum-utils-1.1.31-52.el7.noarch 已安裝並且是最新版本
+ sh -c 'yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo'
已加載插件:fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
+ '[' stable '!=' stable ']'
+ sh -c 'yum makecache'
已加載插件:fastestmirror
Loading mirror speeds from cached hostfile
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
epel | 5.4 kB 00:00:00
extras | 2.9 kB 00:00:00
gitlab-ce | 2.9 kB 00:00:00
gitlab_gitlab-ce/x86_64/signature | 836 B 00:00:00
gitlab_gitlab-ce/x86_64/signature | 1.0 kB 00:00:00 !!!
gitlab_gitlab-ce-source/signature | 836 B 00:00:00
gitlab_gitlab-ce-source/signature | 951 B 00:00:00 !!!
mysql-connectors-community | 2.5 kB 00:00:00
mysql-tools-community | 2.5 kB 00:00:00
mysql57-community | 2.5 kB 00:00:00
nginx-stable | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/11): docker-ce-stable/x86_64/updateinfo | 55 B 00:00:00
(2/11): docker-ce-stable/x86_64/primary_db | 37 kB 00:00:00
(3/11): epel/x86_64/prestodelta | 2.6 kB 00:00:00
(4/11): epel/x86_64/other_db | 3.3 MB 00:00:00
(5/11): epel/x86_64/updateinfo_zck | 1.5 MB 00:00:00
(6/11): epel/x86_64/filelists_db | 12 MB 00:00:00
(7/11): updates/7/x86_64/filelists_db | 4.0 MB 00:00:00
(8/11): docker-ce-stable/x86_64/other_db | 111 kB 00:00:00
(9/11): updates/7/x86_64/other_db | 481 kB 00:00:00
(10/11): docker-ce-stable/x86_64/filelists_db | 18 kB 00:00:04
(11/11): gitlab-ce/7/filelists_db | 281 MB 00:00:26
元數據緩存已建立
+ '[' -n '' ']'
+ sh -c 'yum install -y -q docker-ce'
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-19.03.5-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
docker-ce-19.03.5-3.el7.x86_64.rpm 的公鑰尚未安裝
導入 GPG key 0x621E9F35:
用戶ID : "Docker Release (CE rpm) <[email protected]>"
指紋 : 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
來自 : https://download.docker.com/linux/centos/gpg
setsebool: SELinux is disabled.
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker your-user
Remember that you will have to log out and back in for this to take effect!
WARNING: Adding a user to the "docker" group will grant the ability to run
containers which can be used to obtain root privileges on the
docker host.
Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
for more information.
注意:正在將請求轉發到“systemctl enable docker.service”。
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Redirecting to /bin/systemctl start docker.service
The showdoc image is being retrieved, please wait a moment... The time required is related to your network environment.
正在拉取showdoc鏡像,請稍後...所需時間與你的網絡環境有關
Using default tag: latest
latest: Pulling from star7th/showdoc
ff3a5c916c92: Pulling fs layer
2ca736d3a2d3: Pulling fs layer
ed01bffbd8ba: Pulling fs layer
86a241b7142f: Pulling fs layer
2ffa2200859b: Pulling fs layer
bba89656402e: Pulling fs layer
3f9869615113: Pulling fs layer
ca6f4c22bb7e: Pulling fs layer
c6e670a03139: Pulling fs layer
d68194d4a919: Pulling fs layer
3886fecfffe3: Pull complete
72d73c916ca2: Pull complete
66c290981af1: Pull complete
ae984e1cd476: Pull complete
4f5c98e97881: Pull complete
7a5c8005874f: Pull complete
d0e5afcf9ed6: Pull complete
a77fddbcccce: Pull complete
29fbff2beeff: Pull complete
6acbe516593c: Pull complete
b2e0f8f06f86: Pull complete
a3982ad6ae6d: Pull complete
53fe85e64f8b: Pull complete
401d987fb2cd: Pull complete
955b2c3c2280: Pull complete
b7957d06df75: Pull complete
fce749939a8f: Pull complete
747e227b8897: Pull complete
8eea7612ac50: Pull complete
fc16400d9d1c: Pull complete
3e0ee360fd75: Pull complete
825d163187d4: Pull complete
998e867b72f9: Pull complete
ee3cf456b599: Pull complete
575d41d3ddbb: Pull complete
36d46827cd08: Pull complete
283a81555d5d: Pull complete
a9f839ce9b50: Pull complete
Digest: sha256:7bed49190407043d99cce85e34c655fc3ca133d8f66dcdc40f75b30ba1528d47
Status: Downloaded newer image for registry.cn-shenzhen.aliyuncs.com/star7th/showdoc:latest
registry.cn-shenzhen.aliyuncs.com/star7th/showdoc:latest
2b072edda2bb1ef5fc3cd2d0709cfb2a0f2a232213b944f6e10a85bed2085bf1
install success !!!
--2020-02-08 22:13:54-- http://localhost:4999/install/install.lock
正在解析主機 localhost (localhost)... 127.0.0.1, ::1
正在連接 localhost (localhost)|127.0.0.1|:4999... 已連接。
已發出 HTTP 請求,正在等待迴應... 200 OK
長度:23 [application/octet-stream]
正在保存至: “install.lock”
100%[===============================================>] 23 --.-K/s 用時 0s
2020-02-08 22:13:54 (1.80 MB/s) - 已保存 “install.lock” [23/23])
安裝成功,訪問地址:http://localhost:4999 (你也可以用局域網或者公網IP/域名訪問)
賬戶密碼是showdoc/123456,登錄後你便可以看到右上方的管理後臺入口。建議登錄後修改密碼。
對showdoc的問題或建議請至https://github.com/star7th/showdoc 提issue
若覺得showdoc好用,不妨到github點個star。良好的關注度和參與度有助於開源項目的長遠發展
#下面附上腳本其他命令,以便管理 showdoc 時可以用得上。
#停止
./showdoc stop
#重啓
./showdoc restart
#升級showdoc到最新版
./showdoc update
#卸載showdoc
./showdoc uninstall