I’m trying to deploy to production using edeliver on my Macbook Pro. However, when I try mix edeliver build release I get:
== Compilation error in file lib/haaksploits/repo.ex ==
** (ArgumentError) missing :adapter configuration in config :haaksploits, Haaksploits.Repo
lib/ecto/repo/supervisor.ex:69: Ecto.Repo.Supervisor.compile_config/2
lib/haaksploits/repo.ex:2: (module)
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
A remote command failed on:
lbdbus@haaksploits.com
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:
[ -f ~/.profile ] && source ~/.profile
set -e
cd /home/lbdbus/app_build
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.[01234]"
# see https://github.com/boldpoker/edeliver/issues/94
if mix --version | grep 'Mix 1.3.[01234]' >/dev/null 2>&1 ; then
echo "Compiling deps because mix version 1.3.[01234] is used"
APP="haaweb" MIX_ENV="prod" mix deps.compile
fi
if [[ "" = "true" ]]; then
APP="haaweb" MIX_ENV="prod" AUTO_VERSION="" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix do compile
else
APP="haaweb" MIX_ENV="prod" AUTO_VERSION="" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" 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="haaweb" MIX_ENV="prod" AUTO_VERSION="" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix do deps.compile, compile
else
APP="haaweb" MIX_ENV="prod" AUTO_VERSION="" BRANCH="master" SKIP_RELUP_MODIFICATIONS="" RELUP_MODIFICATION_MODULE="" USING_DISTILLERY="true" mix do clean, deps.compile, compile
fi
fi
My repo.ex looks like this:
defmodule Haaksploits.Repo do
use Ecto.Repo, otp_app: :haaksploits
@doc """
Dynamically loads the repository url from the
DATABASE_URL environment variable.
"""
def init(_, opts) do
{:ok, Keyword.put(opts, :url, System.get_env("DATABASE_URL"))}
end
end
use Mix.Config
# For production, we often load configuration from external
# sources, such as your system environment. For this reason,
# you won't find the :http configuration below, but set inside
# HaaksploitsWeb.Endpoint.init/2 when load_from_system_env is
# true. Any dynamic configuration should be done there.
#
# Don't forget to configure the url host to something meaningful,
# Phoenix uses this information when generating URLs.
#
# Finally, we also include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the mix phx.digest task
# which you typically run after static files are built.
config :haaksploits, HaaksploitsWeb.Endpoint,
load_from_system_env: true,
url: [host: "haaksploits.com", port: 4000],
cache_static_manifest: "priv/static/cache_manifest.json"
# Do not print debug messages in production
config :logger, level: :info
# ## SSL Support
#
# To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443:
#
# config :haaksploits, HaaksploitsWeb.Endpoint,
# ...
# url: [host: "example.com", port: 443],
# https: [:inet6,
# port: 443,
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")]
#
# Where those two env variables return an absolute path to
# the key and cert in disk or a relative path inside priv,
# for example "priv/ssl/server.key".
#
# We also recommend setting `force_ssl`, ensuring no data is
# ever sent via http, always redirecting to https:
#
# config :haaksploits, HaaksploitsWeb.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.
# ## Using releases
# If you are doing OTP releases, you need to instruct Phoenix
# to start the server for all endpoints:
#
# config :phoenix, :serve_endpoints, true
#
# Alternatively, you can configure exactly which server to
# start per endpoint:
config :haaksploits, HaaksploitsWeb.Endpoint, server: true
# Finally import the config/prod.secret.exs
# which should be versioned separately.
import_config "prod.secret.exs"
I also tried with port set to 80 and with the releases line commented out.
Hi and thanks for responding after our conversation on GitHub. I think just from looking at the file I can already see the problem, but I’ll be sure to update you as to whether the issue was there.
Unfortunately the thing I thought was the problem doesn’t seem to be. Code in prod.secret.exs is:
use Mix.Config
# In this file, we keep production configuration that
# you'll likely want to automate and keep away from
# your version control system.
#
# You should document the content of this
# file or create a script for recreating it, since it's
# kept out of version control and might be hard to recover
# or recreate for your teammates (or yourself later on).
config :haaksploits, Haaksploits.Endpoint,
secret_key_base: "randomhashandnumbers"
That is the problem in a different form though, you have no adapter set in either the prod.exs file nor in any imported file into it.
Just copy the declaration from your dev.exs or so into, say, your prod.secret.exs file and edit is as appropriately. Do note, the prod.secret.exs file is not committed to git by default (hence the secret part). ^.^
For note, prod does not include it by default as your adapter for your production system is often quite different than the one for your development. ^.^