unable to flyctl launch basic phoenix w/out db

hi,

pretty basic;

mix phx.server is happy , but
flyctl launch --name flyphx fails:

Although the config says :

We're about to launch your Phoenix app on Fly.io. Here's what you're getting:
Name:         flyphx                 (specified on the command line)
Region:       Frankfurt, Germany     (this is the fastest region for you)
App Machines: shared-cpu-1x, 1GB RAM (most apps need about 1GB of RAM)
Postgres:     <none>                 (not requested)
Redis:        <none>                 (not requested)
Sentry:       false                  (not requested)

I still get the error:

  ERROR! Config provider Config.Reader failed with:
  ** (RuntimeError) environment variable DATABASE_URL is missing.
  For example: ecto://USER:PASS@HOST/DATABASE
      /app/releases/0.1.0/runtime.exs:26: (file)
      (elixir 1.16.2) src/elixir.erl:405: :elixir.eval_external_handler/3
      (stdlib 5.2.3) erl_eval.erl:750: :erl_eval.do_apply/7
      (stdlib 5.2.3) erl_eval.erl:494: :erl_eval.expr/6
      (stdlib 5.2.3) erl_eval.erl:136: :erl_eval.exprs/6
      (elixir 1.16.2) src/elixir.erl:378: :elixir.eval_forms/4
      (elixir 1.16.2) lib/module/parallel_checker.ex:112: Module.ParallelChecker.verify/1
      (elixir 1.16.2) lib/code.ex:572: Code.validated_eval_string/3
  Runtime terminating during boot ({#{message=><<101,110,118,105,114,111,110,109,101,110,116,32,118,97,114,105,97,98,108,101,32,68,65,84,65,66,65,83,69,95,85,82,76,32,105,115,32,109,105,115,115,105,110,103,46,10,70,111,114,32,101,120,97,109,112,108,101,58,32,101,99,116,111,58,47,47,85,83,69,82,58,80,65,83,83,64,72,79,83,84,47,68,65,84,65,66,65,83,69,10>>,'__struct__'=>'Elixir.RuntimeError','__exception__'=>true},[{elixir_eval,'__FILE__',1,[{file,"/app/releases/0.1.0/runtime.exs"},{line,26}]},{elixir,eval_external_handler,3,[{file,"src/elixir.erl"},{line,405},{error_info,#{module=>'Elixir.Exception'}}]},{erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,750}]},{erl_eval,expr,6,[{file,"erl_eval.erl"},{line,494}]},{erl_eval,exprs,6,[{file,"erl_eval.erl"},{line,136}]},{elixir,eval_forms,4,[{file,"src/elixir.erl"},{line,378}]},{'Elixir.Module.ParallelChecker',verify,1,[{file,"lib/module/parallel_checker.ex"},{line,112}]},{'Elixir.Code',validated_eval_string,3,[{file,"lib/code.ex"},{line,572}]}]})

Why is there an issue with DATABASE_URL being missing when there’s no database set up ? is that a required feature?

Hey @rays,

It looks like your runtime.exs is set up to configure Ecto and is raising because DATABASE_URL isn’t set.

It makes sense that it isn’t set, if you don’t need a database, but your app’s runtime config is still looking for it.

Hope this helps!

Thanks, can confirm that # commenting out the passages in config/runtime.exs that reference database_url (below) allow for a successful flyctl launch. Thank you, @matthewhlehner!

  #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 :hello, Hello.Repo,
  #  # ssl: true,
  #  url: database_url,
  #  pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
  #  socket_options: maybe_ipv6

EDIT: uh, actually, the launch is now failing with [ 0.033971] PCI: Fatal: No config space access function found. WIP.

1 Like

Good news!

You can ignore that PCI error. It’s meaningless and happens whenever a VM launches at the moment.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.