HEART

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

HEART

Roberto Ostinelli-3
Dear list,
I'm a little confused and would like to understand whether the HEART command should be used or not.

In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.

What is the best practice in the erlang world? A script to start an erlang release at boot time, and use the HEART command? Others?

The warning in the docs makes me hesitate.

Any input welcome.

Thanks!
r.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Eric Pailleau
Hi Roberto,

Good question. Heart was probably initially used for embedded systems.
Monitoring your node is not that much easy,
Because no pid file is created out of the box. It ends by using a wrapper that create a pidfile.
Heart is also needful for hot upgrades when reboot of emulator is necessary.
Mho,  you should set the HEART_command to your starter script in order to create another pidfile on reboot. See heart module documentation.
Regards

Le 11 mai 2015 21:13, Roberto Ostinelli <[hidden email]> a écrit :

>
> Dear list,
> I'm a little confused and would like to understand whether the HEART command should be used or not.
>
> In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.
>
> What is the best practice in the erlang world? A script to start an erlang release at boot time, and use the HEART command? Others?
>
> The warning in the docs makes me hesitate.
>
> Any input welcome.
>
> Thanks!
> r.
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions 
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Roberto Ostinelli-3
Hi Eric,
Thank you. Do you have a recommended starter script?



> On 11/mag/2015, at 22:11, Éric Pailleau <[hidden email]> wrote:
>
> Hi Roberto,
>
> Good question. Heart was probably initially used for embedded systems.
> Monitoring your node is not that much easy,
> Because no pid file is created out of the box. It ends by using a wrapper that create a pidfile.
> Heart is also needful for hot upgrades when reboot of emulator is necessary.
> Mho,  you should set the HEART_command to your starter script in order to create another pidfile on reboot. See heart module documentation.
> Regards
>
> Le 11 mai 2015 21:13, Roberto Ostinelli <[hidden email]> a écrit :
>>
>> Dear list,
>> I'm a little confused and would like to understand whether the HEART command should be used or not.
>>
>> In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.
>>
>> What is the best practice in the erlang world? A script to start an erlang release at boot time, and use the HEART command? Others?
>>
>> The warning in the docs makes me hesitate.
>>
>> Any input welcome.
>>
>> Thanks!
>> r.
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions 
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Eric Pailleau
Hi,
No, in fact, I m working on this.
To be short, the wrapper might be posix compliant and trap signals, create the pidfile set the heart command and launch the release.
I will maybe share my work once ready, but so many thing to do and do little time... ;-)

Le 11 mai 2015 22:23, Roberto Ostinelli <[hidden email]> a écrit :

>
> Hi Eric,
> Thank you. Do you have a recommended starter script?
>
>
>
> > On 11/mag/2015, at 22:11, Éric Pailleau <[hidden email]> wrote:
> >
> > Hi Roberto,
> >
> > Good question. Heart was probably initially used for embedded systems.
> > Monitoring your node is not that much easy,
> > Because no pid file is created out of the box. It ends by using a wrapper that create a pidfile.
> > Heart is also needful for hot upgrades when reboot of emulator is necessary.
> > Mho,  you should set the HEART_command to your starter script in order to create another pidfile on reboot. See heart module documentation.
> > Regards
> >
> > Le 11 mai 2015 21:13, Roberto Ostinelli <[hidden email]> a écrit :
> >>
> >> Dear list,
> >> I'm a little confused and would like to understand whether the HEART command should be used or not.
> >>
> >> In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.
> >>
> >> What is the best practice in the erlang world? A script to start an erlang release at boot time, and use the HEART command? Others?
> >>
> >> The warning in the docs makes me hesitate.
> >>
> >> Any input welcome.
> >>
> >> Thanks!
> >> r.
> >> _______________________________________________
> >> erlang-questions mailing list
> >> [hidden email]
> >> http://erlang.org/mailman/listinfo/erlang-questions 
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Roberto Ostinelli
I still can't seem to find anything decent on a proper way to start an Erlang Release on system boot, and a watchdog to restart it if the VM crashes.
I only find a variety of hacks, which include running releases *not* in detached mode.

