This might be a basic question, but I couldn’t find any answers anywhere. I’ve spent a lot of time writing elixir code, not so much time deploying it.
FYI. I’m building on the server, because you know MacOS is great and all until you need to build for a server.
When I run MIX_ENV=prod mix phx.gen.release
, I get the message with the following:
# To build a release
mix release
# To start your system with the Phoenix server running
_build/dev/rel/myapp/bin/server
I’m assuming that server
command is just for testing that things work if someone is building locally, then planning to do a release locally that they push to a server. If I’m doing all this on the server, do I just start my server with that command, and skip the release stuff all together?
Regardless for now i’ve done the release, which gives me the following messaging:
Release created at _build/prod/rel/myapp
# To start your system
_build/prod/rel/myapp/bin/myapp start
Once the release is running:
# To connect to it remotely
_build/prod/rel/myapp/bin/myapp remote
# To stop it gracefully (you may also send SIGINT/SIGTERM)
_build/prod/rel/myapp/bin/myapp stop
I run the start command, and then I’m confused because it binds my shell, so I can’t really run remote
or stop
(unless from a separate shell), because i’d have to kill the server to get a shell back to run the stop
command, which would no longer be needed because the server would be stopped.
Years ago when I deployed something else, I remember having a start
command that didn’t bind the shell. This was pre-elixir releases though. I forget if it was exrm or distillery. I think distillery. But that would start the server, and not bind your shell. I’m assuming that’s more similar to:
daemon Starts the system as a daemon
But considering I have to ignore the line telling me to start my server with _build/.../myapp start
, input _build/.../myapp
to see more commands, to see the daemon
command, is why I’m asking this question. Is start
a red-herring/intended for testing? Is daemon
the way most people are actually starting apps in production? In my case(i.e. building on the server), should I just run _build/.../server
and skip releases?
Sorry if this is common knowledge. I did search quite a bit for answers, but didn’t find anything.