创建生成的SchemaSpy文档站点的docker容器

问题描述 投票:0回答:1

我正在尝试创建一个永久的 docker 容器来托管我的 mysql 数据库的 SchemaSpy 生成的文档站点。

这是我的 docker-compose.yaml 中的相关部分:

    docs:
        image: schemaspy/schemaspy:latest
        container_name: Docs
        ports:
            - "5558:80"
        environment:
            DB_USER: root
            DB_PASS: pass111
            DB_NAME: EduSys
            DB_PORT: "1026"
            DB_HOST: 138.150.210.254
        depends_on:
            - "mysql"
        volumes:
            - "/SchemaSpy/output:/output"
        command: >
            -u root -p pass111 -db EduSys -t mysql -host 138.150.210.254 -port 1026 -s EduSys -renderer none -nohtmlimages -nodot
        restart: always

   mysql:
        image: mysql:8.2
        container_name: MySQL
        environment:
            MYSQL_ROOT_PASSWORD: pass111
            MYSQL_OPTIONS: --sort_buffer_size=2M
        ports:
            - "1026:3306"
        volumes:
            - mysql_db:/var/lib/mysql

volumes:
  mysql_db:

容器运行并可以使用

docker ps
查看。

尝试访问 138.150.210.254:5558/index.html 时出现“无法访问该网站”页面。

使用

docker logs Docs
打印出这些错误消息:

INFO  - Starting Main v6.2.4 on 6bb5f0568ddd with PID 1 (/usr/local/lib/schemaspy/schemaspy-6.2.4-app.jar started by java in /)
INFO  - The following profiles are active: default
INFO  - Started Main in 1.372 seconds (JVM running for 1.889)
INFO  - Starting schema analysis
INFO  - Connected to MySQL - 8.2.0
INFO  - Gathering schema details
Gathering schema details..................................................................................................................................................................................................................(1sec)
Connecting relationships..................................................................................................................................................................................................................(2sec)
Writing/graphing summary.INFO  - Gathered schema details in 2 seconds
INFO  - Writing/graphing summary
INFO  - Graphviz renderer set to ':cairo'
.ERROR - dot -Tpng:cairo relationships.real.compact.dot -orelationships.real.compact.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.real.compact.dot -orelationships.real.compact.png -Tcmapx: in label of node Schools
ERROR - dot -Tpng:cairo relationships.real.compact.dot -orelationships.real.compact.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.real.compact.dot -orelationships.real.compact.png -Tcmapx: in label of node Courses
ERROR - dot -Tpng:cairo relationships.real.compact.dot -orelationships.real.compact.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.real.compact.dot -orelationships.real.compact.png -Tcmapx: in label of node Degrees
ERROR - dot -Tpng:cairo relationships.real.large.dot -orelationships.real.large.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.real.large.dot -orelationships.real.large.png -Tcmapx: in label of node Schools
ERROR - dot -Tpng:cairo relationships.real.large.dot -orelationships.real.large.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.real.large.dot -orelationships.real.large.png -Tcmapx: in label of node Courses
ERROR - dot -Tpng:cairo relationships.real.large.dot -orelationships.real.large.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.real.large.dot -orelationships.real.large.png -Tcmapx: in label of node Degrees
.ERROR - dot -Tpng:cairo relationships.implied.compact.dot -orelationships.implied.compact.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.implied.compact.dot -orelationships.implied.compact.png -Tcmapx: in label of node Schools
ERROR - dot -Tpng:cairo relationships.implied.compact.dot -orelationships.implied.compact.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.implied.compact.dot -orelationships.implied.compact.png -Tcmapx: in label of node Courses
ERROR - dot -Tpng:cairo relationships.implied.compact.dot -orelationships.implied.compact.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.implied.compact.dot -orelationships.implied.compact.png -Tcmapx: in label of node Degrees
ERROR - dot -Tpng:cairo relationships.implied.large.dot -orelationships.implied.large.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.implied.large.dot -orelationships.implied.large.png -Tcmapx: in label of node Schools
ERROR - dot -Tpng:cairo relationships.implied.large.dot -orelationships.implied.large.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.implied.large.dot -orelationships.implied.large.png -Tcmapx: in label of node Courses
ERROR - dot -Tpng:cairo relationships.implied.large.dot -orelationships.implied.large.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo relationships.implied.large.dot -orelationships.implied.large.png -Tcmapx: in label of node Degrees
.ERROR - dot -Tpng:cairo orphans.dot -oorphans.png -Tcmapx: dot: graph is too large for cairo-renderer bitmaps. Scaling by 0.420959 to fit
.....(11sec)
Writing/diagramming detailsINFO  - Completed summary in 11 seconds
INFO  - Writing/diagramming details
.........................ERROR - dot -Tpng:cairo Schools.1degree.dot -oSchools.1degree.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo Schools.1degree.dot -oSchools.1degree.png -Tcmapx: in label of node Schools
ERROR - dot -Tpng:cairo Schools.2degrees.dot -oSchools.2degrees.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo Schools.2degrees.dot -oSchools.2degrees.png -Tcmapx: in label of node Courses
ERROR - dot -Tpng:cairo Schools.2degrees.dot -oSchools.2degrees.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo Schools.2degrees.dot -oSchools.2degrees.png -Tcmapx: in label of node Schools
................ERROR - dot -Tpng:cairo Courses.1degree.dot -oCourses.1degree.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo Courses.1degree.dot -oCourses.1degree.png -Tcmapx: in label of node Courses
ERROR - dot -Tpng:cairo Courses.2degrees.dot -oCourses.2degrees.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo Courses.2degrees.dot -oCourses.2degrees.png -Tcmapx: in label of node Courses
ERROR - dot -Tpng:cairo Courses.2degrees.dot -oCourses.2degrees.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo Courses.2degrees.dot -oCourses.2degrees.png -Tcmapx: in label of node Schools
............ERROR - dot -Tpng:cairo Programs.1degree.dot -oPrograms.1degree.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo Programs.1degree.dot -oPrograms.1degree.png -Tcmapx: in label of node Courses
ERROR - dot -Tpng:cairo Programs.1degree.dot -oPrograms.1degree.png -Tcmapx: Warning: cell size too small for content
ERROR - dot -Tpng:cairo Programs.1degree.dot -oPrograms.1degree.png -Tcmapx: in label of node Schools