Any other recommendations?

On Mon, May 11, 2015 at 10:32 PM, Éric Pailleau <[hidden email]> wrote:
Hi,
No, in fact, I m working on this.
To be short, the wrapper might be posix compliant and trap signals, create the pidfile set the heart command and launch the release.
I will maybe share my work once ready, but so many thing to do and do little time... ;-)

Le 11 mai 2015 22:23, Roberto Ostinelli <[hidden email]> a écrit :
>
> Hi Eric,
> Thank you. Do you have a recommended starter script?
>
>
>
> > On 11/mag/2015, at 22:11, Éric Pailleau <[hidden email]> wrote:
> >
> > Hi Roberto,
> >
> > Good question. Heart was probably initially used for embedded systems.
> > Monitoring your node is not that much easy,
> > Because no pid file is created out of the box. It ends by using a wrapper that create a pidfile.
> > Heart is also needful for hot upgrades when reboot of emulator is necessary.
> > Mho,  you should set the HEART_command to your starter script in order to create another pidfile on reboot. See heart module documentation.
> > Regards
> >
> > Le 11 mai 2015 21:13, Roberto Ostinelli <[hidden email]> a écrit :
> >>
> >> Dear list,
> >> I'm a little confused and would like to understand whether the HEART command should be used or not.
> >>
> >> In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.
> >>
> >> What is the best practice in the erlang world? A script to start an erlang release at boot time, and use the HEART command? Others?
> >>
> >> The warning in the docs makes me hesitate.
> >>
> >> Any input welcome.
> >>
> >> Thanks!
> >> r.
> >> _______________________________________________
> >> erlang-questions mailing list
> >> [hidden email]
> >> http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Jesper Louis Andersen-2
In reply to this post by Roberto Ostinelli-3

On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <[hidden email]> wrote:
In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.

The heart system in Erlang is a simple watchdog, mostly used if you nothing else that will restart your application. In an SysV init system, there is no automatic watching and restart. In RcNG in FreeBSD, there is no restart. In OpenBSDs rc, there is no automatic restart.

But as you say, many modern init systems also provides watching of the applications it starts, and in that case I wouldn't run with heart enabled. Better to let the system above handle it, and plug into its monitoring/reporting and so on.

Heart is very useful if you start nodes outside the control of the system watchdog though. In that case, they won't be restarted, and you can run heart on those.


--
J.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Roberto Ostinelli
Fair enough, however at this point I cannot even a single one of these systems to simply START *and* STOP an Erlang release.
I can easily start it (on ubuntu, `sudo service myapp start`) but the STOP command will always fail. That's because the init script cannot get a grasp of the BEAM process' pid (for some reason), hence it cannot stop it.

Any ideas on how to do that?


On Tue, May 12, 2015 at 5:52 PM, Jesper Louis Andersen <[hidden email]> wrote:

On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <[hidden email]> wrote:
In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.

The heart system in Erlang is a simple watchdog, mostly used if you nothing else that will restart your application. In an SysV init system, there is no automatic watching and restart. In RcNG in FreeBSD, there is no restart. In OpenBSDs rc, there is no automatic restart.

But as you say, many modern init systems also provides watching of the applications it starts, and in that case I wouldn't run with heart enabled. Better to let the system above handle it, and plug into its monitoring/reporting and so on.

Heart is very useful if you start nodes outside the control of the system watchdog though. In that case, they won't be restarted, and you can run heart on those.


--
J.


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

dmkolesnikov
Hello Roberto,

The rebar makes a dirty work to generate "node release” and necessary bootstrap scripts.  Please check create-node command and concept of erlang releases: 

It generates script looks something similar to this one. It also hooks the heart to watchdog the node.  

