Can't run remote on elixir app

I am deploying a non-phoenix elixir app and when I run fly ssh console -C "app/bin/apiserver remote" as per the documentaiton I get the following:

fork/exec app/bin/apiserver: no such file or directory

When I ssh into my VM, I don’t see the folder /app/bin. Is there a release process that I missing when deploying my elixir app?

Thanks,

Can you share the Dockerfile that you’re using to build your application?

I don’t have a Dockerfile in my application. It is a simple Elixir app with plugcowboy.

I figured, I needed to add release=true to elixir_buildpack.config so there could be a release but when I do
/workspace/_build/prod/rel/apiserver/bin/apiserver remote I get the following:

# /workspace/_build/prod/rel/apiserver/bin/apiserver remote
Erlang/OTP 23 [erts-11.2.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]

Could not contact remote node apiserver@4ca42fd6, reason: :nodedown. Aborting...

Since you built without a Dockerfile, try following the instructions here: Getting Started · Fly Docs

Where would I add these environment variables?

# Appended by flyctl
ENV ECTO_IPV6 true
ENV ERL_AFLAGS "-proto_dist inet6_tcp"

Thanks for troubleshooting this!

I’ve had times where apps I need to run something like app/apiserver/bin/apiserver remote instead. The easiest way to verify this is to type ls and look at the folders once you’ve ssh’ed into you machine.

:bulb: a tip : you can run it all in one swoop using the -C flag:

fly ssh console -a apiserver -C "app/apiserver/bin/apiserver remote"

the -a {{appname}} is optional here unless you have multiple apps.

Ignore my tip. you already knew it :smiley:

@nbw
I am running fly ssh console -C "/workspace/_build/prod/rel/apiserver/bin/apiserver remote" but it is still unable to connect to the node:

 fly ssh console -C "/workspace/_build/prod/rel/apiserver/bin/apiserver remote"
Update available 0.0.450 -> 0.0.451.
Run "fly version update" to upgrade.
Connecting to fdaa:1:2ea0:a7b:aa4:501:dbc3:2... complete
Erlang/OTP 23 [erts-11.2.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]

Could not contact remote node minero@fdaa:1:2ea0:a7b:aa4:501:dbc3:2, reason: :nodedown. Aborting...

``

Take a look at this post: Could not contact remote node reason: :nodedown. Aborting... - #7 by Mark

There’s some notes about:

ENV ECTO_IPV6 true
ENV ERL_AFLAGS "-proto_dist inet6_tcp"

also some stuff about the rel folder ( env.ssh.eex file, etc), which has some release files. The Legacy docs talk about that here: Legacy pre v1.6.3 Phoenix App · Fly Docs

One other thing that has helped me is to compare my project to the existing hello_elixir repo to see what is different:

1 Like

Hi @pauliegatto,

When you run fly launch, it should detect that you have an Elixir app and it runs mix phx.gen.release. This creates a Dockerfile for you. It also creates a rel directory in your application source code.

This is where all the config happens for what we’re talking about here. You should have a Dockerfile and, unless it was customized, it creates a shell script called server that is executed with the app/bin/server remote command.

See the instructions here: Getting Started · Fly Docs

for information on the ENV settings that are automatically added to the Dockerfile for you.

@Mark

My elixir app is not a phoenix app. So maybe that’s where all my problems stem from?

Ah, yes. The fly launch command detects a Phoenix app and does some default setup for it. I missed that it was a non-Phoenix app.

The key points are you want to generate a release and you probably want a Dockerfile to help build the app and the release.