bitwalker / exrm

Automatically generate a release for your Elixir project!
MIT License
922 stars 110 forks source link

Task release not found when run with MIX_ENV=prod #273

Closed edyu closed 8 years ago

edyu commented 8 years ago

This is on Ubuntu 15.10. Somehow I can run mix release but if I run it with "MIX_ENV=prod mix release", I would get the error: \ (Mix) The task release could not be found

edyu commented 8 years ago

I tried both setting the environment variable and exporting it and just prepend MIX_ENV=prod to "mix release".

edyu commented 8 years ago

I have no problem running "MIX_ENV=prod mix dep.get" or "MIX_ENV=prod mix compile".

vadim-ex commented 8 years ago

Is there any way to see your project files, like mix.exs for the project?

edyu commented 8 years ago
defmodule Nestweb.Mixfile do
  use Mix.Project

  def project do
    [app: :nestweb,
     version: "0.0.1",
     elixir: "~> 1.0",
     elixirc_paths: elixirc_paths(Mix.env),
     compilers: [:phoenix] ++ Mix.compilers,
     build_embedded: Mix.env == :prod,
     start_permanent: Mix.env == :prod,
     aliases: aliases,
     deps: deps]
  end

  # Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [mod: {Nestweb, []},
     applications: [:phoenix, :phoenix_html, :cowboy, :logger,
                    :phoenix_ecto, :mariaex, :httpoison]]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "web", "test/support"]
  defp elixirc_paths(_),     do: ["lib", "web"]

  # Specifies your project dependencies.
  #
  # Type `mix help deps` for examples and options.
  defp deps do
    [{:phoenix, "~> 1.1"},
     {:phoenix_ecto, "~> 2.0"},
     {:mariaex, ">= 0.0.0"},
     {:phoenix_html, "~> 2.3"},
     {:phoenix_live_reload, "~> 1.0", only: :dev},
     {:httpoison, "~> 0.8.0"},
     {:poison, "~> 1.5"},
     {:cowboy, "~> 1.0"},
     {:exrm, "~> 1.0.0-rc7"}]
  end

  # Aliases are shortcut or tasks specific to the current project.
  # For example, to create, migrate and run the seeds file at once:
  #
  #     $ mix ecto.setup
  #
  # See the documentation for `Mix` for more info on aliases.
  defp aliases do
    ["ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
     "ecto.reset": ["ecto.drop", "ecto.setup"]]
  end
end
vadim-ex commented 8 years ago

Thank you!

Can you check whether MIX_ENV=prod mix release --verbosity=verbose provides helpful information?

bitwalker commented 8 years ago

@edyu You have to compile the project with MIX_ENV=prod before you can use the task in that environment. Could you give that a try?

edyu commented 8 years ago

@vadim-moz same error @bitwalker yes i have and that completed but same error when I do MIX_ENV=prod mix release

bitwalker commented 8 years ago

I have to say I'm not sure there's much I can do about this one, the error is coming from Mix itself being unable to find the release task, and if you've run MIX_ENV=prod do deps.get, deps.compile, compile before running MIX_ENV=prod mix release and it's still not working, I'm at a loss as to how that could be. You could try adding exrm as a git dependency instead just to see if that works, but the hex package has been working fine for myself and others now for some time.

What version of Erlang and Elixir by the way?

vadim-ex commented 8 years ago

Can you try to delete all _build directories in your project? I've see mix being confused sometimes. (My guess is, erlang uses file timestamps rounded to 1 second, and sometimes change is not detected properly.)

bitwalker commented 8 years ago

Might be worth deleting deps and re-running mix deps.get as well.

edyu commented 8 years ago

@bitwalker %uname -a Linux 4.2.0-23-generic #28-Ubuntu SMP Sun Dec 27 17:47:31 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

%erl -version Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 7.0

%elixir --version Elixir 1.1.0-dev

edyu commented 8 years ago

$ ls brunch-config.js _build config deps lib mix.exs mix.lock node_modules package.json priv README.md rel test web $ rm -rf _build $ find . -name "_build" $ ls brunch-config.js config deps lib mix.exs mix.lock node_modules package.json priv README.md rel test web $ rm -rf deps

