LoginSignup
4
0

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

Last updated at Posted at 2022-05-09

まずは

  • 落ち着いてエラーメッセージを読んで魚拓も取っておく
  • 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)

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
check_origin: [
  "//hello.fly.dev",
  "//hello.mnishiguchi.com"
]

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

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

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

image.png

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

image.png

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

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

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

image.png

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0