Personally, I am following an idea to package the application to release and ship it to destination hosts.
Long time ago, I’ve made an empty “erlang release” project as show-case to study and debug various scenarios. You might look on it here:


Best Regards, 
Dmitry


On 12 May 2015, at 19:07, Roberto Ostinelli <[hidden email]> wrote:

Fair enough, however at this point I cannot even a single one of these systems to simply START *and* STOP an Erlang release.
I can easily start it (on ubuntu, `sudo service myapp start`) but the STOP command will always fail. That's because the init script cannot get a grasp of the BEAM process' pid (for some reason), hence it cannot stop it.

Any ideas on how to do that?


On Tue, May 12, 2015 at 5:52 PM, Jesper Louis Andersen <[hidden email]> wrote:

On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <[hidden email]> wrote:
In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.

The heart system in Erlang is a simple watchdog, mostly used if you nothing else that will restart your application. In an SysV init system, there is no automatic watching and restart. In RcNG in FreeBSD, there is no restart. In OpenBSDs rc, there is no automatic restart.

But as you say, many modern init systems also provides watching of the applications it starts, and in that case I wouldn't run with heart enabled. Better to let the system above handle it, and plug into its monitoring/reporting and so on.

Heart is very useful if you start nodes outside the control of the system watchdog though. In that case, they won't be restarted, and you can run heart on those.


--
J.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Tristan Sloughter-4
I'd suggest relx (github.com/erlware/relx) or rebar3 which use relx http://www.rebar3.org/v3.0/docs/releases
 
I've never had to do what you are trying to do but I know the extended_start_script has the ability to return the pid of the running node and `start` uses `run_erl` for running as a daemon and allows attaching through a fifo pipe.
 
It would be great to improve the generated release scripts and whatever else we can to make this easier.
 
--
Tristan Sloughter
 
 
 
On Tue, May 12, 2015, at 11:48 AM, Dmitry Kolesnikov wrote:
Hello Roberto,
 
The rebar makes a dirty work to generate "node release” and necessary bootstrap scripts.  Please check create-node command and concept of erlang releases: 
 
It generates script looks something similar to this one. It also hooks the heart to watchdog the node.  
 
Personally, I am following an idea to package the application to release and ship it to destination hosts.
Long time ago, I’ve made an empty “erlang release” project as show-case to study and debug various scenarios. You might look on it here:
 
 
Best Regards, 
Dmitry
 
 
On 12 May 2015, at 19:07, Roberto Ostinelli <[hidden email]> wrote:
 
Fair enough, however at this point I cannot even a single one of these systems to simply START *and* STOP an Erlang release.
I can easily start it (on ubuntu, `sudo service myapp start`) but the STOP command will always fail. That's because the init script cannot get a grasp of the BEAM process' pid (for some reason), hence it cannot stop it.
 
Any ideas on how to do that?
 
 
On Tue, May 12, 2015 at 5:52 PM, Jesper Louis Andersen <[hidden email]> wrote:
 
 
On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <[hidden email]> wrote:
 
In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.
 
The heart system in Erlang is a simple watchdog, mostly used if you nothing else that will restart your application. In an SysV init system, there is no automatic watching and restart. In RcNG in FreeBSD, there is no restart. In OpenBSDs rc, there is no automatic restart.
 
But as you say, many modern init systems also provides watching of the applications it starts, and in that case I wouldn't run with heart enabled. Better to let the system above handle it, and plug into its monitoring/reporting and so on.
 
Heart is very useful if you start nodes outside the control of the system watchdog though. In that case, they won't be restarted, and you can run heart on those.
 
 
 
--
 
J.
 
 
_______________________________________________
erlang-questions mailing list
http://erlang.org/mailman/listinfo/erlang-questions
 
_______________________________________________
erlang-questions mailing list
 

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Roberto Ostinelli-3
In reply to this post by dmkolesnikov
Hi Dmitry,
I am using rebar to generate the release. Thing is: how do you make the generated script start at boot time of, say, ubuntu? And more importantly, how do you stop it since the pid is unknown to the launching script?



