Elixir docker container app does not boot(mix release)

using https://elixirschool.com/blog/releasing-an-umbrella-app-with-docker-and-mix-release/ as a guide I’ve gotten a release built along with another postgres dependency container(via docker-compose). However the app just does not give me the listening on port 4000 message … it just never comes back. I’ve tried both docker compose and docker run:

docker run -p 4000:4000 --env SECRET_KEY_BASE=PV4tK6d7I3TTaygeCuaFSaZuQgmO6Lz9twMo5GSVDn4TW2+R2/ycQnzBx/20TfBt mhanna/registrar:latest

just cannot figure out why the trivial elixir release will not boot. here is the tail:

Starting registrar_umbrella_postgres_1 ... done
Creating registrar_umbrella_registrar_umbrella_1 ... done
Attaching to registrar_umbrella_postgres_1, registrar_umbrella_registrar_umbrella_1
postgres_1            | 
postgres_1            | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres_1            | 
registrar_umbrella_1  | Starting app from bash script...
postgres_1            | 2020-01-15 05:47:01.989 UTC [1] LOG:  starting PostgreSQL 12.1 (Debian 12.1-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
registrar_umbrella_1  | running env.sh.eex...
registrar_umbrella_1  | Beginning migration script...
postgres_1            | 2020-01-15 05:47:01.989 UTC [1] LOG:  listening on IPv4 address "", port 5432
postgres_1            | 2020-01-15 05:47:01.989 UTC [1] LOG:  listening on IPv6 address "::", port 5432
registrar_umbrella_1  | running env.sh.eex...
postgres_1            | 2020-01-15 05:47:01.992 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1            | 2020-01-15 05:47:02.005 UTC [26] LOG:  database system was interrupted; last known up at 2020-01-15 05:42:24 UTC
postgres_1            | 2020-01-15 05:47:02.252 UTC [26] LOG:  database system was not properly shut down; automatic recovery in progress
postgres_1            | 2020-01-15 05:47:02.254 UTC [26] LOG:  redo starts at 0/165E950
postgres_1            | 2020-01-15 05:47:02.254 UTC [26] LOG:  invalid record length at 0/165E988: wanted 24, got 0
postgres_1            | 2020-01-15 05:47:02.254 UTC [26] LOG:  redo done at 0/165E950
postgres_1            | 2020-01-15 05:47:02.268 UTC [1] LOG:  database system is ready to accept connections
registrar_umbrella_1  | Starting dependencies..
registrar_umbrella_1  | Starting repos..
registrar_umbrella_1  | Running migrations for registrar repo: Elixir.Registrar.Repo migrations_path: /app/lib/registrar-0.1.0/priv/repo/migrations
registrar_umbrella_1  | 05:47:04.971 [info] Already up

I’m running portainer and when I inspect the processes in the registrar_umbrella_registrar_umbrella_1 container, I see:

|29015|root|0:00|bash ./bin/start|
|29147|root|0:08|/app/erts-10.4.3/bin/beam.smp -- -root /app -progname erl -- -home /opt/app/ -- -noshell -s elixir start_cli -mode embedded -setcookie W7Ap0aUA_adU9mcHvy80M049WndCzyG_SK-CsrUCdSd6k2sFKks6yA== -sname registrar_umbrella -config /app/tmp/registrar_umbrella-0.1.0-20200117064602-4f7f.runtime -boot /app/releases/0.1.0/start -boot_var RELEASE_LIB /app/lib -extra --no-halt|
|29245|root|0:00|/app/erts-10.4.3/bin/epmd -daemon|
|29249|root|0:00|erl_child_setup 1048576|
|29274|root|0:00|inet_gethost 4|
|29275|root|0:00|inet_gethost 4|

it appears to be stuck in ./bin/start ?

Container details:

Image 	registrar_umbrella@sha256:5d28e98a6bed19d7c87328938011beeef752b8a7be3f3f9b3130983903376020
Port configuration 4000/tcp
CMD 	./bin/start
SECRET_KEY_BASE 	PV4tK6d7I3TTaygeCuaFSaZuQgmO6Lz9twMo5GSVDn4TW2+R2/ycQnzBx/20TfBt
DATABASE_URL 	ecto://postgres:postgres@postgres/registrar_dev
PORT 	4000
HOST 	""
POSTGRES_DB 	registrar_dev
PATH 	./node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOME 	/opt/app/
TERM 	xterm
REFRESHED_AT 	2019-06-26
MIX_HOME 	/opt/mix
HEX_HOME 	/opt/hex
MIX_ENV 	prod
SHELL 	/bin/bash

Any ideas on how to even debug this?

I’m using elixir 1.10.0-rc.0 and erlang 22.2.1 via asdf

my github repo is here if you care to take a look:

did you set server: true in prod.exs? I missed it once and was wondering where my server was :slight_smile:

1 Like

wow, that was it thanks. I can’t believe I missed that.

Here is my final Endpoint configuration:

config :registrar_web, RegistrarWeb.Endpoint,
  http: [:inet6, port: {:system, "PORT"}],
  url: [host: "", port: 4000],
  cache_static_manifest: "priv/static/cache_manifest.json",
  server: true,
  version: Application.spec(:registrar_web, :vsn)