Ошибка компиляции Phoenix в производстве - PullRequest
0 голосов
/ 26 мая 2018

Я получаю сообщение об ошибке при попытке развернуть мое приложение в рабочей среде. По какой-то причине этап компиляции завершается неудачно:

== Compilation error in file lib/my_app_web/endpoint.ex ==
** (UndefinedFunctionError) function 
Phoenix.Endpoint.Supervisor.config/2 is undefined (module 
Phoenix.Endpoint.Supervisor is not available)
Phoenix.Endpoint.Supervisor.config(:my_app, 
MyAppWeb.Endpoint)
lib/my_app_web/endpoint.ex:2: (module)
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6

Я могу создать его локально (macOS), но не на сервере (ubuntu)

macOS

➜ elixir -v
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.6.4 (compiled with OTP 20)

ubuntu

elixir -v
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]

Elixir 1.6.5 (compiled with OTP 19)

Я замечаю только незначительный патч эликсира и OTP на 19 вместо 20, но с момента его компиляции насервер, я не понимаю, как это будет иметь значение

Вот этот файл

    defmodule MyAppWeb.Endpoint do
    use Phoenix.Endpoint, otp_app: :grounded_warrior

    socket "/socket", MyAppWeb.UserSocket

    # Serve at "/" the static files from "priv/static" directory.
    #
    # You should set gzip to true if you are running phoenix.digest
    # when deploying your static files in production.
    plug Plug.Static,
        at: "/", from: :grounded_warrior, gzip: false,
        only: ~w(dist css fonts images videos js favicon.ico robots.txt)

    plug Plug.Static,
        at: "/uploads", from: Path.expand('./uploads'), gzip: false

    # Code reloading can be explicitly enabled under the
    # :code_reloader configuration of your endpoint.
    if code_reloading? do
        socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
        plug Phoenix.LiveReloader
        plug Phoenix.CodeReloader
    end

    use Appsignal.Phoenix
    plug Plug.RequestId
    plug Plug.Logger

    plug Plug.Parsers,
        parsers: [:urlencoded, :multipart, :"Elixir.MyApp.Plug.Parsers.JSON"],
        copy_on_header: "stripe-signature",
        pass:  ["*/*"],
        json_decoder: Poison

    plug Plug.MethodOverride
    plug Plug.Head

    # The session will be stored in the cookie and signed,
    # this means its contents can be read but not tampered with.
    # Set :encryption_salt if you would also like to encrypt it.
    plug Plug.Session,
        store: :cookie,
        key: "_my_app_key",
        signing_salt: "*****"

    plug Corsica, origins: "*", allow_headers: ["accept", "content-type", "authorization"]
    plug MyAppWeb.Router

    @doc """
    Callback invoked for dynamically configuring the endpoint.

    It receives the endpoint configuration and checks if
    configuration should be loaded from the system environment.
    """
    def init(_key, config) do
        if config[:load_from_system_env] do
        port = System.get_env("PORT") || raise "expected the PORT environment variable to be set"
        {:ok, Keyword.put(config, :http, [:inet6, port: port])}
        else
        {:ok, config}
        end
    end
    end
...