How to restart phoenix automatically in-case of host reboot?

345 views
Skip to first unread message

as3...@gmail.com

unread,
Aug 8, 2016, 10:45:18 AM8/8/16
to phoenix-talk
As we can start phoenix server in detached mode as:

    $ MIX_ENV=prod PORT=4000 elixir --detached -S mix phoenix.server

How would it be possible to restart phoenix in-case of crash or host reboot? what's the recommend way to do so?

Sense this is an OS related, and because I am running phoenix in a docker container in Amazon Elastic Beanstalk app, I would like to know some hints on how to achieve such a goal, thanks.

Dustin Farris

unread,
Aug 8, 2016, 11:02:58 AM8/8/16
to phoeni...@googlegroups.com
I'm using supervisor to manage this.

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "phoenix-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phoenix-talk...@googlegroups.com.
To post to this group, send email to phoeni...@googlegroups.com.
Visit this group at https://groups.google.com/group/phoenix-talk.
To view this discussion on the web visit https://groups.google.com/d/msgid/phoenix-talk/4c1918ee-40cb-450f-82b8-4233de7bbceb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jimmy Beaudoin

unread,
Aug 8, 2016, 11:45:49 AM8/8/16
to phoenix-talk, as3...@gmail.com
I'm going to talk about a Debian based server.

In case of an host reboot, you can restart your container or your app by putting the starting code in /etc/rc.local.
The commands you put there are going to be executed every time you restart the host.

You can also build an init script (Systemd, Upstart, etc..) for doing the same job with more options.

I'm still not good enough with the Erlang VM, but like Dustin said, you can also probably work with the Erlang supervisor.

Dustin Farris

unread,
Aug 8, 2016, 11:57:49 AM8/8/16
to phoeni...@googlegroups.com
Oh, I was referring to the process monitoring program: http://supervisord.org

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "phoenix-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phoenix-talk...@googlegroups.com.
To post to this group, send email to phoeni...@googlegroups.com.
Visit this group at https://groups.google.com/group/phoenix-talk.

as3...@gmail.com

unread,
Aug 10, 2016, 2:41:28 AM8/10/16
to phoenix-talk, as3...@gmail.com
Thanks, I will check that, I think its similar to Ubuntu too

as3...@gmail.com

unread,
Aug 10, 2016, 2:42:47 AM8/10/16
to phoenix-talk
ops, Dustin, I just thought you mean the supervisor concept of Erlang,, thanks for sharing the link
Reply all
Reply to author
Forward
0 new messages