edyu commented 8 years ago

$ MIX_ENV=prod mix deps.get Hex was built against against Elixir v1.0.5 and you are running v1.1.0-dev, please run mix local.hex to update to a matching version Running dependency resolution

edyu commented 8 years ago

$ MIX_ENV=prod mix deps.compile ==> connection Compiled lib/connection.ex Generated connection app ==> poolboy (compile) Compiled src/poolboy_worker.erl Compiled src/poolboy_sup.erl Compiled src/poolboy.erl lib/decimal.ex:356: warning: variable coef is unused lib/decimal.ex:357: warning: variable adjust is unused lib/decimal.ex:358: warning: variable signals is unused ==> decimal Compiled lib/decimal.ex Generated decimal app ==> idna (compile) Compiled src/idna.erl Compiled src/idna_ucs.erl Compiled src/idna_unicode_data.erl Compiled src/punycode.erl Compiled src/idna_unicode.erl Compiled src/idna_unicode_data1.erl Compiled src/idna_unicode_data2.erl ==> ssl_verify_hostname (compile) Compiled src/ssl_verify_hostname.erl ==> poison Compiled lib/poison.ex Compiled lib/poison/decoder.ex Compiled lib/poison/parser.ex Compiled lib/poison/encoder.ex Generated poison app ==> getopt (compile) Compiled src/getopt.erl ==> providers (compile) Compiled src/provider.erl Compiled src/providers_topo.erl Compiled src/providers.erl ==> mimerl (compile) Compiled src/mimerl.erl ==> erlware_commons (compile) Compiled src/ec_dictionary.erl Compiled src/ec_vsn.erl Compiled src/ec_semver.erl Compiled src/ec_plists.erl Compiled src/ec_compile.erl Compiled src/ec_semver_parser.erl Compiled src/ec_file.erl Compiled src/ec_date.erl Compiled src/ec_lists.erl Compiled src/ec_orddict.erl Compiled src/ec_dict.erl Compiled src/ec_assoc_list.erl Compiled src/ec_cmd_log.erl Compiled src/ec_talk.erl Compiled src/ec_gb_trees.erl Compiled src/ec_cnv.erl Compiled src/ec_rbdict.erl Compiled src/ec_git_vsn.erl ==> ranch (compile) Compiled src/ranch_transport.erl Compiled src/ranch_app.erl Compiled src/ranch_acceptor.erl Compiled src/ranch.erl Compiled src/ranch_server.erl Compiled src/ranch_acceptors_sup.erl Compiled src/ranch_tcp.erl Compiled src/ranch_ssl.erl Compiled src/ranch_protocol.erl Compiled src/ranch_listener_sup.erl Compiled src/ranch_sup.erl Compiled src/ranch_conns_sup.erl ==> bbmustache (compile) Compiled src/bbmustache.erl ==> relx (compile) Compiled src/rlx_util.erl Compiled src/rlx_depsolver_culprit.erl Compiled src/rlx_goal.erl Compiled src/rlx_dscv_util.erl Compiled src/rlx_goal_utils.erl Compiled src/relx.erl Compiled src/rlx_rel_discovery.erl Compiled src/rlx_topo.erl Compiled src/rlx_app_discovery.erl Compiled src/rlx_prv_rel_discover.erl Compiled src/rlx_app_info.erl Compiled src/rlx_prv_archive.erl Compiled src/rlx_prv_app_discover.erl Compiled src/rlx_release.erl Compiled src/rlx_prv_relup.erl Compiled src/rlx_depsolver.erl Compiled src/rlx_config.erl Compiled src/rlx_prv_overlay.erl Compiled src/rlx_prv_release.erl Compiled src/rlx_cmd_args.erl Compiled src/rlx_state.erl Compiled src/rlx_prv_assembler.erl ==> exrm Compiled lib/exrm/config.ex Compiled lib/exrm/plugin.ex Compiled lib/exrm/deps.ex Compiled lib/exrm/utils/logger.ex Compiled lib/exrm/plugins/appups.ex Compiled lib/exrm/utils/utils.ex Compiled lib/mix/tasks/release.plugins.ex Compiled lib/mix/tasks/release.clean.ex Compiled lib/exrm/plugins/consolidation.ex Compiled lib/exrm/appups.ex Compiled lib/mix/tasks/release.ex Generated exrm app ==> certifi (compile) Compiled src/certifi.erl Compiled src/certifi_weak.erl Compiled src/certifi_cacerts.erl ==> hackney (compile) Compiled src/hackney_app.erl Compiled src/hackney_manager.erl Compiled src/hackney.erl Compiled src/http/hackney_cookie.erl Compiled src/http/hackney_multipart.erl Compiled src/http/hackney_headers.erl Compiled src/http/hackney_request.erl Compiled src/http/hackney_url.erl Compiled src/http/hackney_date.erl Compiled src/http/hackney_response.erl Compiled src/http/hackney_bstr.erl Compiled src/http/hackney_http.erl Compiled src/hackney_sup.erl Compiled src/metrics/hackney_dummy_metrics.erl Compiled src/hackney_util.erl Compiled src/hackney_trace.erl Compiled src/metrics/hackney_folsom_metrics.erl Compiled src/metrics/hackney_exometer_metrics.erl Compiled src/socket/hackney_tcp_transport.erl Compiled src/socket/hackney_ssl_transport.erl Compiled src/socket/hackney_socks5.erl Compiled src/hackney_stream.erl Compiled src/socket/hackney_pool_handler.erl Compiled src/socket/hackney_http_connect.erl Compiled src/socket/hackney_pool.erl Compiled src/socket/hackney_connect.erl ==> mariaex Compiled lib/mariaex/cache.ex Compiled lib/mariaex/coder.ex Compiled lib/mariaex/connection/tcp.ex Compiled lib/mariaex/structs.ex Compiled lib/mariaex/connection.ex lib/mariaex/messages.ex:269: warning: variable body is unused Compiled lib/mariaex/messages.ex Compiled lib/mariaex/protocol.ex Generated mariaex app ==> ecto Compiled lib/ecto/adapter.ex Compiled lib/ecto/adapter/storage.ex Compiled lib/ecto/adapter/migration.ex Compiled lib/ecto/adapter/transaction.ex Compiled lib/ecto/adapters/connection.ex Compiled lib/ecto/adapters/postgres/connection.ex Compiled lib/ecto/adapters/postgres/datetime.ex Compiled lib/ecto/adapters/sql/query.ex Compiled lib/ecto/application.ex Compiled lib/ecto/data_type.ex Compiled lib/ecto/migration.ex Compiled lib/ecto/migration/runner.ex Compiled lib/ecto/exceptions.ex Compiled lib/ecto/migration/supervisor.ex Compiled lib/ecto/model.ex Compiled lib/ecto/migrator.ex Compiled lib/ecto/model/callbacks.ex Compiled lib/ecto/model/optimistic_lock.ex Compiled lib/ecto/pool.ex Compiled lib/ecto/poison.ex Compiled lib/ecto/pools/poolboy.ex Compiled lib/ecto/pools/poolboy/worker.ex Compiled lib/ecto/pools/sojourn_broker.ex Compiled lib/ecto/pools/sojourn_broker/codel.ex Compiled lib/ecto/pools/sojourn_broker/timeout.ex Compiled lib/ecto/pools/sojourn_broker/worker.ex Compiled lib/ecto/query/api.ex Compiled lib/ecto/adapters/sql.ex Compiled lib/ecto/query.ex Compiled lib/ecto/adapters/postgres.ex Compiled lib/ecto/changeset/relation.ex Compiled lib/ecto/embedded.ex Compiled lib/ecto.ex Compiled lib/ecto/adapters/mysql.ex Compiled lib/ecto/log_entry.ex Compiled lib/ecto/adapters/sql/sandbox.ex Compiled lib/ecto/adapters/mysql/connection.ex Compiled lib/ecto/query/builder/distinct.ex Compiled lib/ecto/query/builder.ex Compiled lib/ecto/query/builder/filter.ex Compiled lib/ecto/query/builder/from.ex Compiled lib/ecto/query/builder/group_by.ex Compiled lib/ecto/query/builder/limit_offset.ex Compiled lib/ecto/query/builder/join.ex Compiled lib/ecto/query/builder/lock.ex Compiled lib/ecto/query/builder/order_by.ex Compiled lib/ecto/query/builder/preload.ex Compiled lib/ecto/query/builder/select.ex Compiled lib/ecto/query/builder/update.ex Compiled lib/ecto/query/inspect.ex Compiled lib/ecto/query/planner.ex Compiled lib/ecto/queryable.ex Compiled lib/ecto/repo/assoc.ex Compiled lib/ecto/repo.ex Compiled lib/ecto/repo/preloader.ex Compiled lib/ecto/repo/supervisor.ex Compiled lib/ecto/repo/schema.ex Compiled lib/ecto/storage.ex Compiled lib/ecto/schema.ex Compiled lib/ecto/type.ex Compiled lib/ecto/repo/queryable.ex Compiled lib/ecto/association.ex Compiled lib/ecto/uuid.ex Compiled lib/ecto/changeset.ex Compiled lib/mix/ecto.ex Compiled lib/mix/tasks/ecto.create.ex Compiled lib/mix/tasks/ecto.drop.ex Compiled lib/mix/tasks/ecto.gen.migration.ex Compiled lib/mix/tasks/ecto.gen.repo.ex Compiled lib/ecto/migration/schema_migration.ex Compiled lib/mix/tasks/ecto.migrate.ex Compiled lib/mix/tasks/ecto.rollback.ex Compiled lib/ecto/date_time.ex Generated ecto app ==> httpoison Compiled lib/httpoison/base.ex Compiled lib/httpoison.ex Generated httpoison app ==> cowlib (compile) Compiled src/cow_http_te.erl Compiled src/cow_http.erl Compiled src/cow_qs.erl Compiled src/cow_cookie.erl Compiled src/cow_http_hd.erl Compiled src/cow_date.erl Compiled src/cow_spdy.erl Compiled src/cow_multipart.erl Compiled src/cow_mimetypes.erl ==> cowboy (compile) Compiled src/cowboy_middleware.erl Compiled src/cowboy_sub_protocol.erl Compiled src/cowboy_app.erl Compiled src/cowboy.erl Compiled src/cowboy_router.erl Compiled src/cowboy_spdy.erl Compiled src/cowboy_bstr.erl Compiled src/cowboy_http.erl Compiled src/cowboy_websocket_handler.erl Compiled src/cowboy_handler.erl Compiled src/cowboy_http_handler.erl Compiled src/cowboy_loop_handler.erl Compiled src/cowboy_sup.erl Compiled src/cowboy_static.erl Compiled src/cowboy_websocket.erl Compiled src/cowboy_protocol.erl Compiled src/cowboy_clock.erl Compiled src/cowboy_rest.erl Compiled src/cowboy_req.erl ==> plug Compiled lib/plug.ex Compiled lib/plug/adapters/cowboy.ex Compiled lib/plug/builder.ex Compiled lib/plug/conn/adapter.ex Compiled lib/plug/conn/cookies.ex Compiled lib/plug/conn/status.ex Compiled lib/plug/conn/query.ex Compiled lib/plug/conn/unfetched.ex Compiled lib/plug/conn/utils.ex Compiled lib/plug/conn/wrapper_error.ex Compiled lib/plug/adapters/test/conn.ex Compiled lib/plug/adapters/translator.ex Compiled lib/plug/adapters/cowboy/handler.ex Compiled lib/plug/crypto.ex Compiled lib/plug/crypto/key_generator.ex Compiled lib/plug/crypto/message_encryptor.ex Compiled lib/plug/crypto/message_verifier.ex Compiled lib/plug/conn.ex Compiled lib/plug/csrf_protection.ex Compiled lib/plug/error_handler.ex Compiled lib/plug/debugger.ex Compiled lib/plug/head.ex Compiled lib/plug/html.ex Compiled lib/plug/logger.ex Compiled lib/plug/exceptions.ex Compiled lib/plug/method_override.ex Compiled lib/plug/parsers.ex Compiled lib/plug/parsers/json.ex Compiled lib/plug/parsers/urlencoded.ex Compiled lib/plug/request_id.ex Compiled lib/plug/router.ex Compiled lib/plug/router/utils.ex Compiled lib/plug/session.ex Compiled lib/plug/session/store.ex Compiled lib/plug/session/ets.ex Compiled lib/plug/session/cookie.ex Compiled lib/plug/ssl.ex Compiled lib/plug/mime.ex Compiled lib/plug/supervisor.ex Compiled lib/plug/test.ex Compiled lib/plug/static.ex Compiled lib/plug/parsers/multipart.ex Compiled lib/plug/adapters/cowboy/conn.ex Compiled lib/plug/upload.ex Generated plug app ==> phoenix_html Compiled lib/phoenix_html/engine.ex Compiled lib/phoenix_html.ex Compiled lib/phoenix_html/format.ex Compiled lib/phoenix_html/tag.ex Compiled lib/phoenix_html/link.ex Compiled lib/phoenix_html/safe.ex Compiled lib/phoenix_html/form_data.ex Compiled lib/phoenix_html/form.ex Generated phoenix_html app ==> phoenix warning: the dependency phoenix requires Elixir "~> 1.0.2 or ~> 1.1" but you are running on v1.1.0-dev Compiled lib/mix/tasks/compile.phoenix.ex Compiled lib/mix/tasks/phoenix.digest.ex Compiled lib/mix/phoenix.ex Compiled lib/mix/tasks/phoenix.gen.channel.ex Compiled lib/mix/tasks/phoenix.gen.json.ex Compiled lib/mix/tasks/phoenix.gen.html.ex Compiled lib/mix/tasks/phoenix.gen.secret.ex Compiled lib/mix/tasks/phoenix.routes.ex Compiled lib/mix/tasks/phoenix.server.ex Compiled lib/mix/tasks/phoenix.gen.model.ex Compiled lib/phoenix.ex Compiled lib/phoenix/code_reloader/proxy.ex Compiled lib/phoenix/code_reloader.ex Compiled lib/phoenix/code_reloader/server.ex Compiled lib/phoenix/config.ex Compiled lib/phoenix/controller/pipeline.ex Compiled lib/phoenix/digester.ex Compiled lib/phoenix/endpoint.ex Compiled lib/phoenix/endpoint/adapter.ex Compiled lib/phoenix/endpoint/cowboy_websocket.ex Compiled lib/phoenix/endpoint/handler.ex Compiled lib/phoenix/endpoint/cowboy_handler.ex Compiled lib/phoenix/endpoint/instrument.ex Compiled lib/phoenix/endpoint/server.ex Compiled lib/phoenix/endpoint/watcher.ex Compiled lib/phoenix/naming.ex Compiled lib/phoenix/exceptions.ex Compiled lib/phoenix/pubsub.ex Compiled lib/phoenix/pubsub/gc.ex Compiled lib/phoenix/param.ex Compiled lib/phoenix/pubsub/pg2.ex Compiled lib/phoenix/pubsub/local_supervisor.ex Compiled lib/phoenix/pubsub/pg2_server.ex Compiled lib/phoenix/router.ex Compiled lib/phoenix/router/resource.ex Compiled lib/phoenix/router/scope.ex Compiled lib/phoenix/router/route.ex Compiled lib/phoenix/router/console_formatter.ex Compiled lib/phoenix/socket/message.ex Compiled lib/phoenix/pubsub/local.ex Compiled lib/phoenix/socket.ex Compiled lib/phoenix/router/helpers.ex Compiled lib/phoenix/channel.ex Compiled lib/phoenix/controller.ex Compiled lib/phoenix/channel/server.ex Compiled lib/phoenix/endpoint/render_errors.ex Compiled lib/phoenix/controller/logger.ex Compiled lib/phoenix/supervisor.ex Compiled lib/phoenix/socket/transport.ex Compiled lib/phoenix/template.ex Compiled lib/phoenix/template/engine.ex Compiled lib/phoenix/template/eex_engine.ex Compiled lib/phoenix/template/exs_engine.ex Compiled lib/phoenix/template/html.ex Compiled lib/phoenix/token.ex Compiled lib/phoenix/transports/long_poll.ex Compiled lib/phoenix/test/conn_test.ex Compiled lib/phoenix/transports/serializer.ex Compiled lib/phoenix/transports/long_poll_serializer.ex Compiled lib/phoenix/test/channel_test.ex Compiled lib/phoenix/transports/long_poll_server.ex Compiled lib/phoenix/transports/websocket_serializer.ex Compiled lib/phoenix/transports/websocket.ex Compiled lib/phoenix/view.ex Generated phoenix app ==> phoenix_ecto Compiled lib/phoenix_ecto.ex Compiled lib/phoenix_ecto/json.ex Compiled lib/phoenix_ecto/plug.ex Compiled lib/phoenix_ecto/html.ex Generated phoenix_ecto app