On 12/mag/2015, at 18:48, Dmitry Kolesnikov <[hidden email]> wrote:

Hello Roberto,

The rebar makes a dirty work to generate "node release” and necessary bootstrap scripts.  Please check create-node command and concept of erlang releases: 

It generates script looks something similar to this one. It also hooks the heart to watchdog the node.  

Personally, I am following an idea to package the application to release and ship it to destination hosts.
Long time ago, I’ve made an empty “erlang release” project as show-case to study and debug various scenarios. You might look on it here:


Best Regards, 
Dmitry


On 12 May 2015, at 19:07, Roberto Ostinelli <[hidden email]> wrote:

Fair enough, however at this point I cannot even a single one of these systems to simply START *and* STOP an Erlang release.
I can easily start it (on ubuntu, `sudo service myapp start`) but the STOP command will always fail. That's because the init script cannot get a grasp of the BEAM process' pid (for some reason), hence it cannot stop it.

Any ideas on how to do that?


On Tue, May 12, 2015 at 5:52 PM, Jesper Louis Andersen <[hidden email]> wrote:

On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <[hidden email]> wrote:
In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.

The heart system in Erlang is a simple watchdog, mostly used if you nothing else that will restart your application. In an SysV init system, there is no automatic watching and restart. In RcNG in FreeBSD, there is no restart. In OpenBSDs rc, there is no automatic restart.

But as you say, many modern init systems also provides watching of the applications it starts, and in that case I wouldn't run with heart enabled. Better to let the system above handle it, and plug into its monitoring/reporting and so on.

Heart is very useful if you start nodes outside the control of the system watchdog though. In that case, they won't be restarted, and you can run heart on those.


--
J.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Roberto Ostinelli-3
In reply to this post by Tristan Sloughter-4
Indeed, I'm usong rebar (not relx, not rebar3). AFAIK this option is a relx option unfortunately.

Is is worthy to move to relx for this?



On 12/mag/2015, at 18:58, Tristan Sloughter <[hidden email]> wrote:

I'd suggest relx (github.com/erlware/relx) or rebar3 which use relx http://www.rebar3.org/v3.0/docs/releases
 
I've never had to do what you are trying to do but I know the extended_start_script has the ability to return the pid of the running node and `start` uses `run_erl` for running as a daemon and allows attaching through a fifo pipe.
 
It would be great to improve the generated release scripts and whatever else we can to make this easier.
 
--
Tristan Sloughter
 
 
 
On Tue, May 12, 2015, at 11:48 AM, Dmitry Kolesnikov wrote:
Hello Roberto,
 
The rebar makes a dirty work to generate "node release” and necessary bootstrap scripts.  Please check create-node command and concept of erlang releases: 
 
It generates script looks something similar to this one. It also hooks the heart to watchdog the node.  
 
Personally, I am following an idea to package the application to release and ship it to destination hosts.
Long time ago, I’ve made an empty “erlang release” project as show-case to study and debug various scenarios. You might look on it here:
 
 
Best Regards, 
Dmitry
 
 
On 12 May 2015, at 19:07, Roberto Ostinelli <[hidden email]> wrote:
 
Fair enough, however at this point I cannot even a single one of these systems to simply START *and* STOP an Erlang release.
I can easily start it (on ubuntu, `sudo service myapp start`) but the STOP command will always fail. That's because the init script cannot get a grasp of the BEAM process' pid (for some reason), hence it cannot stop it.
 
Any ideas on how to do that?
 
 
On Tue, May 12, 2015 at 5:52 PM, Jesper Louis Andersen <[hidden email]> wrote:
 
 
On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <[hidden email]> wrote:
 
In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.
 
The heart system in Erlang is a simple watchdog, mostly used if you nothing else that will restart your application. In an SysV init system, there is no automatic watching and restart. In RcNG in FreeBSD, there is no restart. In OpenBSDs rc, there is no automatic restart.
 
