Phoenix mix release failure when running migration script

Hi! This seems to be a major sticking point for many others. I have gone through all of the “solutions” but sadly none of them seem to resolve my problem. The one potential difference is that my repo is not defined with the Phoenix application itself but in a core library module pulled in as dep.

mix.exs

defmodule IgniteopediaLive.MixProject do
use Mix.Project

def project do
[
app: :igniteopedia_live,
version: “0.1.0”,
elixir: “~> 1.12”,
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
]
end

def application do
[
mod: {IgniteopediaLive.Application, },
extra_applications: [:logger, :runtime_tools]
]
end

defp elixirc_paths(:test), do: [“lib”, “test/support”]
defp elixirc_paths(_), do: [“lib”]

defp deps do
[
{:phoenix, “~> 1.6.6”},
{:phoenix_html, “~> 3.0”},
{:phoenix_live_reload, “~> 1.2”, only: :dev},
{:phoenix_live_view, “~> 0.17.5”},
{:floki, “>= 0.30.0”, only: :test},
{:phoenix_live_dashboard, “~> 0.6”},
{:esbuild, “~> 0.3”, runtime: Mix.env() == :dev},
{:telemetry_metrics, “~> 0.6”},
{:telemetry_poller, “~> 1.0”},
{:jason, “~> 1.2”},
{:plug_cowboy, “~> 2.5”},
{:tailwind, “~> 0.1”, runtime: Mix.env() == :dev},
{:ecto_sql, “~> 3.7”},
{:postgrex, “~> 0.16.2”},
{:repo_manager, git: “GitHub - pgiesin/igniteopedia-core”, sparse: “repo_manager”, branch: “main”},
]
end

defp aliases do
[
setup: [“deps.get”],
“assets.deploy”: [“tailwind default --minify”, “esbuild default --minify”, “phx.digest”]
]
end
end

fly.toml

app = “igniteopedia-live-view”

kill_signal = “SIGTERM”
kill_timeout = 5
processes =

[deploy]
release_command = “eval IgniteopediaLive.Release.migrate”

[env]

[experimental]
allowed_public_ports =
auto_rollback = true

[[services]]
http_checks =
internal_port = 4000
processes = [“app”]
protocol = “tcp”
script_checks =

[services.concurrency]
hard_limit = 25
soft_limit = 20
type = “connections”

[[services.ports]]
force_https = true
handlers = [“http”]
port = 80

[[services.ports]]
handlers = [“tls”, “http”]
port = 443

[[services.tcp_checks]]
grace_period = “30s”
interval = “15s”
restart_limit = 0
timeout = “2s”

config/runtime.exs

import Config

if System.get_env(“PHX_SERVER”) && System.get_env(“RELEASE_NAME”) do
config :igniteopedia_live, IgniteopediaLiveWeb.Endpoint, server: true
end

if config_env() == :prod do
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”

database_url =
System.get_env(“DATABASE_URL”) ||
raise “”"
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
“”"

config :repo_manager, RepoManager.Runtime.Repo,
# 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”)

port = String.to_integer(System.get_env(“PORT”) || “4000”)

config :igniteopedia_live, IgniteopediaLiveWeb.Endpoint,
url: [host: “#{app_name}.fly.dev”, port: 443],
http: [
ip: {0, 0, 0, 0, 0, 0, 0, 0},
port: port
],
secret_key_base: secret_key_base
end

Dockerfile

ARG BUILDER_IMAGE=“hexpm/elixir:1.13.3-erlang-24.3.3-debian-bullseye-20210902-slim”
ARG RUNNER_IMAGE=“debian:bullseye-20210902-slim”

FROM ${BUILDER_IMAGE} as builder
RUN apt-get update -y && apt-get install -y build-essential git \

&& apt-get clean && rm -f /var/lib/apt/lists/_

WORKDIR /app

RUN mix local.hex --force && \

mix local.rebar --force

ENV MIX_ENV=“prod”

COPY mix.exs mix.lock ./

RUN mix deps.get --only $MIX_ENV

RUN mkdir config

COPY config/config.exs config/${MIX_ENV}.exs config/
RUN mix deps.compile
COPY priv priv

COPY assets assets
RUN mix assets.deploy
COPY lib lib

RUN mix compile
COPY config/runtime.exs config/

COPY rel rel
COPY config/runtime.exs config/
RUN mix release

FROM ${RUNNER_IMAGE}

RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales \

&& apt-get clean && rm -f /var/lib/apt/lists/_

RUN sed -i ‘/en_US.UTF-8/s/^# //g’ /etc/locale.gen && locale-gen

ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

WORKDIR “/app”
RUN chown nobody /app

COPY --from=builder --chown=nobody:root /app/_build/prod/rel/igniteopedia_live ./

USER nobody

CMD ["/app/bin/server"]

Appended by flyctl

ENV ECTO_IPV6 true

ENV ERL_AFLAGS “-proto_dist inet6_tcp”

I have to admit I am at a bit of a loss as to what I am missing. I would be grateful for some expert advice.

Best regards,
Peter