bitwalker / distillery

Simplify deployments in Elixir with OTP releases!
MIT License
2.96k stars 398 forks source link

Deploy production to FreeBSD system - libdl.so.1 not found #566

Closed lpvm closed 5 years ago

lpvm commented 5 years ago

Steps to reproduce

$ mix deliver start production --verbose The development is done in Linux The build and release are in two FreeBSD computers of the same release 11.2.

Verbose Logs

``` EDELIVER ORIF WITH START COMMAND -----> starting production servers production node: user : elixir host : orif_orif path : /usr/home/elixir/orif/orif_release response: Shared object "libdl.so.1" not found, required by "beam" Shared object "libdl.so.1" not found, required by "beam" Shared object "libdl.so.1" not found, required by "beam" Unusable Erlang runtime system! This is likely due to being compiled for another system than the host is running Shared object "libdl.so.1" not found, required by "beam" START DONE! ```
``` # Put your logs here! ```

Description of issue

Production box:

$ elixir -v                                                                                                                     
Erlang/OTP 19 [erts-8.3.5.4] [source] [64-bit] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]                                               
Elixir 1.6.5 (compiled with OTP 19)

use Mix.Releases.Config,

This sets the default release built by mix release

default_release: :default,
default_environment: Mix.env()

environment :dev do set dev_mode: true set include_erts: false set cookie: :"ei"
end environment :prod do set include_erts: true set include_src: false set cookie: :"h"
end release :orif do set version: current_version(:orif) set applications: [ :runtime_tools ] end

OvermindDL1 commented 5 years ago

Was it compiled on that or an identical FreeBSD system as well? Or was it compiled elsewhere (like a linux or mac system) then copied to the FreeBSD system?

lpvm commented 5 years ago

If you mean what BUILD_* refer to:

BUILD_HOST="fbsd0"
BUILD_USER="myuser"
BUILD_AT="/usr/home/myuser/orif/orif_build"

It refers to a FreeBSD machine identical to the production one.

OvermindDL1 commented 5 years ago

I'm unsure what BUILD_ is referencing, that's not a distillery thing, but have you tried, just as a test, to fully compile it on the endpoint machine (no other) and run the distillery built release (directly, no other tools) as a test? The BEAM is very sensitive to differences between systems, hence why it is recommended to compile on the same machine it will run on (or otherwise a docker container or so that can guarantee identical setups).

lpvm commented 5 years ago

Those commands are from edeliver. In the build machine (FreeBSD):

$ mix release --env=prod
warning: found quoted keyword "test" but the quotes are not required. Note that keywords are always atoms, even when quoted, and quotes should only be used to introduce keywords with foreign characters in them
  mix.exs:63

==> Assembling release..
==> Building release orif:0.0.1 using environment prod
==> Including ERTS 8.3.5.6 from /usr/local/lib/erlang/erts-8.3.5.6
==> Packaging release..
Release successfully built!
To start the release you have built, you can use one of the following tasks:
    # start a shell, like 'iex -S mix'
    > _build/dev/rel/orif/bin/orif console
    # start in the foreground, like 'mix run --no-halt'
    > _build/dev/rel/orif/bin/orif foreground
    # start in the background, must be stopped with the 'stop' command
    > _build/dev/rel/orif/bin/orif start

If you started a release elsewhere, and wish to connect to it:
    # connects a local shell to the running node
    > _build/dev/rel/orif/bin/orif remote_console
    # connects directly to the running node's console
    > _build/dev/rel/orif/bin/orif attach

For a complete listing of commands and their use:
    > _build/dev/rel/orif/bin/orif help

dev produces the release fine, too.

But when trying to run it with _build/prod/rel/orif/bin/orif foreground (either for dev or prod) there's a crash dump. Please see the attached file. erl_crash.dump.gz

abraude commented 5 years ago

Had same problem on FreeBSD production box, fixed after installing sudo pkg install ncurses

lpvm commented 5 years ago

I solved this issue. After inspecting the output of the crash, the problem is that the erlang version installed in the FreeBSD box is still 19, so the bcrypt package had to be downgraded, as mentioned in https://github.com/riverrun/bcrypt_elixir