But as you say, many modern init systems also provides watching of the applications it starts, and in that case I wouldn't run with heart enabled. Better to let the system above handle it, and plug into its monitoring/reporting and so on.
 
Heart is very useful if you start nodes outside the control of the system watchdog though. In that case, they won't be restarted, and you can run heart on those.
 
 
 
--
 
J.
 
 
_______________________________________________
erlang-questions mailing list
 
_______________________________________________
erlang-questions mailing list
 

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Jesper Louis Andersen-2

It is known through epmd if I remember correctly. So that way you should be able to stop it.


On Tue, May 12, 2015, 19:29 Roberto Ostinelli <[hidden email]> wrote:
Indeed, I'm usong rebar (not relx, not rebar3). AFAIK this option is a relx option unfortunately.

Is is worthy to move to relx for this?



On 12/mag/2015, at 18:58, Tristan Sloughter <[hidden email]> wrote:

I'd suggest relx (github.com/erlware/relx) or rebar3 which use relx http://www.rebar3.org/v3.0/docs/releases
 
I've never had to do what you are trying to do but I know the extended_start_script has the ability to return the pid of the running node and `start` uses `run_erl` for running as a daemon and allows attaching through a fifo pipe.
 
It would be great to improve the generated release scripts and whatever else we can to make this easier.
 
--
Tristan Sloughter
 
 
 
On Tue, May 12, 2015, at 11:48 AM, Dmitry Kolesnikov wrote:
Hello Roberto,
 
The rebar makes a dirty work to generate "node release” and necessary bootstrap scripts.  Please check create-node command and concept of erlang releases: 
 
It generates script looks something similar to this one. It also hooks the heart to watchdog the node.  
 
Personally, I am following an idea to package the application to release and ship it to destination hosts.
Long time ago, I’ve made an empty “erlang release” project as show-case to study and debug various scenarios. You might look on it here:
 
 
Best Regards, 
Dmitry
 
 
On 12 May 2015, at 19:07, Roberto Ostinelli <[hidden email]> wrote:
 
Fair enough, however at this point I cannot even a single one of these systems to simply START *and* STOP an Erlang release.
I can easily start it (on ubuntu, `sudo service myapp start`) but the STOP command will always fail. That's because the init script cannot get a grasp of the BEAM process' pid (for some reason), hence it cannot stop it.
 
Any ideas on how to do that?
 
 
On Tue, May 12, 2015 at 5:52 PM, Jesper Louis Andersen <[hidden email]> wrote:
 
 
On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <[hidden email]> wrote:
 
In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.
 
The heart system in Erlang is a simple watchdog, mostly used if you nothing else that will restart your application. In an SysV init system, there is no automatic watching and restart. In RcNG in FreeBSD, there is no restart. In OpenBSDs rc, there is no automatic restart.
 
But as you say, many modern init systems also provides watching of the applications it starts, and in that case I wouldn't run with heart enabled. Better to let the system above handle it, and plug into its monitoring/reporting and so on.
 
Heart is very useful if you start nodes outside the control of the system watchdog though. In that case, they won't be restarted, and you can run heart on those.
 
 
 
--
 
J.
 
 
_______________________________________________
erlang-questions mailing list
 
_______________________________________________
erlang-questions mailing list
 
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Tristan Sloughter-4
In reply to this post by Roberto Ostinelli-3
The start script generated using rebar should also have a getpid supported argument and a start that works the same. The scripts between relx and rebar are nearly identical.
 
But I'd still suggest moving to relx over reltool :)
 
--
Tristan Sloughter
 
 
 
On Tue, May 12, 2015, at 12:29 PM, Roberto Ostinelli wrote:
Indeed, I'm usong rebar (not relx, not rebar3). AFAIK this option is a relx option unfortunately.
 
Is is worthy to move to relx for this?
 
 
 
