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

APIがDBとの接続できない問題の解消 #822

Merged
merged 2 commits into from
Jul 6, 2024

Conversation

Kubosaka
Copy link
Collaborator

@Kubosaka Kubosaka commented Jul 4, 2024

resolve #821

概要

  • apiとdbが接続できない時、apiコンテナを再起動する必要があったので対策をした

変更内容

アプリ(view, api)とDB(db, minio)でdocker-compose.ymlファイルを分割した

  • 理由
    • apiが起動する際にdbが起動中で接続できないため
    • 現在はdocker compose downで全てのコンテナを閉じてしまう→再起動の度に負荷がかかる
  • デメリット
    • dbの起動忘れなどが発生するかも
    • 起動するまでに make run-db, make build, make runの3つのコマンドが必要になる

db側は基本ずっと立ち上げとくイメージ(閉じてもいい)
makeコマンドの修正(run-db, stop-dbなど)

テスト項目

  • 既存のdockcer ネットワーク、イメージ、ボリュームを削除
  • ルートディレクトリにfinansu.envがあるか確認する
  • make run-db、 make buildmake runでFinanSuが起動するか
  • アプリ側を停止して、make runで起動するか(Goがdbと繋がるか)
  • 色々動かして、変なエラーが出ないか

備考

@Kubosaka Kubosaka requested review from KazumaSun and TkymHrt July 4, 2024 02:38
@Kubosaka Kubosaka self-assigned this Jul 4, 2024
@github-actions github-actions bot added the bug Something isn't working label Jul 4, 2024
Copy link
Collaborator

@KazumaSun KazumaSun left a comment

Choose a reason for hiding this comment

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

LGTM

@TakuyaNakakura TakuyaNakakura self-requested a review July 6, 2024 07:17
Copy link
Collaborator

@TakuyaNakakura TakuyaNakakura left a comment

Choose a reason for hiding this comment

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

LGTM

@Kubosaka Kubosaka merged commit 134202f into develop Jul 6, 2024
2 checks passed
@Kubosaka Kubosaka deleted the fix/kubosaka/db-api-connect-bug branch July 6, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

一回でAPI(バックエンド)がDBと接続できない問題調査
3 participants