edyu commented 8 years ago

$ MIX_ENV=prod mix compile Compiled lib/nestweb.ex Compiled lib/nestweb/models.ex Compiled lib/nestweb/loudnest.ex Compiled lib/nestweb/repo.ex Compiled web/channels/user_socket.ex Compiled web/web.ex Compiled web/controllers/elm_controller.ex Compiled web/router.ex Compiled web/controllers/page_controller.ex Compiled web/views/elm_view.ex Compiled lib/nestweb/endpoint.ex Compiled web/views/error_view.ex Compiled web/views/layout_view.ex Compiled web/views/page_view.ex Generated nestweb app Consolidated Poison.Decoder Consolidated Poison.Encoder Consolidated Plug.Exception Consolidated Phoenix.HTML.FormData Consolidated Phoenix.HTML.Safe Consolidated Phoenix.Param Consolidated Ecto.Queryable Consolidated Ecto.DataType Consolidated List.Chars Consolidated Inspect Consolidated Range.Iterator Consolidated Collectable Consolidated Enumerable Consolidated String.Chars Consolidated Access Consolidated protocols written to _build/prod/consolidated

edyu commented 8 years ago

@vadim-moz @bitwalker $ MIX_ENV=prod mix release --verbosity=verbose \ (Mix) The task release could not be found