On 12/mag/2015, at 18:58, Tristan Sloughter <[hidden email]> wrote:
 
I'd suggest relx (github.com/erlware/relx) or rebar3 which use relx http://www.rebar3.org/v3.0/docs/releases
 
I've never had to do what you are trying to do but I know the extended_start_script has the ability to return the pid of the running node and `start` uses `run_erl` for running as a daemon and allows attaching through a fifo pipe.
 
It would be great to improve the generated release scripts and whatever else we can to make this easier.
 
--
Tristan Sloughter
 
 
 
On Tue, May 12, 2015, at 11:48 AM, Dmitry Kolesnikov wrote:
Hello Roberto,
 
The rebar makes a dirty work to generate "node release” and necessary bootstrap scripts.  Please check create-node command and concept of erlang releases: 
 
It generates script looks something similar to this one. It also hooks the heart to watchdog the node.  
 
Personally, I am following an idea to package the application to release and ship it to destination hosts.
Long time ago, I’ve made an empty “erlang release” project as show-case to study and debug various scenarios. You might look on it here:
 
 
Best Regards, 
Dmitry
 
 
On 12 May 2015, at 19:07, Roberto Ostinelli <[hidden email]> wrote:
 
Fair enough, however at this point I cannot even a single one of these systems to simply START *and* STOP an Erlang release.
I can easily start it (on ubuntu, `sudo service myapp start`) but the STOP command will always fail. That's because the init script cannot get a grasp of the BEAM process' pid (for some reason), hence it cannot stop it.
 
Any ideas on how to do that?
 
 
On Tue, May 12, 2015 at 5:52 PM, Jesper Louis Andersen <[hidden email]> wrote:
 
 
On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <[hidden email]> wrote:
 
In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.
 
The heart system in Erlang is a simple watchdog, mostly used if you nothing else that will restart your application. In an SysV init system, there is no automatic watching and restart. In RcNG in FreeBSD, there is no restart. In OpenBSDs rc, there is no automatic restart.
 
But as you say, many modern init systems also provides watching of the applications it starts, and in that case I wouldn't run with heart enabled. Better to let the system above handle it, and plug into its monitoring/reporting and so on.
 
Heart is very useful if you start nodes outside the control of the system watchdog though. In that case, they won't be restarted, and you can run heart on those.
 
 
 
--
 
J.
 
 
_______________________________________________
erlang-questions mailing list
 
_______________________________________________
erlang-questions mailing list
 
 

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

dmkolesnikov
In reply to this post by Roberto Ostinelli-3
Hello,

This is business as usual. If you generate myapp release and deploy it to /usr/local then you can create very simple script to init.d

See it here

e.g.

#!/bin/bash
export HOME=/root
/usr/local/myapp/bin/myapp $1

- Dmitry


On 12 May 2015, at 20:28, Roberto Ostinelli <[hidden email]> wrote:

Hi Dmitry,
I am using rebar to generate the release. Thing is: how do you make the generated script start at boot time of, say, ubuntu? And more importantly, how do you stop it since the pid is unknown to the launching script?



On 12/mag/2015, at 18:48, Dmitry Kolesnikov <[hidden email]> wrote:

Hello Roberto,

The rebar makes a dirty work to generate "node release” and necessary bootstrap scripts.  Please check create-node command and concept of erlang releases: 

It generates script looks something similar to this one. It also hooks the heart to watchdog the node.  

Personally, I am following an idea to package the application to release and ship it to destination hosts.
Long time ago, I’ve made an empty “erlang release” project as show-case to study and debug various scenarios. You might look on it here:


Best Regards, 
Dmitry


On 12 May 2015, at 19:07, Roberto Ostinelli <[hidden email]> wrote:

Fair enough, however at this point I cannot even a single one of these systems to simply START *and* STOP an Erlang release.
I can easily start it (on ubuntu, `sudo service myapp start`) but the STOP command will always fail. That's because the init script cannot get a grasp of the BEAM process' pid (for some reason), hence it cannot stop it.

