Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/backend/api/seed #15

Merged
merged 6 commits into from
Mar 23, 2024
Merged

Feat/backend/api/seed #15

merged 6 commits into from
Mar 23, 2024

Conversation

KinjiKawaguchi
Copy link
Member

@KinjiKawaguchi KinjiKawaguchi commented Mar 22, 2024

やったこと

  • entSchemaを変更
  • DBシードプログラムとフラグを用意
  • 開発用Dockerを作成
  • フロント向け開発ドキュメントを作成

Copy link
Collaborator

@h-takeyeah h-takeyeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ドキュメントとDockerしか見てません

typing-app/docs/get-started.md Outdated Show resolved Hide resolved
typing-app/docs/get-started.md Outdated Show resolved Hide resolved
@h-takeyeah
Copy link
Collaborator

@KinjiKawaguchi レビューとは別にコンテナが起動しなかったです

2024-03-23 12:36
projects/su-its-typing/typing-server  feat/backend/api/seed [$] ➜ docker compose -f docker-compose.dev.yml up --build
[+] Building 50.4s (17/17) FINISHED                                                                                                                                          docker:default
 => [api internal] load build definition from Dockerfile.dev                                                                                                                           0.0s
 => => transferring dockerfile: 670B                                                                                                                                                   0.0s
 => [api internal] load metadata for docker.io/library/alpine:latest                                                                                                                   2.0s
 => [api internal] load metadata for docker.io/library/golang:1.22.0                                                                                                                   0.0s
 => [api auth] library/alpine:pull token for registry-1.docker.io                                                                                                                      0.0s
 => [api internal] load .dockerignore                                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                        0.0s
 => [api builder 1/5] FROM docker.io/library/golang:1.22.0                                                                                                                             0.0s
 => [api stage-1 1/5] FROM docker.io/library/alpine:latest@sha256:c5b1261d6d3e43071626931fc004f70149baeba2c8ec672bd4f27761f8e1ad6b                                                     0.0s
 => [api internal] load build context                                                                                                                                                  0.1s
 => => transferring context: 139.17kB                                                                                                                                                  0.0s
 => CACHED [api builder 2/5] WORKDIR /app                                                                                                                                              0.0s
 => [api builder 3/5] COPY . .                                                                                                                                                         0.1s
 => [api builder 4/5] RUN go mod download                                                                                                                                              4.6s
 => [api builder 5/5] RUN CGO_ENABLED=0 GOOS=linux go build -v -o server ./api/cmd/main.go                                                                                            42.8s
 => CACHED [api stage-1 2/5] RUN apk --no-cache add ca-certificates                                                                                                                    0.0s
 => CACHED [api stage-1 3/5] RUN apk --no-cache add tzdata                                                                                                                             0.0s
 => CACHED [api stage-1 4/5] WORKDIR /root                                                                                                                                             0.0s
 => [api stage-1 5/5] COPY --from=builder /app/server .                                                                                                                                0.2s
 => [api] exporting to image                                                                                                                                                           0.2s
 => => exporting layers                                                                                                                                                                0.2s
 => => writing image sha256:03e17992b0fe2b4cd325feb62c91a302ae71d128811d994bfc2463f8a1c8b018                                                                                           0.0s
 => => naming to docker.io/library/typing-server-api                                                                                                                                   0.0s
[+] Running 2/2
 ✔ Container typing-server-db-1   Created                                                                                                                                              0.0s
 ✔ Container typing-server-api-1  Recreated                                                                                                                                            0.3s
Attaching to api-1, db-1
db-1   | 2024-03-23 03:31:42+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.3.0-1.el8 started.
db-1   | 2024-03-23 03:31:42+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db-1   | 2024-03-23 03:31:42+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.3.0-1.el8 started.
db-1   | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
db-1   | 2024-03-23T03:31:43.278891Z 0 [System] [MY-015015] [Server] MySQL Server - start.
db-1   | 2024-03-23T03:31:43.586134Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.3.0) starting as process 1
db-1   | 2024-03-23T03:31:43.603060Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
db-1   | 2024-03-23T03:31:43.878680Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
db-1   | 2024-03-23T03:31:44.204392Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
db-1   | 2024-03-23T03:31:44.204459Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
db-1   | 2024-03-23T03:31:44.212580Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
db-1   | 2024-03-23T03:31:44.277148Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
db-1   | 2024-03-23T03:31:44.278291Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.3.0'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
api-1  | 2024/03/23 03:31:54 INFO ent client is opened
api-1  | 2024/03/23 03:31:54 INFO schema is created
api-1  | panic: Error 1364 (HY000): Field 'mail_adress' doesn't have a default value
api-1  |
api-1  | goroutine 1 [running]:
api-1  | main.seedData({0xc833a0, 0x10f6bc0}, 0xc0001f2aa0)
api-1  |        /app/api/cmd/main.go:135 +0x85f
api-1  | main.main()
api-1  |        /app/api/cmd/main.go:68 +0x425
api-1 exited with code 2

Copy link
Contributor

@shin0729 shin0729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

学部コメントアウトなんでか知りたい.

Copy link
Contributor

@shin0729 shin0729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ent generateしてるのにスキーマのメールアドレスの部分(とそれに準じる依存したファイル)がこうしんされてないみたいなことかねこれ.

@shin0729
Copy link
Contributor

ent generateしてるのにスキーマのメールアドレスの部分(とそれに準じる依存したファイル)がこうしんされてないみたいなことかねこれ.
メールアドレスの非null制約違反っぽい

shin0729
shin0729 previously approved these changes Mar 23, 2024
Copy link
Contributor

@shin0729 shin0729 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@h-takeyeah
Copy link
Collaborator

#15 (comment)

ボリュームが残ってた。消したら解決した

docker compose -f docker-compose.dev.yml stop db
docker compose -f docker-compose.dev.yml rm db
docker volume rm typing-server_db-data
docker compose -f docker-compose.dev.yml up -d

Copy link
Member Author

@KinjiKawaguchi KinjiKawaguchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

学部コメントアウトなんでか知りたい.

コメントアウトなので、削除とは違うということをまず伝えておきます。
開発の簡素化のために一旦コメントアウトしました。
また、履修名簿からのインポート機能についても考えないといけないので、履修者名簿の仕様にもよるかなと思い、一旦最低限の情報だけ残したという感じです。

@KinjiKawaguchi KinjiKawaguchi requested review from h-takeyeah and shin0729 and removed request for h-takeyeah March 23, 2024 06:30
Copy link
Collaborator

@h-takeyeah h-takeyeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正感謝です~

@KinjiKawaguchi KinjiKawaguchi merged commit a36cb58 into develop Mar 23, 2024
2 checks passed
@h-takeyeah h-takeyeah deleted the feat/backend/api/seed branch March 29, 2024 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants