erlang / rebar3

Erlang build tool that makes it easy to compile and test Erlang applications and releases.
http://www.rebar3.org
Apache License 2.0
1.7k stars 519 forks source link

How do i start my erlang app after rebar3 as prod tar? #1420

Closed oladipo closed 7 years ago

oladipo commented 7 years ago

I have generated a .tar file with rebar3 for my erlang app.

I need to know what are the possible ways to start the app on my production server from the extracted tar.gz file.

ajm113 commented 7 years ago

Not sure how much help my answer will be, but since this is an old question, I'll give a shot. IMO since a good chance, good sysadmins will know about "make" / "mingw-make" or something similar. I usually stick this piece of code in.

run:
    ${ERL} -pa ./_build/default/lib/yourapp_app/ebin -s yourapp_startme

Maybe not the absolute best way to run an app (for applications modules), but I see it as an idiot proof method for non-Erlangers. If all they have to run in is $ make run. Of course, you can take this one example and expand it.

I also write a small "boot" script for my project so that everything runs perfectly.

-module(myapp_startme).

-export([start/0]).

start() ->
    ok = application:start(sasl),
    ok = application:start(yourapp_app).

Citation: http://roberto-aloi.com/blog/2013/07/13/create-deploy-erlang-cowboy-application-heroku/

oladipo commented 7 years ago

Thanks everyone,

I found out a way that works for me.

$ ./rel/app/bin/app start

apparently my inability to start the app earlier on production was because of an unrelated error. I fixed the error and was good to go.

Thanks,

ajm113 commented 7 years ago

Oh cool, nvm then. haha (Still learning myself.)