By the way i had already tried it but just verify here is the second try
runtime.exs
use Mix.Config
# config/runtime.exs is executed for all environments, including
# during releases. It is executed after compilation and before the
# system starts, so it is typically used to load production configuration
# and secrets from environment variables or elsewhere. Do not define
# any compile-time configuration in here, as it won't be applied.
# The block below contains prod specific runtime configuration.
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
"""
config :fchatapp, Fchatapp.Repo,
# ssl: true,
# IMPORTANT: Or it won't find the DB server
socket_options: [:inet6],
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
secret_key_base =
System.get_env("SECRET_KEY_BASE") ||
raise """
environment variable SECRET_KEY_BASE is missing.
You can generate one by calling: mix phx.gen.secret
"""
app_name =
System.get_env("FLY_APP_NAME") ||
raise "FLY_APP_NAME not available"
config :fchatapp, FchatappWeb.Endpoint,
url: [host: "#{app_name}.fly.dev", port: 80],
http: [
# Enable IPv6 and bind on all interfaces.
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
ip: {0, 0, 0, 0, 0, 0, 0, 0},
port: String.to_integer(System.get_env("PORT") || "8080")
],
secret_key_base: secret_key_base
# ## Using releases
#
# If you are doing OTP releases, you need to instruct Phoenix
# to start each relevant endpoint:
#
config :fchatapp, FchatappWeb.Endpoint, server: true
# ## Configuring the mailer
#
# In production you need to configure the mailer to use a different adapter.
# Also, you may need to configure the Swoosh API client of your choice if you
# are not using SMTP. Here is an example of the configuration:
#
# config :hello_elixir, HelloElixir.Mailer,
# adapter: Swoosh.Adapters.Mailgun,
# api_key: System.get_env("MAILGUN_API_KEY"),
# domain: System.get_env("MAILGUN_DOMAIN")
#
# For this example you need include a HTTP client required by Swoosh API client.
# Swoosh supports Hackney and Finch out of the box:
#
# config :swoosh, :api_client, Swoosh.ApiClient.Hackney
#
# See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details.
end
after I run command fly deploy here is result
--> Pushing image done
image: registry.fly.io/chatapp:deployment-1646520807
image size: 123 MB
Starting instance
Pulling container image
Preparing kernel init
Starting virtual machine
Preparing to run: `/app/bin/migrate` as nobody
ERROR! Config provider Config.Reader failed with:
(elixir 1.12.3) src/elixir_expand.erl:87: :elixir_expand.expand/2
(elixir 1.12.3) src/elixir_expand.erl:40: :elixir_expand.expand/2
/app/releases/0.1.0/runtime.exs:1: (file)
{"init terminating in do_boot",{#{'__exception__'=>true,'__struct__'=>'Elixir.CompileError',description=><<"module Mix.Config is not loaded and could not be fError release command failed, deployment aborted
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
here are the logs
2022-03-05T22:54:21Z app[f49d31a4] lhr [info]Starting init (commit: 0c50bff)...
2022-03-05T22:54:21Z app[f49d31a4] lhr [info]Preparing to run: `/app/bin/migrate` as nobody
2022-03-05T22:54:21Z app[f49d31a4] lhr [info]2022/03/05 22:54:21 listening on [fdaa:0:512b:a7b:276d:f49d:31a4:2]:22 (DNS: [fdaa::3]:53)
2022-03-05T22:54:22Z app[f49d31a4] lhr [info]ERROR! Config provider Config.Reader failed with:
2022-03-05T22:54:22Z app[f49d31a4] lhr [info]** (CompileError) /app/releases/0.1.0/runtime.exs:1: module Mix.Config is not loaded and could not be found
2022-03-05T22:54:22Z app[f49d31a4] lhr [info] (elixir 1.12.3) src/elixir_expand.erl:87: :elixir_expand.expand/2
2022-03-05T22:54:22Z app[f49d31a4] lhr [info] (elixir 1.12.3) src/elixir_expand.erl:538: :elixir_expand.expand_block/4
2022-03-05T22:54:22Z app[f49d31a4] lhr [info] (elixir 1.12.3) src/elixir_expand.erl:40: :elixir_expand.expand/2
2022-03-05T22:54:22Z app[f49d31a4] lhr [info] (elixir 1.12.3) expanding macro: Kernel.use/1
2022-03-05T22:54:22Z app[f49d31a4] lhr [info] /app/releases/0.1.0/runtime.exs:1: (file)
2022-03-05T22:54:22Z app[f49d31a4] lhr [info]{"init terminating in do_boot",{#{'__exception__'=>true,'__struct__'=>'Elixir.CompileError',description=><<"module Mix.Config is not loaded and could not be found">>,file=><<"/app/releases/0.1.0/runtime.exs">>,line=>1},[{elixir_expand,expand,2,[{file,"src/elixir_expand.erl"},{line,87}]},{elixir_expand,expand_block,4,[{file,"src/elixir_expand.erl"},{line,538}]},{elixir_expand,expand,2,[{file,"src/elixir_expand.erl"},{line,40}]},{'Elixir.Kernel',use,1,[{file,"expanding macro"}]},{elixir_compiler_0,'__FILE__',1,[{file,"/app/releases/0.1.0/runtime.exs"},{line,1}]}]}}
2022-03-05T22:54:22Z app[f49d31a4] lhr [info]init terminating in do_boot ({,[{elixir_expand,expand,2,[{_},{_}]},{elixir_expand,expand_block,4,[{_},{_}]},{elixir_expand,expand,2,[{_},{_}]},{Elixir.Kernel,use,1,[{_}]},{elixir_compiler_0,__FILE__,1
2022-03-05T22:54:22Z app[f49d31a4] lhr [info]Crash dump is being written to: erl_crash.dump...done
2022-03-05T22:54:23Z app[f49d31a4] lhr [info]Main child exited normally with code: 1
2022-03-05T22:54:23Z app[f49d31a4] lhr [info]Reaped child process with pid: 564 and signal: SIGUSR1, core dumped? false
2022-03-05T22:54:23Z app[f49d31a4] lhr [info]Starting clean up.