【云原生之Docker实战】使用Docker部署ShowDoc文档工具

简介: 【云原生之Docker实战】使用Docker部署ShowDoc文档工具

一、ShowDoc介绍

1.ShowDoc简介

ShowDoc是一个非常适合IT团队的在线API文档、技术文档工具。通过showdoc,你可以方便地使用markdown语法来书写出美观的API文档、数据字典文档、技术文档、在线excel文档等等。

2.ShowDoc功能

  • 分享与导出
响应式网页设计,可将项目文档分享到电脑或移动设备查看。同时也可以将项目导出成word文件,以便离线浏览。
  • 权限管理
1.公开项目与私密项目:ShowDoc上的项目有公开项目和私密项目两种。公开项目可供任何登录与非登录的用户访问,而私密项目则需要输入密码验证访问。密码由项目创建者设置。
2.项目转让:项目创建者可以自由地把项目转让给网站的其他用户。
3.项目成员:你可以很方便地为ShowDoc的项目添加、删除项目成员。项目成员可以对项目进行编辑,但不可转让或删除项目(只有项目创建者才有权限)。
4.团队管理:利用showdoc的团队功能你可以更好地进行团队协作。
  • 编辑功能
1.markdown编辑:ShowDoc采用markdown编辑器,无论是编辑还是阅读体验都极佳很棒。
2.模板插入:在ShowDoc的编辑页面,点击编辑器上方的按钮可方便地插入API接口模板和数据字典模板。
3.历史版本:ShowDoc为页面提供历史版本功能,你可以方便地把页面恢复到之前的版本。
  • 多平台
showdoc支持网页版、手机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状态

[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
     Docs: https://docs.docker.com
 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

五、创建ShowDoc容器

1.创建数据目录

mkdir -p /data/showdoc/html

2目录授权

[root@docker showdoc]# chmod -R 777 /data/showdoc/
[root@docker 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容器状态

[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.团队管理

在这里插入图片描述

相关文章
|
8月前
|
监控 Kubernetes 安全
还没搞懂Docker? Docker容器技术实战指南 ! 从入门到企业级应用 !
蒋星熠Jaxonic,技术探索者,以代码为笔,在二进制星河中书写极客诗篇。专注Docker与容器化实践,分享从入门到企业级应用的深度经验,助力开发者乘风破浪,驶向云原生新世界。
802 51
还没搞懂Docker? Docker容器技术实战指南 ! 从入门到企业级应用 !
|
12月前
|
运维 监控 数据可视化
容器化部署革命:Docker实战指南
容器化部署革命:Docker实战指南
|
10月前
|
运维 Dubbo Cloud Native
Dubbo 云原生重构出击:更快部署、更强控制台、更智能运维
Apache Dubbo 最新升级支持云原生,提供一键部署微服务集群与全新可视化控制台,提升全生命周期管理体验,助力企业高效构建云原生应用。
1369 25
|
11月前
|
供应链 测试技术 开发者
用 Docker 轻松部署 ERPNext 15:多场景实战指南
ERPNext 15 是一款功能全面的开源企业资源规划系统,结合 Docker 容器化部署,具备高效、灵活、低成本等优势。适用于小微企业数字化起步、多分支机构协同办公、开发者测试环境搭建、短期项目管理及企业内部培训等多种场景。模块化设计支持按需扩展,满足不同规模企业需求,是实现高效企业管理的理想选择。
用 Docker 轻松部署 ERPNext 15:多场景实战指南
|
12月前
|
安全 Java Docker
Docker 部署 Java 应用实战指南与长尾优化方案
本文详细介绍了Docker容器化部署Java应用的最佳实践。首先阐述了采用多阶段构建和精简JRE的镜像优化技术,可将镜像体积减少60%。其次讲解了资源配置、健康检查、启动优化等容器化关键配置,并演示了Spring Boot微服务的多模块构建与Docker Compose编排方案。最后深入探讨了Kubernetes生产部署、监控日志集成、灰度发布策略以及性能调优和安全加固措施,为Java应用的容器化部署提供了完整的解决方案指南。文章还包含大量可落地的代码示例,涵盖从基础到高级的生产环境实践。
762 3
|
9月前
|
Kubernetes Devops Docker
Kubernetes 和 Docker Swarm:现代 DevOps 的理想容器编排工具
本指南深入解析 Kubernetes 与 Docker Swarm 两大主流容器编排工具,涵盖安装、架构、网络、监控等核心维度,助您根据团队能力与业务需求精准选型,把握云原生时代的技术主动权。
798 115