burrito-elixir / burrito

Wrap your application in a BEAM Burrito!
MIT License
864 stars 31 forks source link

Phoenix with burrito: Error when calling MFA defined by measurement #116

Open relax2code opened 8 months ago

relax2code commented 8 months ago

Hi , first I want to thank you for making this, it's very helpful for deploying elixir app. I have some issue with burrito releasing phoenix , the app successfully build and running , but it has error printed out :

 [error] Error when calling MFA defined by measurement: :telemetry_poller_builtin :memory []
Class=:error
Reason=:notsup
Stacktrace=[
  {:erlang, :memory, 0, []},
  {:telemetry_poller_builtin, :memory, 0,
   [
     file: ~c".../deps/telemetry_poller/src/telemetry_poller_builtin.erl",
     line: 24
   ]},
  {:telemetry_poller, :make_measurement, 1,
   [
     file: ~c".../deps/telemetry_poller/src/telemetry_poller.erl",
     line: 322
   ]},
  {:telemetry_poller, :"-make_measurements_and_filter_misbehaving/1-lc$^0/1-0-",
   1,
   [
     file: ~c".../deps/telemetry_poller/src/telemetry_poller.erl",
     line: 318
   ]},
  {:telemetry_poller, :handle_info, 2,
   [
     file: ~c".../deps/telemetry_poller/src/telemetry_poller.erl",
     line: 340
   ]},
  {:gen_server, :try_handle_info, 3, [file: ~c"gen_server.erl", line: 1077]},
  {:gen_server, :handle_msg, 6, [file: ~c"gen_server.erl", line: 1165]},
  {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 241]}
]

Elixir: 1.15.5 Erlang: 26.0.2 Phoenix: ~> 1.7.9

mix.exs

  def application do
    [
      mod: {MyApp.Application, []},
      extra_applications: [:logger, :runtime_tools]
    ]
  end
...

  defp releases() do
    [
      my_app: [
        steps: [:assemble, &Burrito.wrap/1],
        burrito: [
          targets: [
            linux: [os: :linux, cpu: :x86_64]
          ]
        ]
      ]
    ]

Is there any settings that I missed ? Thank you

doawoo commented 8 months ago

Hm, I'm going to have to build an example app that matches your setup to debug this, that error isn't directing me to anything specific at the moment.

I'll try to build a test app in a little bit and see if I can get it to behave in a similar manner.

relax2code commented 8 months ago

Thank you very much

doawoo commented 8 months ago

Are you building this app with your MIX_ENV set to prod? or is it set to dev?

relax2code commented 8 months ago

Sorry, I set it to prod, btw I'm using linux mint 21 (ubuntu 22 based) , here is my steps to release:

 MIX_ENV=prod  mix assets.deploy
 mix phx.digest
 MIX_ENV=prod mix release

prod.exs :

 import Config
config :pg_panel, PgPanelWeb.Endpoint, cache_static_manifest: "priv/static/cache_manifest.json"
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: PgPanel.Finch
config :swoosh, local: false
config :logger, level: :info

runtime.exs :

import Config
if System.get_env("PHX_SERVER") do
  config :pg_panel, PgPanelWeb.Endpoint, server: true
end

if config_env() == :prod do
  database_path =
    System.get_env("DATABASE_PATH") ||
      raise """
      environment variable DATABASE_PATH is missing.
      For example: /etc/pg_panel/pg_panel.db
      """

  config :pg_panel, PgPanel.Repo,
    database: database_path,
    pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5")

  secret_key_base =
    System.get_env("SECRET_KEY_BASE") ||
      raise """
      environment variable SECRET_KEY_BASE is missing.
      You can generate one by calling: mix phx.gen.secret
      """

  host = System.get_env("PHX_HOST") || "example.com"
  port = String.to_integer(System.get_env("PORT") || "4000")

  config :pg_panel, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")

  config :pg_panel, PgPanelWeb.Endpoint,
    url: [host: host, port: 443, scheme: "https"],
    http: [

      ip: {0, 0, 0, 0, 0, 0, 0, 0},
      port: port
    ],
    secret_key_base: secret_key_base
end