I have been trying to deploy to fly.io using the cli "fly launch" or "fly deploy -a [appname]"
I keep getting the following error message:
2.451 19:47:21.203 [error] Postgrex.Protocol (#PID<0.8666.0>) failed to connect: ** (ArgumentError) missing the :database key in options for AppName.Repo
my config.exs
looks like this:
...
config :appName,
ecto_repos: [appName.Repo],
generators: [timestamp_type: :utc_datetime]
config :appName, AppNameWeb.Endpoint,
url: [host: "localhost"],
adapter: Bandit.PhoenixAdapter,
render_errors: [
formats: [html: AppNameWeb.ErrorHTML, json: AppNameWeb.ErrorJSON],
layout: false
],
pubsub_server: AppName.PubSub,
live_view: [signing_salt: "Lyw8GkXj"]
...
And my runtime.exs
is this:
...
if System.get_env("PHX_SERVER") do
config :appName, AppNameWeb.Endpoint, server: true
end
if config_env() == :prod do
database_url =
System.get_env("DATABASE_URL") ||
raise """
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
"""
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
config :appName, AppName.Repo,
ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
socket_options: maybe_ipv6
...
Any help would be much appreciated!