Deploy phoenix with release and docker, remote faild, noconnection

Deployed according to the following documentation

version in dockerfile

ARG DEBIAN_VERSION=bullseye-20230612-slim


when run remote in container (only one node), get noconnection error

nobody@8:/app$ bin/pome_server_v2 remote

14:39:09.721 [error] Process #PID<0.103.0> on node :"rem-4673-pome_server_v2@8" raised an exception
** (MatchError) no match of right hand side value: {:error, :noconnection}
    lib/iex.ex:923: IEx.cli/1

query pid also faild

nobody@8:/app$ bin/pome_server_v2 pid
--rpc-eval : RPC failed with reason :noconnection

run epmd -names

nobody@8:/app$ erts-14.0.1/bin/epmd  -names
epmd: up and running on port 4369 with data:
name pome_server_v2 at port 40331

beam process

nobody   27060 21.5  0.3 3870048 305892 ?      Ssl  02:54 153:03 /app/erts-14.0.1/bin/beam.smp -- -root /app -bindir /app/erts-14.0.1/bin -progname erl -- -home /nonexistent -- -noshell -s elixir start_cli -mode embedded -setcookie KXOSJ3PJBHJYXH4CCAXFWBA37NMN67QVJIVD3OYXJK4A==== -sname pome_server_v2 -config /app/releases/0.1.1/sys -boot /app/releases/0.1.1/start -boot_var RELEASE_LIB /app/lib -- -extra --no-halt

phoenix service is ok

similar issue

maybe mrsk(GitHub - mrsked/mrsk: Deploy web apps anywhere.) change hostnmae

i’m a bit confused here. it seems to me that the guide is not about deployment but about building a release inside a docker container. it just uses a container to create the build so there’s nothing running in there. to use remote the app needs to run.

anyway in the same directory where you ran remote you should be able to run the server also. don’t have time atm to remind myself of the command.

overall if you’re new to this i’d suggest using - they deploy both app and database with a single command, create all the build configurations (also using docker). it just works.

I use mrsk to deploy, and the new version of mrsk has added a hostname prefix rule

This does not work in elixir release

I ran into the same issue when deploying via mrsk. They prefix the docker hostname with the ip address of the host. This will then lead to incomplete hostnames because :inet.gethostname() returns just the short name which would be the first part of the ip address (see inet:gethostname removes text after "." in hostnames · Issue #5265 · erlang/otp · GitHub).

And breaks the ./bin/app remote command because it tries to connect to the wrong host (app@123 instead of app@

To fix this, you need to configure your release to use name isntead.


export RELEASE_NODE=<%= %>@

Then you can

mrsk app exec --reuse -i "./bin/app remote"