エンジニアの覚え書き

web系エンジニアの技術メモを主に投稿していきます。

schemaspyをdocker-composeで動かす

official imageでschemaspyを導入する方法

github.com

docker-compose.yml

  schemaspy:
    image: schemaspy/schemaspy
    volumes:
      - ./schemaspy/output:/output
      - ./schemaspy/config:/config
    container_name: "schemaspy_local"
    command: ["-configFile", "/config/schemaspy.properties"]
    links:
      - mysql
  nginx:
    image: nginx
    container_name: "nginx_for_schemaspy"
    ports:
      - "10080:80"
    volumes:
      - ./schemaspy/output:/usr/share/nginx/html:ro

schemaspy/config/schemaspy.properties

# type of database. Run with -dbhelp for details
schemaspy.t=mysql
# database properties: host, port number, name user, password
schemaspy.host=mysql
schemaspy.port=3306
schemaspy.db=sample
schemaspy.u=db_user
schemaspy.p=password
# db scheme for which generate diagrams
schemaspy.s=sample

docker-compose upで起動すると、schemaspy/output配下にschemaspyが生成したhtmlが出力され、http://localhost:10080でアクセスできる。