Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading new yaws configuration file while running yaws

Tags:

erlang

yaws

I am using YAWS to serve my remote application. When ever there is a change in yaws.conf file i am restarting the server to make these changes in effect. I don't want to do this, because my application might crash if server is down for more than certain time.

So is there a way to load the new configuration file with out stopping the server, like live code update?

like image 429
Gokul Avatar asked Jan 13 '23 15:01

Gokul


2 Answers

You can use the following command from an interactive shell to reload the Yaws config file without restarting the server:

yaws --hup --id ID

where the --id ID portion is optional — if you're running multiple Yaws instances, it lets you identify which particular Yaws server you want to reload.

like image 190
Steve Vinoski Avatar answered Jan 22 '23 10:01

Steve Vinoski


There's yaws_api:setconf(GC, SCList), mostly intended for running Yaws "embedded" (i.e., under one of your own supervisors instead of starting Yaws as a separate application). But when you do that, Yaws will still tear down all existing ports and connections in order to set up the new configuration. So the first question is: have you measured the time it takes to restart the whole Yaws application? It might be only slightly slower than reloading the configuration, in which case you would make your code more complicated without really gaining anything.

like image 29
RichardC Avatar answered Jan 22 '23 12:01

RichardC