用docker部署ShowDoc,文檔管理不再難
- 1.ShowDoc簡介
- 2.ShowDoc功能
- 1.創(chuàng)建數(shù)據(jù)目錄
- 2目錄授權
- 3.運行ShowDoc容器
- 4.查看ShowDoc容器狀態(tài)
- 5.查看容器運行日志
- 1.選擇語言
- 2.查看初始化結果
- 1.進入ShowDoc登錄頁
- 2.登錄ShowDoc首頁
- 1.進入后臺管理界面
- 2.新建項目
- 3.新建與編輯文檔
- 4.團隊管理
一、ShowDoc介紹
1.ShowDoc簡介
ShowDoc是一個非常適合IT團隊的在線API文檔、技術文檔工具。通過showdoc,你可以方便地使用markdown語法來書寫出美觀的API文檔、數(shù)據(jù)字典文檔、技術文檔、在線excel文檔等等。
2.ShowDoc功能
- 分享與導出
響應式網(wǎng)頁設計,可將項目文檔分享到電腦或移動設備查看。同時也可以將項目導出成word文件,以便離線瀏覽。
- 權限管理
1.公開項目與私密項目:ShowDoc上的項目有公開項目和私密項目兩種。公開項目可供任何登錄與非登錄的用戶訪問,而私密項目則需要輸入密碼驗證訪問。密碼由項目創(chuàng)建者設置。
2.項目轉讓:項目創(chuàng)建者可以自由地把項目轉讓給網(wǎng)站的其他用戶。
3.項目成員:你可以很方便地為ShowDoc的項目添加、刪除項目成員。項目成員可以對項目進行編輯,但不可轉讓或刪除項目(只有項目創(chuàng)建者才有權限)。
4.團隊管理:利用showdoc的團隊功能你可以更好地進行團隊協(xié)作。
- 編輯功能
1.markdown編輯:ShowDoc采用markdown編輯器,無論是編輯還是閱讀體驗都極佳很棒。
2.模板插入:在ShowDoc的編輯頁面,點擊編輯器上方的按鈕可方便地插入API接口模板和數(shù)據(jù)字典模板。
3.歷史版本:ShowDoc為頁面提供歷史版本功能,你可以方便地把頁面恢復到之前的版本。
- 多平臺
showdoc支持網(wǎng)頁版、手機app版和電腦客戶端版。客戶端地址可見:https://www.showdoc.com.cn/clients。
- 自動化
1.可從代碼注釋中自動生成文檔。 2.搭配的RunApi客戶端,可調試接口和自動生成文檔。
二、檢查docker版本
[root@docker ~]# docker version Client: Docker Engine - Community Version: 20.10.18 API version: 1.41 Go version: go1.18.6 Git commit: b40c2f6 Built: Thu Sep 8 23:14:08 2022 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.18 API version: 1.41 (minimum version 1.12) Go version: go1.18.6 Git commit: e42327a Built: Thu Sep 8 23:12:21 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.8 GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6 runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0
三、檢查docker狀態(tài)
[root@docker showdoc]# ls [root@docker showdoc]# systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2022-10-23 19:15:37 CST; 3h 21min ago Main PID: 9693 (dockerd) Tasks: 51 Memory: 1.5G CGroup: /system.slice/docker.service
四、下載ShowDoc鏡像
[root@docker showdoc]# docker pull star7th/showdoc Using default tag: latest latest: Pulling from star7th/showdoc 59bf1c3509f3: Pull complete 7c7da25b2876: Pull complete 2bc599114627: Pull complete 927a0b37a45a: Pull complete 1766f36e2432: Pull complete 4c13e0891ac6: Pull complete 2cec0bbb4ba9: Pull complete b36e8fdf0264: Pull complete 387739aab6be: Pull complete d73f4116d27c: Pull complete ac2614199456: Pull complete 8cf23d77585a: Pull complete 2595abc0c000: Pull complete e19d5b33c59c: Pull complete 3c91138e3b38: Pull complete e1e2f7050886: Pull complete ddf7a600aa8d: Pull complete c21a6cac05ae: Pull complete 4ee11851e20a: Pull complete 5a9839199e80: Pull complete b6f89a4d0e50: Pull complete f7a113ae7a21: Pull complete afe348e7bc07: Pull complete 7d4f658c188c: Pull complete 1949b55bfafc: Pull complete 18fc12f9ed58: Pull complete debcc98cda0a: Pull complete 313c4ac392fa: Pull complete 654d7595e577: Pull complete e35254510d69: Pull complete 4e973aacee4d: Pull complete Digest: sha256:5ab4cec5e2e0c75d02e62c924a0457fc2751c1ce8f056f30f2920f88d431de39 Status: Downloaded newer image for star7th/showdoc:latest docker.io/star7th/showdoc:latest
五、創(chuàng)建ShowDoc容器
1.創(chuàng)建數(shù)據(jù)目錄
mkdir -p /data/showdoc/html
2目錄授權
[root@docker showdoc]# chmod -R 777 /data/showdoc/
3.運行ShowDoc容器
[root@docker showdoc]# docker run -d --name showdoc --user=root --privileged=true -p 4999:80 > --restart always -v /data/showdoc/html:/var/www/html/ star7th/showdoc 56c200dbb93e621d20258624a05c39e110beb8261e86fcac30a95a75d3074578
4.查看ShowDoc容器狀態(tài)
[root@docker showdoc]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 56c200dbb93e star7th/showdoc "/entrypoint /bin/sh…" 23 seconds ago Up 22 seconds 443/tcp, 9000/tcp, 0.0.0.0:4999->80/tcp, :::4999->80/tcp showdoc
5.查看容器運行日志
[root@docker showdoc]# docker logs showdoc /usr/lib/python3.9/site-packages/supervisor/options.py:474: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security. self.warnings.warn( 2022-10-23 14:50:21,648 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. 2022-10-23 14:50:21,649 INFO Included extra file "/opt/docker/etc/supervisor.d/cron.conf" during parsing 2022-10-23 14:50:21,649 INFO Included extra file "/opt/docker/etc/supervisor.d/dnsmasq.conf" during parsing 2022-10-23 14:50:21,649 INFO Included extra file "/opt/docker/etc/supervisor.d/nginx.conf" during parsing 2022-10-23 14:50:21,649 INFO Included extra file "/opt/docker/etc/supervisor.d/php-fpm.conf" during parsing 2022-10-23 14:50:21,649 INFO Included extra file "/opt/docker/etc/supervisor.d/postfix.conf" during parsing 2022-10-23 14:50:21,649 INFO Included extra file "/opt/docker/etc/supervisor.d/ssh.conf" during parsing 2022-10-23 14:50:21,649 INFO Included extra file "/opt/docker/etc/supervisor.d/syslog.conf" during parsing 2022-10-23 14:50:21,653 INFO RPC interface 'supervisor' initialized 2022-10-23 14:50:21,653 INFO supervisord started with pid 1 2022-10-23 14:50:22,655 INFO spawned: 'syslogd' with pid 49 2022-10-23 14:50:22,657 INFO spawned: 'nginxd' with pid 50 2022-10-23 14:50:22,658 INFO spawned: 'php-fpmd' with pid 51 2022-10-23 14:50:22,660 INFO spawned: 'crond' with pid 52 -> Executing /opt/docker/bin/service.d/syslog-ng.d//10-init.sh 2022-10-23 14:50:22,663 INFO success: nginxd entered RUNNING state, process has stayed up for > than 0 seconds (startsecs) 2022-10-23 14:50:22,663 INFO success: php-fpmd entered RUNNING state, process has stayed up for > than 0 seconds (startsecs) 2022-10-23 14:50:22,663 INFO success: crond entered RUNNING state, process has stayed up for > than 0 seconds (startsecs) -> Executing /opt/docker/bin/service.d/nginx.d//10-init.sh -> Executing /opt/docker/bin/service.d/php-fpm.d//10-init.sh Setting php-fpm user to application [2022-10-23T14:50:22.674601] WARNING: With use-dns(no), dns-cache() will be forced to 'no' too!; nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /opt/docker/etc/nginx/vhost.ssl.conf:1 [SYSLOG] syslog-ng[49]: syslog-ng starting up; version='3.30.1' -> Executing /opt/docker/bin/service.d/cron.d//10-init.sh [23-Oct-2022 14:50:22] NOTICE: fpm is running, pid 51 [23-Oct-2022 14:50:22] NOTICE: ready to handle connections 2022-10-23 14:50:23,786 INFO success: syslogd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) > mockServer@1.0.0 start > npm run pm2 start index.js > mockServer@1.0.0 pm2 > node ./node_modules/pm2/bin/pm2 "start" "index.js" ------------- __/____/____________/____/_____ _//////////_/________/__////////___ _/_______/_///____///_///______//__ _//__//////_/___________//___ _//////////____/__////___/________///_____ _/_____________/____///_____/_____///________ _/_____________/_____________/___//___________ _/_____________/_____________/__/_ _///______________///______________///__///////////////__ Runtime Edition PM2 is a Production Process Manager for Node.js applications with a built-in Load Balancer. Start and Daemonize any application: $ pm2 start app.js Load Balance 4 instances of api.js: $ pm2 start api.js -i 4 Monitor in production: $ pm2 monitor Make pm2 auto-boot at server restart: $ pm2 startup To go further checkout: http://pm2.io/ ------------- [PM2] Spawning PM2 daemon with pm2_home=/root/.pm2 [PM2] PM2 Successfully daemonized [PM2] Starting /showdoc_data/mock/index.js in fork_mode (1 instance) [PM2] Done. ┌─────┬──────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐ │ id │ name │ namespace │ version │ mode │ pid │ uptime │ ? │ status │ cpu │ mem │ user │ watching │ ├─────┼──────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤ │ 0 │ index │ default │ 1.0.0 │ fork │ 114 │ 0s │ 0 │ online │ 0% │ 17.2mb │ root │ disabled │ └─────┴──────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘ 2022-10-23 14:50:53,821 INFO reaped unknown pid 47 (exit status 0)
六、ShowDoc初始化
1.選擇語言
2.查看初始化結果
七、登錄署ShowDoc
1.進入ShowDoc登錄頁
2.登錄ShowDoc首頁
八、ShowDoc的基本使用
1.進入后臺管理界面
2.新建項目
3.新建與編輯文檔
4.團隊管理
作者聲明本文無利益相關,歡迎值友理性交流,和諧討論~
,