Any ideas on how to do that?


On Tue, May 12, 2015 at 5:52 PM, Jesper Louis Andersen <[hidden email]> wrote:

On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <[hidden email]> wrote:
In non-erlang systems, I would have standard watchdogs that launch an application on OS boot, and then monitor it and relaunch it if necessary.

The heart system in Erlang is a simple watchdog, mostly used if you nothing else that will restart your application. In an SysV init system, there is no automatic watching and restart. In RcNG in FreeBSD, there is no restart. In OpenBSDs rc, there is no automatic restart.

But as you say, many modern init systems also provides watching of the applications it starts, and in that case I wouldn't run with heart enabled. Better to let the system above handle it, and plug into its monitoring/reporting and so on.

Heart is very useful if you start nodes outside the control of the system watchdog though. In that case, they won't be restarted, and you can run heart on those.


--
J.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Roberto Ostinelli-3
In reply to this post by Jesper Louis Andersen-2


> On 12/mag/2015, at 19:31, Jesper Louis Andersen <[hidden email]> wrote:
>
> It is known through epmd if I remember correctly. So that way you should be able to stop it.

Thank you Jesper,
Do you hve an example on how to do so?
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Roberto Ostinelli-3
In reply to this post by Tristan Sloughter-4

> On 12/mag/2015, at 19:34, Tristan Sloughter <[hidden email]> wrote:
>
> The start script generated using rebar should also have a getpid supported argument and a start that works the same. The scripts between relx and rebar are nearly identical.

Right. Unfortunately I can't find a way to oass this pid to the original script that starts it (using upstart).

Oh well. Will dig further. :)

thanks!
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Roger Lipscombe-2
On 12 May 2015 at 18:45, Roberto Ostinelli
<[hidden email]> wrote:
> Right. Unfortunately I can't find a way to oass this pid to the original script that starts it (using upstart).

We use relx-generated releases with upstart. Simply run "bin/myapp
foreground" from the upstart script.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Roberto Ostinelli-3


> On 12/mag/2015, at 20:44, Roger Lipscombe <[hidden email]> wrote:
>
> We use relx-generated releases with upstart. Simply run "bin/myapp
> foreground" from the upstart script.

Yes this seems to be a good idea. Thank you.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Eric Pailleau
Hi,

Or let your program inherit of your current pid, something like :

echo $$ > /var/run/myapp.pid
exec bin/myapp start

Regards

Le 12 mai 2015 20:53, Roberto Ostinelli <[hidden email]> a écrit :

>
>
>
> > On 12/mag/2015, at 20:44, Roger Lipscombe <[hidden email]> wrote:
> >
> > We use relx-generated releases with upstart. Simply run "bin/myapp
> > foreground" from the upstart script.
>
> Yes this seems to be a good idea. Thank you.
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions 
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: HEART

Miles Fidelman
In reply to this post by dmkolesnikov
> On Mon, May 11, 2015 at 9:13 PM, Roberto Ostinelli <
> > wrote:
>
> >/  In non-erlang systems, I would have standard watchdogs that launch an
> />/  application on OS boot, and then monitor it and relaunch it if necessary.
> /
>
> The heart system in Erlang is a simple watchdog, mostly used if you nothing
> else that will restart your application. In an SysV init system, there is
> no automatic watching and restart. In RcNG in FreeBSD, there is no restart.
> In OpenBSDs rc, there is no automatic restart.
>

Wait a minute - isn't that what respawn does in a SysV init environment?

Of course that only works if the VM well and truly dies.  If it locks up, you still have a problem.

Anybody see a reason you couldn't:
1. start BEAM with respawn
2. start a separate watchdog process that periodically runs a few tests to see if BEAM is running properly,
and if not, KILLs the process - at which point respawn would take care of a restart.

Miles Fidelman


--
In theory, there is no difference between theory and practice.
In practice, there is.   .... Yogi Berra

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
12