Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative to restart phoenix.server without quitting

Is there any way to restart the mix phoenix.server besides of quitting (e.g. by CTRL+c twice or abort etc.) and starting it again?

The background for this is: I use foreman to start the phoenix server plus test runner etc. If I have to quit the server, everything is killed and I have to completely restart foreman. If I could just trigger a restart of the phoenix.server job everything else could remain running.

Since I use tmux and run the foreman commands in different panes this would help a lot. A command triggered via command line is also fine.

like image 947
Karsten S. Avatar asked Oct 15 '25 14:10

Karsten S.


1 Answers

You can start your server in an iex session with

iex -S mix phx.server

Then stop, recompile and start the application with:

Application.stop(:your_app)
recompile()
Application.ensure_all_started(:your_app)

This should pick up any code changes and recreate the application supervision tree.

like image 173
Mike Buhot Avatar answered Oct 17 '25 08:10

Mike Buhot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!