Elixir dependency :AMQP not found in an umbrella project when building with edeliver (+ distillery)

419 Views Asked by At

I have an umbrella project that has only one simple app with a dependency for amqp at the moment. Everything works fine locally but when I try build it with "mix edeliver build release" I get ":AMQP not found" when it is trying to compile my code.

When I go to the build host and compile the app manually it works fine there also. Also I can see from edeliver debug log that fetching the dependencies worked just fine.

I am suspecting that edeliver fails because this is an umbrella project. Going to try this without umbrella next but I'd like to get this working with umbrella project of course.

The error looks like this:

Compiling 2 files (.ex)

== Compilation error on file lib/heartbeat_consumer.ex == ** (CompileError) lib/heartbeat_consumer.ex:3: module AMQP is not loaded and could not be found (elixir) expanding macro: Kernel.use/1 lib/heartbeat_consumer.ex:3: HeartBeatConsumer (module) (elixir) lib/kernel/parallel_compiler.ex:116: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1

Output of the command is shown above and the command executed on that host is printed below for debugging purposes:

FAILED with exit status 1:\n [ -f ~/.profile ] && source ~/.profile set -e cd /tmp/edeliver/myapp/builds if [ "mix" = "rebar" ]; then echo "using rebar to compile files" [[ "" != "true" ]] && ./rebar clean skip_deps=true || : ./rebar compile elif [ "mix" = "mix" ] && [ "mix" = "mix" ]; then echo "Checking whether deps must be compiled for mix version 1.3.0" # see https://github.com/boldpoker/edeliver/issues/94 if mix --version | grep '\''Mix 1.3.0'\'' >/dev/null 2>&1 ; then echo "Compiling deps because mix version 1.3.0 is used" APP="abotti_server" MIX_ENV="prod" mix deps.compile fi if [[ "" = "true" ]]; then APP="abotti_server" MIX_ENV="prod" AUTO_VERSION="" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" mix do compile else APP="abotti_server" MIX_ENV="prod" AUTO_VERSION="" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" mix do clean, compile fi elif [ "mix" = "mix" ]; then echo "using mix to compile files" if [[ "" = "true" ]]; then if [[ -n "" ]]; then hint_message '\''Using --auto-version together with --skip-mix-clean would not work!'\'' fi APP="abotti_server" MIX_ENV="prod" AUTO_VERSION="" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" mix do deps.compile, compile else APP="abotti_server" MIX_ENV="prod" AUTO_VERSION="" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" mix do clean, deps.compile, compile fi fi \n'

and my apps mix.exs is like this:

defmodule AbottiServer.Mixfile do
  use Mix.Project

  def project do
    [app: :abotti_server,
     version: "0.1.0",
     build_path: "../../_build",
     config_path: "../../config/config.exs",
     deps_path: "../../deps",
     lockfile: "../../mix.lock",
     elixir: "~> 1.3",
     build_embedded: Mix.env == :prod,
     start_permanent: Mix.env == :prod,
     deps: deps]
  end

  # Configuration for the OTP application
  #
  # Type "mix help compile.app" for more information
  def application do
    [applications: [:logger, :amqp, :edeliver],
     mod: {AbottiServer, []}]
  end

  # Dependencies can be Hex packages:
  #
  #   {:mydep, "~> 0.3.0"}
  #
  # Or git/path repositories:
  #
  #   {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
  #
  # To depend on another app inside the umbrella:
  #
  #   {:myapp, in_umbrella: true}
  #
  # Type "mix help deps" for more examples and options
  defp deps do
    [
      {:amqp_client, git: "https://github.com/dsrosario/amqp_client.git", branch: "erlang_otp_19", override: true},
      {:amqp, "~> 0.1.4"},
      {:edeliver, "~> 1.4.0"},
      {:distillery, ">= 0.8.0", warn_missing: false}
  ]
  end
end

After battling with this for quite a bit now, I realized that theres a myriad of problems going on here.

  1. Clean up doesn't really work which is causing the :AMQP not found error. Remedied temporarily by --skip-mix-clean switch.
  2. After that edeliver complains that it cannot decide if it should use exrm or distillery. Ok so, I did mix release.init at the umbrella project root. Also moved .deliver folder to the root of the umbrella project added edeliver and distillery deps to root mix.exs. (I have no idea if thats right or not). Tested with mix release and yes, distillery build works locally.
  3. Compiling still did not work on build host: amqp would not compile. Added {:amqp_client, git: "https://github.com/dsrosario/amqp_client.git", branch: "erlang_otp_19", override: true} to deps for the app that is using amqp. That worked, compile now works on build host which has erlang 19.
  4. Now I get: failed to detect generated release version at: /tmp/edeliver/abotti/builds/apps/abotti/rel/abotti/releases/ which I guess means that my RELEASE_DIR is incorrect with my config in .deliver folder.

Ok to sum it up after I did everything what edeliver wiki says to do for an umbrella project here, still cleanup and release dir problems remain. I can only get edeliver to compile with --skip-mix-clean and I've tried numerous adjustments to RELEASE_DIR but I always get the "failed to detect release version error".

Any help would be much appreciated.

0

There are 0 best solutions below