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

江湖有缘
• 阅读 176

一、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.选择语言

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

2.查看初始化结果

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

七、登录署ShowDoc

1.进入ShowDoc登录页

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

2.登录ShowDoc首页

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

八、ShowDoc的基本使用

1.进入后台管理界面

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

2.新建项目

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

3.新建与编辑文档

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

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

4.团队管理

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

点赞
收藏
评论区
推荐文章
玩转服务器之Docker篇:10分钟学会搭建 Docker 环境
数字化转型浪潮下,云原生技术领域的建设投入、集群规模持续走高,云原生技术已是大势所趋。在用户生产环境中,容器技术的采纳率已接近70%,docker使应用部署更加轻量,可移植,可扩展,更好的环境隔离也更大程度地避免了生产环境与测试环境不一致的巨大尴尬,本文为大家详细讲解如何手动搭建Docker环境。
Stella981 Stella981
2年前
Docker安装showdoc
一、简介ShowDoc是什么每当接手一个他人开发好的模块或者项目,看着那些没有写注释的代码,我们都无比抓狂。文档呢?!文档呢?!Showmethedoc!!程序员都很希望别人能写技术文档,而自己却很不希望要写文档。因为写文档需要花大量的时间去处理格式排版,想着新建的word文档放在哪个目录等各种
Stella981 Stella981
2年前
Spring boot在Docker中以JPA方式连接Mysql
背景最近在了解Docker的使用,发现docker在集群部署方面和运维方面有比较大的优势,通过统一的依赖关系,以镜像的方式,将已经打好包的镜像文件,部署到各个节点。如果不用考虑集群的同学,就不用折腾这个,如果想要让应用,有较强的快速部署的能力可以考虑考虑。目标在本机创建两个docker容器,分别为mysql的容器和springbo
Stella981 Stella981
2年前
Docker实战笔记:Docker简介(二)
Docker实战笔记:Docker简介(二)博客分类:docker摘要:摘要:此Docker系列学习笔记,根据Reboot教育PC大神的运维自动化部分课程整理而成,补充少量个人理解以及练习日志(部分日志有删减)。PC大神在知乎的专栏:面向工资编程Docker简介(一)Docker简介(二)Docker管理系统(一)Docker管理系统(
Stella981 Stella981
2年前
Docker Swarm资源管理
DockerSwarmDockerSwarm是Docker官方项目之一,是使用SwarmKit构建的Docker引擎内置的集群管理和编排工具,提供Docker容器集群服务,是Docker官方对容器云生态进行支持的核心方案。使用它,用户可以将多个Docker主机封装为单个大型虚拟Docker主机,快速打造一套容器云平台。节点运
Stella981 Stella981
2年前
Docker自建仓库之Harbor高可用部署实战篇
Docker自建仓库之Harbor高可用部署实战篇作者:尹正杰版权声明:原创作品,谢绝转载!否则将追究法律责任。一.部署单机的Harbor1.部署单机版的Harbor  博主推荐阅读:    https://www.cnblogs.com/yinzhengjie/p/1223
Stella981 Stella981
2年前
Docker系列之入门
Docker基本介绍一.什么是Docker  在docker的官方之什么是docker(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fwww.docker.com%2Fwhydocker)中提到了一句话:“当今各大组织或者团体的创新都源于软件(例如OA、ER
江湖有缘 江湖有缘
8个月前
云原生之使用docker部署uptime-kuma服务器监控面板
云原生之使用docker部署uptimekuma服务器监控面板
笑面虎 笑面虎
3个月前
【2024】kubernetes+DevOps云原生运维开发全栈架构师技术实战课程
【2024】kubernetesDevOps云原生运维开发全栈架构师技术实战课程给大家分享一套课程——【2024】kubernetesDevOps云原生运维开发全栈架构师技术实战课程,附代码PDF文档软件下载。Kubernetes是Google开源
陈元 陈元
2个月前
K8s+gRPC 云原生微服务开发与治理实战
K8sgRPC云原生微服务开发与治理实战download》itzcw.com/5645/Kubernetes(K8s)与gRPC:云原生微服务开发与治理实战随着云原生技术的迅速发展,Kubernetes(K8s)和gRPC成为了构建和部署云原生微服务架构
江湖有缘
江湖有缘
Lv1
各大IT社区专家博主,华为HCIE云计算认证等,路漫漫其修远兮,吾将上下而求索!
文章
10
粉丝
0
获赞
2