edyu commented 8 years ago

I'm going to start another fresh ubuntu 15.10 box and install erlang and elixir and start from scratch to see if I get a different result too.

bitwalker commented 8 years ago

@edyu You got a warning about the wrong version of hex being used in the output up there, can you run mix local.hex --force to install the latest version of hex, then rm -rf deps && mix do deps.get, deps.compile, compile once more?

edyu commented 8 years ago

So...I think it could be a combination of the versions that I use erlang 7.0 and elixir 1.1.0-dev. I now have completely blown away those deb packages and instead installed esl-erlang 7.2 and elixir 1.2.0 and surprise, MIX_ENV=prod mix release NOW works!

@bitwalker @vadim-moz thank you for your help. Since those are all old versions of erlang and elixir, I don't think this is a bug for exrm then. I'm closing this. Thank you again!

bitwalker commented 8 years ago

@edyu Glad a fresh install fixed it! I wouldn't classify Elixir 1.1 as old by any means, since 1.2 just came out, but since it was a -dev release, there might have been some bugs. ERTS 7.0 is Erlang 18.0 just for future reference :)

bluetwin commented 7 years ago

If anyone is still having this issue, I was able to solve it by adding distillery to the deps in mix.exs. Somehow exrm was not included (its being replaced)

defp deps do
    [...
     {:distillery, "~> 1.0"}]
end

distillery - A pure Elixir implementation of release packaging functionality for the Erlang VM

jaysson commented 6 years ago

Still facing the same issue. Added distillery, on elixir 1.6.1, but it didn't help.