我不明白的是为什么它忽略我在命令中指定的

-nohtmlimages
-nodot
标志,以便它不生成任何图表?为什么我在导航到它应该托管的端口时无法访问它?

PS:为了保证安全,本题中的ip和密码都是不真实的。

mysql docker docker-compose schemaspy
1个回答
0
投票

好吧,我想我得到了一个满意的解决方案。 我意识到我需要做两件事:

  1. 使用 schemaspy 生成静态网站
  2. 运行一个 Web 服务器来为静态网站提供服务,这样我就可以使用 IP 和端口实际访问它

所以我创建了两个docker容器;一个人来执行这些步骤中的每一个。我更希望能在一个容器中完成这两件事,但我在尝试实现这一目标时不断遇到错误,所以我现在就这样吧。

这是我当前在 docker-compose.yaml 中的工作设置:

    docs:
        image: schemaspy/schemaspy:latest
        container_name: Docs
        environment:
            DB_USER: root
            DB_PASS: pass111
            DB_NAME: EduSys
            DB_PORT: "1026"
            DB_HOST: 138.150.210.254
        depends_on:
            - "mysql"
        volumes:
            - schemaspy-data:/output
        entrypoint: >
            sh -c "schemaspy -t mysql -host 138.150.210.254 -port 1026 -db EduSys -s EduSys -u root -p pass111"

    zcedudocs_web:
        image: nginx:latest
        container_name: nginx
        ports:
            - "5558:80"
        volumes:
            - schemaspy-data:/usr/share/nginx/html:ro
        depends_on:
            - docs
    mysql:
        image: mysql:8.2
        container_name: MySQL
        environment:
            MYSQL_ROOT_PASSWORD: pass111
            MYSQL_OPTIONS: --sort_buffer_size=2M
        ports:
            - "1026:3306"
        volumes:
            - mysql_db:/var/lib/mysql

    volumes:
       mysql_db:
       schemaspy-data:

我使用 docker compose up -d 来运行所有内容,现在它可以工作了!请记住使用 http 而不是 https。网址看起来像这样 http://138.150.210.254:5558/index.html

© www.soinside.com 2019 - 2024. All rights reserved.