bitwalker / distillery

Simplify deployments in Elixir with OTP releases!
MIT License
2.96k stars 396 forks source link

module Mix.Releases.Config is not loaded and could not be found (upgrading 1.5 -> 2.1) #700

Closed raarts closed 4 years ago

raarts commented 4 years ago

Steps to reproduce

I was running mix distillery.release --env=prod

Verbose Logs

mix distillery.release --verbose --env=prod
==> Loading configuration..
** (Distillery.Releases.Config.LoadError) could not load release config rel/config.exs
    ** (CompileError) nofile:9: module Mix.Releases.Config is not loaded and could not be found
    (elixir) expanding macro: Kernel.use/2
    nofile:9: (file)

Description of issue

I am upgrading a year old Phoenix project from Elixir 1.5.1 to 1.9.1 It used distillery 1.5.2, and I did mix deps.update distillery to get to the newest distillery version, because of the release parameter conflict with Elixir 1.9 My rel/config.exs looks like this:

# They can then be used by adding `plugin MyPlugin` to
# either an environment, or release definition, where
# `MyPlugin` is the name of the plugin module.
Path.join(["rel", "plugins", "*.exs"])
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))

use Mix.Releases.Config,
    # This sets the default release built by `mix release`
    default_release: :default,
    # This sets the default environment used by `mix release`
    default_environment: Mix.env()

# For a full list of config options for both releases
# and environments, visit https://hexdocs.pm/distillery/configuration.html

# You may define one or more environments in this file,
# an environment's settings will override those of a release
# when building in that environment, this combination of release
# and environment configuration is called a profile

environment :dev do
  set dev_mode: true
  set include_erts: false
  set cookie: :"******"
end

environment :prod do
  set include_erts: true
  set include_src: false
  set cookie: :"******"
end

# You may define one or more releases in this file.
# If you have not set a default release, or selected one
# when running `mix release`, the first release in the file
# will be used by default

release :app do
  set version: "0.1.0"
  set applications: [
    :runtime_tools,
    myapp: :permanent,
    myapp_web: :permanent
  ]
end
rockneurotiko commented 4 years ago

You need to change use Mix.Releases.Config for use Distillery.Releases.Config 😄

raarts commented 4 years ago

Thanks a lot, this works. Can I ask this described on the Upgrading to 2.x page? Thanks!

RKushnir commented 4 years ago

This seems to be a change in 2.1.x, as it only broke when we updated from 2.0.12 to 2.1.1. And the only mention of this change I could find is this thread.