Closed raarts closed 7 years ago
What do you see when you run bin/backend describe
?
docker run -it -e PORT=80 -e REPLACE_OS_VARS=true p711/backend describe
init terminating in do_boot (cannot expand $ERTS_LIB_DIR in bootfile)
Crash dump is being written to: erl_crash.dump...done
/bin/erl: not found341: {"init terminating in do_boot",'cannot expand $ERTS_LIB_DIR in bootfile'}
backend-0.0.1\n
erts:
path: /app/releases/0.0.1
sys.config: /app/var/sys.config
vm.args: /app/var/vm.args
name: backend@127.0.0.1
cookie: **********************************
erl_opts: none provided
hooks:
No custom hooks found.
commands:
No custom commands found.
What is the result of running which erl
on that system?
/app/releases/0.0.1 # which erl
/usr/bin/erl
I ran into a similar problem by setting include_erts
to the path of the prod machine's erts-8.3
directory and trying to do a hot upgrade. I thought maybe it was all related, but now I think this might be part of the same root cause.
Update - let's mark my comment as temporarily invalid until I can reproduce it solidly.
I ran into the same problem using a Ubuntu 16.04 server and an OS X development machine. The problem only occurs when running something like ./my_app console
from inside bin/, bin/my_app console
works just fine.
The problem seems to be that start_clean.boot from the development machine is included in bin/. There are at least a couple ways to work around this, simply deleting start_clean.boot works, as does removing the -boot start_clean option,
export ROOTDIR="$("$__erl" -boot start_clean -eval 'io:format("~s~n", [code:root_dir()]), halt().' -noshell)"
and
"$ROOTDIR"/bin/url -boot start_clean -eval 'Ver = erlang:system_info(version), io:format("~s~n", [Ver]), halt()' -noshell
in the my_app.sh scripts.
I'm not sure exactly why you'd want the start_clean.boot from the development system with include_erts set to false, so it might make sense to remove it from the tarball.
So I'm unable to reproduce this with the following steps:
bitwalker/alpine-erlang:latest
, and copy it to hostp711/erlang
(basically a copy of the above image, but tried to stay true to the test), and copy the release tarball into the containerbin/test console
(and bin/test foreground
for good measure)You can try to reproduce as well by cloning https://github.com/bitwalker/distillery-test
, and running make deploy-alpine
in the project root.
@pjanis Regarding the start_clean
boot file: both start_clean.boot
and <yourapp>.boot
are part of the release tarball, so if one fails, both should fail, which should only happen if the ERTS version is different (which is expected, as .beam
files are compiled for a specific version of ERTS, but more importantly, your app depends on specific versions of the system applications, and those versions will not be the same with a different version of ERTS). If you omit the -boot
flag, it uses the default start_clean
present in the Erlang installation, which is similar to the one produced by distillery, except it doesn't include :elixir
and :iex
applications.
I suspect the problem here is that people are deploying from one version of ERTS (say 8.1
) to another (say 8.3
).
I don't have docker setup on my development machine, but I'll set it up later tonight.
In the mean time, I did mange to reproduce the problem on just the development machine. Below is the console history.
bash-3.2$ git clone https://github.com/bitwalker/distillery-test
Cloning into 'distillery-test'...
remote: Counting objects: 239, done.
remote: Total 239 (delta 0), reused 0 (delta 0), pack-reused 238
Receiving objects: 100% (239/239), 28.82 KiB | 0 bytes/s, done.
Resolving deltas: 100% (103/103), done.
bash-3.2$ cd distillery-test/
bash-3.2$ mix do deps.get, compile
Running dependency resolution...
Dependency resolution completed:
certifi 1.1.0
combine 0.9.6
gettext 0.13.1
hackney 1.8.0
idna 4.0.0
metrics 1.0.1
mimerl 1.0.2
neotoma 1.7.3
poison 3.1.0
ssl_verify_fun 1.1.1
timex 3.1.13
tzdata 0.5.12
* Getting timex (Hex package)
Checking package (https://repo.hex.pm/tarballs/timex-3.1.13.tar)
Fetched package
* Getting poison (Hex package)
Checking package (https://repo.hex.pm/tarballs/poison-3.1.0.tar)
Fetched package
* Getting combine (Hex package)
Checking package (https://repo.hex.pm/tarballs/combine-0.9.6.tar)
Fetched package
* Getting gettext (Hex package)
Checking package (https://repo.hex.pm/tarballs/gettext-0.13.1.tar)
Fetched package
* Getting tzdata (Hex package)
Checking package (https://repo.hex.pm/tarballs/tzdata-0.5.12.tar)
Fetched package
* Getting hackney (Hex package)
Checking package (https://repo.hex.pm/tarballs/hackney-1.8.0.tar)
Fetched package
* Getting certifi (Hex package)
Checking package (https://repo.hex.pm/tarballs/certifi-1.1.0.tar)
Fetched package
* Getting idna (Hex package)
Checking package (https://repo.hex.pm/tarballs/idna-4.0.0.tar)
Fetched package
* Getting metrics (Hex package)
Checking package (https://repo.hex.pm/tarballs/metrics-1.0.1.tar)
Fetched package
* Getting mimerl (Hex package)
Checking package (https://repo.hex.pm/tarballs/mimerl-1.0.2.tar)
Fetched package
* Getting ssl_verify_fun (Hex package)
Checking package (https://repo.hex.pm/tarballs/ssl_verify_fun-1.1.1.tar)
Fetched package
* Getting neotoma (Hex package)
Checking package (https://repo.hex.pm/tarballs/neotoma-1.7.3.tar)
Fetched package
===> Compiling idna
WARN: Missing plugins: [rebar3_hex]
==> neotoma (compile)
Compiled src/neotoma.erl
Compiled src/neotoma_parse.erl
===> Compiling mimerl
===> Compiling metrics
==> gettext
Compiling 1 file (.yrl)
Compiling 1 file (.erl)
Compiling 20 files (.ex)
Generated gettext app
==> poison
Compiling 4 files (.ex)
Generated poison app
==> ssl_verify_fun (compile)
Compiled src/ssl_verify_util.erl
Compiled src/ssl_verify_fingerprint.erl
Compiled src/ssl_verify_pk.erl
Compiled src/ssl_verify_hostname.erl
==> combine
Compiling 6 files (.ex)
Generated combine app
===> Compiling certifi
===> Compiling hackney
==> tzdata
Compiling 16 files (.ex)
Generated tzdata app
==> timex
Compiling 57 files (.ex)
Generated timex app
Compiling src/conform_parse.peg
PEG manifest updated
==> conform
Compiling 1 file (.erl)
Compiling 19 files (.ex)
Generated conform app
==> distillery
Compiling 18 files (.ex)
Generated distillery app
==> test
Compiling 5 files (.ex)
Generated test app
bash-3.2$ mix release --env=prod_without_erts
==> Assembling release..
==> Building release test:0.1.0 using environment prod_without_erts
IMPORTANT: You have opted to *not* include the Erlang runtime system (ERTS).
You must ensure that the version of Erlang this release is built with matches
the version the release will be run with once deployed. It will fail to run otherwise.
==> Packaging release..
==> Release successfully built!
You can run it in one of the following ways:
Interactive: _build/dev/rel/test/bin/test console
Foreground: _build/dev/rel/test/bin/test foreground
Daemon: _build/dev/rel/test/bin/test start
bash-3.2$ _build/dev/rel/test/bin/test console
Erlang/OTP 19 [erts-8.3] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Interactive Elixir (1.4.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(test@127.0.0.1)1>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
(v)ersion (k)ill (D)b-tables (d)istribution
^Cbash-3.2$ cd _build/dev/rel/test/bin/
bash-3.2$ ./test console
init terminating in do_boot (cannot expand $ERTS_LIB_DIR in bootfile)
Crash dump is being written to: erl_crash.dump...done
/Users/pjanis/temp/distillery-test/_build/dev/rel/test/releases/0.1.0/test.sh: line 223: {"init terminating in do_boot",'cannot ex/bin/erl: No such file or directory
/Users/pjanis/temp/distillery-test/_build/dev/rel/test/releases/0.1.0/hooks/pre_configure.d/00_conform_pre_configure.sh: line 34:/erts-/bin/escript: No such file or directory $ERTS_LIB_DIR in boot file'}
Found the issue, can you give master a shot and confirm?
confirmed. changes on master fix the issue.
👍 Thanks for the quick response!
1.3.5 has been published to Hex, just FYI
Hi, I'm experiencing the same issue with 1.5.1
.
Removing start_clean.boot
fixes.
I'm seeing this on 1.5.3.
Steps to reproduce
This does not happen when I choose to include the runtime, and then my project runs normally.
Looking at the output it seems to be looking for
/bin/erl
on my system that's in/usr/bin
because I compiled erlang with --prefix=/usrDo I need to specify somewhere where erlang resides?
The bootfile is a binary file, but indeed seems to contain $ERTS_LIB_DIR.
Reading the docs I thought REPLACE_OS_VARS=true would help, but it made no difference
Verbose Logs
Description of issue
that it uses the erlang system in the container and runs.
Alpine Linux, erlang 19.3, elixir 1.4.0
rel/config.exs
, as it is often my first troubleshooting question, and you'll save us both time :)