Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ api/lib/interface
api/env/*
api/seeds/*
web/prod/*
api/docs/schemaspy/*
!api/docs/schemaspy/.gitkeep
!api/docs/schemaspy/schemaspy.properties
!api/docs/schemaspy/README.md

# SchemaSpy
schemaspy/
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ mac-seed:
sleep 15
docker compose -f docker-compose.mac.yml run --rm api go run /app/seeds/seeds.go

.PHONY: schemaspy
schemaspy:
mkdir -p api/docs/schemaspy
docker compose run --rm schemaspy $(ARGS)

.PHONY: mac-schemaspy
mac-schemaspy:
mkdir -p api/docs/schemaspy
docker compose -f docker-compose.mac.yml run --rm schemaspy $(ARGS)

# mobile/lib/assetsに512*512のアイコンを用意しておくこと(コマンドのファイル名も変更する)
# リサイズ用にImageMagickをインストールする(`sudo apt-get install imagemagick` or `brew install imagemagick`)
.PHONY: mobile-icons-init
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ git submodule update --init
### diを編集してからうまく動かないとき
一度コンテナをdownさせてからupし直してみてください。

## SchemaSpyでDBスキーマを確認する(PostgreSQL)
- DB初期データは `mysql/db` ディレクトリにありますが、実際のDBはPostgreSQLです。
- 生成物の出力先: `api/docs/schemaspy`

```fish
# 標準(docker-compose.yml)
make schemaspy

# Mac用composeを使う場合
make mac-schemaspy
```
接続先・認証情報は compose の環境変数(`SCHEMASPY_HOST`, `SCHEMASPY_DB` など)で上書きできます。

## Author
NUTMEG(技大祭実行委員会情報局)
mail: nutfes.info [at] gmail
2 changes: 2 additions & 0 deletions api/docs/schemaspy/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@


6 changes: 6 additions & 0 deletions api/docs/schemaspy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SchemaSpy 出力先

- 生成物のHTMLはこのディレクトリに出力されます。
- 設定テンプレート: `schemaspy.properties`(接続先はPostgreSQLを想定)。
- `docker compose run --rm schemaspy` または `make schemaspy` で再生成できます。

17 changes: 17 additions & 0 deletions api/docs/schemaspy/schemaspy.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SchemaSpy configuration for SeeFT PostgreSQL
# メモ: リポジトリ内の mysql ディレクトリは初期データ置き場だが、実際のDBはPostgreSQL。
schemaspy.t=pgsql
schemaspy.host=${SCHEMASPY_HOST:-db}
schemaspy.port=${SCHEMASPY_PORT:-5432}
schemaspy.db=${SCHEMASPY_DB:-seeft_db}
schemaspy.u=${SCHEMASPY_USER:-seeft}
schemaspy.p=${SCHEMASPY_PASSWORD:-password}
schemaspy.s=${SCHEMASPY_SCHEMA:-public}

# 出力先は docker-compose のボリューム指定で /output にマウントされる
schemaspy.o=/output

# 追加で必要な場合のサンプル
# schemaspy.meta=/output/meta.xml
# schemaspy.cat=public

33 changes: 33 additions & 0 deletions docker-compose.mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,36 @@ services:
tty: true
depends_on: [api]

schemaspy:
container_name: nutfes-seeft-schemaspy
image: schemaspy/schemaspy:latest
depends_on:
db:
condition: service_started
environment:
SCHEMASPY_HOST: ${SCHEMASPY_HOST:-db}
SCHEMASPY_PORT: ${SCHEMASPY_PORT:-5432}
SCHEMASPY_DB: ${SCHEMASPY_DB:-seeft_db}
SCHEMASPY_USER: ${SCHEMASPY_USER:-seeft}
SCHEMASPY_PASSWORD: ${SCHEMASPY_PASSWORD:-password}
SCHEMASPY_SCHEMA: ${SCHEMASPY_SCHEMA:-public}
volumes:
- ./api/docs/schemaspy:/output
command:
- "-t"
- "pgsql"
- "-host"
- "${SCHEMASPY_HOST:-db}"
- "-port"
- "${SCHEMASPY_PORT:-5432}"
- "-db"
- "${SCHEMASPY_DB:-seeft_db}"
- "-u"
- "${SCHEMASPY_USER:-seeft}"
- "-p"
- "${SCHEMASPY_PASSWORD:-password}"
- "-s"
- "${SCHEMASPY_SCHEMA:-public}"
- "-o"
- "/output"

37 changes: 36 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.8"


services:
db:
Expand Down Expand Up @@ -59,4 +59,39 @@ services:
tty: true
depends_on: [api]

schemaspy:
container_name: nutfes-seeft-schemaspy
image: schemaspy/schemaspy:latest
depends_on:
db:
condition: service_started
environment:
SCHEMASPY_HOST: ${SCHEMASPY_HOST:-db}
SCHEMASPY_PORT: ${SCHEMASPY_PORT:-5432}
SCHEMASPY_DB: ${SCHEMASPY_DB:-seeft_db}
SCHEMASPY_USER: ${SCHEMASPY_USER:-seeft}
SCHEMASPY_PASSWORD: ${SCHEMASPY_PASSWORD:-password}
SCHEMASPY_SCHEMA: ${SCHEMASPY_SCHEMA:-public}
volumes:
- ./api/docs/schemaspy:/output
profiles:
- tools
command:
- "-t"
- "pgsql"
- "-host"
- "${SCHEMASPY_HOST:-db}"
- "-port"
- "${SCHEMASPY_PORT:-5432}"
- "-db"
- "${SCHEMASPY_DB:-seeft_db}"
- "-u"
- "${SCHEMASPY_USER:-seeft}"
- "-p"
- "${SCHEMASPY_PASSWORD:-password}"
- "-s"
- "${SCHEMASPY_SCHEMA:-public}"
# - "-o"
# - "/output"