DEV Community

Masatoshi Nishiguchi
Masatoshi Nishiguchi

Posted on

5 3

PhoenixアプリをFly.ioへデプロイする際のトラブルシューティング(2022年)

まずは

  • 落ち着いてエラーメッセージを読んで魚拓も取っておく
  • fly statusを見てみる
  • fly logsを見てみる
  • もう一回デプロイしてみる

SECRET_KEY_BASE is missing

CleanShot 2022-05-08 at 11 08 44@2x

  • SECRET_KEY_BASEがセットされていない。
  • 通常fly launchコマンドを打った時にSECRET_KEY_BASEは自動でセットされるはずなのですが、何らかの原因でその処理がスキップされた可能性があります。
  • fly launchコマンドの実行中にDockerfileが検知されると必要なファイルが自動生成されないので要注意。
  • fly secrets listコマンドにより現時点でセットされている環境変数を確認できます。
  • 手動で環境変数をセットしたい場合はfly secrets setコマンドが使えます。
fly secrets set SECRET_KEY_BASE=$(mix phx.gen.secret)
Enter fullscreen mode Exit fullscreen mode

CleanShot 2022-05-08 at 16 22 26

npm: not found

CleanShot 2022-05-08 at 10 37 51@2x

Command: /app/bin/migrateでエラー

  • 何らかの原因でlib/app_name/release.exが生成されなかった可能性あり。
  • fly launchコマンドの実行中にDockerfileが検知されると必要なファイルが自動生成されないので要注意。
  • mix phx.gen.release --ectoコマンドを打ったら解決する場合あり。

No such file or directory

mix assets.deployでエラー

Note: The stand-alone Tailwind client bundles first-class tailwind packages within the precompiled executable. For third-party Tailwind plugin support, the node package must be used. See the tailwind nodejs installation instructions if you require third-party plugin support.

CleanShot 2022-04-23 at 12 20 53@2x

LiveViewがイゴかない

  • config/runtime.exscheck_originを設定。
    • falseもしくは全てのデプロイ対象のドメイン名をリストする。
check_origin: false
Enter fullscreen mode Exit fullscreen mode
check_origin: [
  "//hello.fly.dev",
  "//hello.mnishiguchi.com"
]
Enter fullscreen mode Exit fullscreen mode

Elixirコミュニティに初めて接する方は下記がオススメです

Elixirコミュニティ の歩き方 -国内オンライン編-

https://speakerdeck.com/elijo/elixirkomiyunitei-falsebu-kifang-guo-nei-onrainbian

image.png

日本には28箇所のElixirコミュニティがあります

image.png

日程からイベントを探すならElixirイベントカレンダー📆

** Elixirイベントカレンダー **

https://elixir-jp-calendar.fly.dev/

image.png

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs