wemgl

wemgl

Hey everyone, I’m hoping you’ll be able to help me with an Elixir Releases issue. I searched the forums for a similar
post, but the one I found, doesn’t apply as the
issue there was a typo.

So, I’m building and following the instructions from here. I’m able to go through
all the steps it outlines without any issues, but since my app is an umbrella application I had to make
a few modifications. Here’s the make target I made to consolidate the steps:

.PHONY: release-build
## release-build: builds a local release version of the app
release-build:
	mix deps.get --only prod && \
	MIX_ENV=prod mix compile && \
	npm install --prefix apps/my_app_web/assets && \
	npm run deploy --prefix apps/my_app_web/assets && \
	mix phx.digest && \
	MIX_ENV=prod mix release --overwrite

My mix.exs file with the release configuration of the release looks like this (with the actual app’s name removed):

  defp releases do
    [
      my_app_web: [
        include_executables_for: [:unix],
        applications: [
          runtime_tools: :permanent
        ]
      ]
    ]
  end

The release is built and run on macOS Catalina 10.15.7. Now, the build works and the _build/prod directory gets
generated without any issues, but when I try starting it with _build/prod/rel/my_app_web/bin/my_app_web start the application
seems like it’s running, but I can’t navigate to the landing page in my browser.

Here’s how I have everything configured:
Elixir is version:

Erlang/OTP 23 [erts-11.1.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.11.1 (compiled with Erlang/OTP 23)

and Phoenix version is 1.5.4. I’m using Runtime Configuration which seems to be set properly when I start-up iex:

# config/runtime.exs file
import Config

if config_env() == :prod do
  config :my_app_web,
         MyAppWeb.Endpoint,
         server: true,
         http: [
           port: String.to_integer(System.fetch_env!("MA_PORT")),
           transport_options: [
             socket_opts: [:inet6]
           ]
         ],
         secret_key_base: System.fetch_env!("MA_SECRET_KEY_BASE"),
         basic_auth: [
           username: System.fetch_env!("MA_BASIC_AUTH_USERNAME"),
           password: System.fetch_env!("MA_BASIC_AUTH_PASSWORD")
         ]

  config :my_app,
         MyApp.Repo,
         url: System.fetch_env!("MA_DATABASE_URL")
end
# :my_app_web config
[
  {MyAppWeb.Endpoint,
   [
     render_errors: [
       view: MyAppWeb.ErrorView,
       accepts: ["html", "json"],
       layout: false
     ],
     pubsub_server: MyApp.PubSub,
     live_view: [signing_salt: "signing_salt"],
     url: [host: "MyApp.com", port: 80],
     cache_static_manifest: "priv/static/cache_manifest.json",
     server: true,
     http: [port: 8080, transport_options: [socket_opts: [:inet6]]],
     secret_key_base: "secret_key_base",
     basic_auth: [username: "admin", password: "admin"]
   ]}
]
# :my_app config
[
  {:generators, [context_app: false]},
  {MyApp.Repo,
   [url: "ecto://postgres:postgres@localhost/my_app_development"]},
  {:ecto_repos, [MyApp.Repo]}
]

What is interesting is that if I start the app with _build/prod/rel/my_app_web/bin/my_app_web start_iex and then
try to call a function on one of my modules, say MyApp.Marketing.LifeCoachingLeads.list_life_coaching_leads, then I get:

** (UndefinedFunctionError) function MyApp.Marketing.LifeCoachingLeads.list_life_coaching_leads/0 is undefined (module MyApp.Marketing.LifeCoachingLeads is not available)
    MyApp.Marketing.LifeCoachingLeads.list_life_coaching_leads()

Which makes me think my release isn’t finding the modules it needs to start up, but it’s not obvious to me why.
Any pointers in the right direction would be fantastic!

Showing Posts 1 to 4

josevalim

josevalim

Creator of Elixir

Awesome job debugging things so far! Inside your release, you are going to find out a releases/VSN directory where VSN is the current version. Inside that directory, there is a start.script file with all steps the Erlang VM takes to boot the app. When you inspect this file, can you see your applications there?

Another way to debug is: try adding a IO.inspect :OMG to start/2 in your lib/my_app_web/application.ex and see if it is printed when you start the release.

wemgl

wemgl OP

I see it on the second line of the file:

%% coding: utf-8
{script,
    {"my_app_web","0.1.0"},
# bunch of other stuff

The file contains a lot of built-in Elixir modules Elixir.Calendar.ISO, Elixir.Map, and a lot of other modules, but none of the ones I’ve implemented.

I didn’t event think of this! I gave it a shot but I don’t see :OMG on startup either. I thought maybe I had setup the config/runtime.exs file wrong too, so I created a config/releases.exs file and put the configs in there and ran the app, but it still doesn’t start even though I see the proper start up message:

Check your digested files at "priv/static"
* assembling fit_whitt_it_web-0.1.0 on MIX_ENV=prod
* using config/releases.exs to configure the release at runtime
other stuff ...
josevalim

josevalim

Creator of Elixir

That’s only the script name. Go to the end of the file and see if your apps are being started.

One thing to keep in mind though is that in an umbrella you have to explicitly include your umbrella children in the list of applications given to the release.

wemgl

wemgl OP

Thanks @josevalim! That was the root of the issue. I took this portion of the docs too literally:

[
        include_executables_for: [:unix],
        applications: [runtime_tools: :permanent]
      ],

I mistook runtime_tools for a config option instead of being the name of the app to include in the release. Once I replaced it with my apps actual name it worked. I really appreciate the help!

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews