Hello, Anybody now how make with puppet dependence on other service on another node? like : require => Service[dbnode:postgresql] I need ensure that the db is running on another node before start my appserver. Thank you. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Bruce Richardson
2010-Oct-29 18:53 UTC
Re: [Puppet Users] require service started at another node
On Fri, Oct 29, 2010 at 04:56:34AM -0700, Leonko wrote:> Hello, > Anybody now how make with puppet dependence on other service on > another node? > > like : require => Service[dbnode:postgresql] > I need ensure that the db is running on another node before start my > appserver.You can''t do this directly. Even if you were to use storeconfigs to get at facts about other nodes, all that would tell you is that the database service was running the last time puppet ran on that node. Besides, the important thing to know, even more important than whether the service is running on the dbnode, is whether you can usefully connect to the service from your appserver node. Even if the service is running, other things might prevent that. I think the best approach would be to have a test that runs on your appservernode, connects to your postgres server and does a simple status check. You could do this as a custom fact, so that it set a variable like $dbservice to true or false, or you could do it as an exec. But can your application server really not cope with the database service not being available? Can they not present a useful error message if the database is broken? How will you cope if the database service dies once your appserver has started? -- Bruce If the universe were simple enough to be understood, we would be too simple to understand it. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Ohad Levy
2010-Oct-29 19:09 UTC
Re: [Puppet Users] require service started at another node
You can try using something like http://github.com/puppetlabs/puppet-external-resource Ohad On Fri, Oct 29, 2010 at 1:56 PM, Leonko <the.leonko@gmail.com> wrote:> Hello, > Anybody now how make with puppet dependence on other service on > another node? > > like : require => Service[dbnode:postgresql] > I need ensure that the db is running on another node before start my > appserver. > > Thank you. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hello, Bruce. At now we have hard dependence between file storage, db server and appserver. If it chain broken at any phase we get the message from zabbix. And we try it automatize this action. On 29 окт, 21:53, Bruce Richardson <itsbr...@workshy.org> wrote:> On Fri, Oct 29, 2010 at 04:56:34AM -0700, Leonko wrote:> But can your application server really not cope with the database > service not being available? Can they not present a useful error > message if the database is broken? How will you cope if the database > service dies once your appserver has started? > > -- > Bruce > > If the universe were simple enough to be understood, we would be too > simple to understand it.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thanks, but I didn''t understand how it works. Maybe you know documentation for this module? On 29 окт, 22:09, Ohad Levy <ohadl...@gmail.com> wrote:> You can try using something likehttp://github.com/puppetlabs/puppet-external-resource > > Ohad > > On Fri, Oct 29, 2010 at 1:56 PM, Leonko <the.leo...@gmail.com> wrote: > > Hello, > > Anybody now how make with puppet dependence on other service on > > another node? > > > like : require => Service[dbnode:postgresql] > > I need ensure that the db is running on another node before start my > > appserver. > > > Thank you. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Puppet Users" group. > > To post to this group, send email to puppet-users@googlegroups.com. > > To unsubscribe from this group, send email to > > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/puppet-users?hl=en.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Bruce Richardson
2010-Nov-01 07:43 UTC
Re: [Puppet Users] Re: require service started at another node
On Sun, Oct 31, 2010 at 11:44:51PM -0700, Leonko wrote:> Hello, Bruce. At now we have hard dependence between file storage, db > server and appserver. If it chain broken at any phase we get the > message from zabbix.But that''s not a problem. Zabbix is monitoring software: it *should* tell you when important services are broken.> And we try it automatize this action.Fine. But you can''t use a single puppet run to make it all happen. Use puppet on the database server to make sure that postgresql is running properly and use puppet on the application host to make sure that the application server is running *if* the database server is available. Puppet can automate that much for you. If you want to have the minimum time between the database server coming up and the application server starting, there are a number of ways you could do that; the application host could be checking the db connection on a regular basis, for instance, or the db server could signal the application host once the app is up. But really, your best plan is to 1. Make sure that your database service is up early, as resilient as you can make it and rarely restarted. 2. Make your application server tolerant of database downtime (that is, have the applications generate sensible errors while the db is down and recover when it is up, rather than just crash and require an application server restart). -- Bruce Bitterly it mathinketh me, that I spent mine wholle lyf in the lists against the ignorant. -- Roger Bacon, "Doctor Mirabilis" -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
> > 1. Make sure that your database service is up early, as resilient as > you can make it and rarely restarted. >Thank you. Maybe you know method to validate what db is start early. It''s very important for me.> 2. Make your application server tolerant of database downtime (that > is, have the applications generate sensible errors while the db is down > and recover when it is up, rather than just crash and require an > application server restart).If appserver (java app server like jboss) start and can''t find db it''s crash and need to restart by hand. We are unable to do anything with it.> > -- > Bruce > > Bitterly it mathinketh me, that I spent mine wholle lyf in the lists > against the ignorant. -- Roger Bacon, "Doctor Mirabilis"-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Patrick
2010-Nov-01 08:06 UTC
Re: [Puppet Users] Re: require service started at another node
On Nov 1, 2010, at 12:57 AM, Leonko wrote:> >> >> 1. Make sure that your database service is up early, as resilient as >> you can make it and rarely restarted. >> > > Thank you. Maybe you know method to validate what db is start early. > It''s very important for me. > > >> 2. Make your application server tolerant of database downtime (that >> is, have the applications generate sensible errors while the db is down >> and recover when it is up, rather than just crash and require an >> application server restart). > > If appserver (java app server like jboss) start and can''t find db > it''s crash and need to restart by hand. We are unable to do anything > with it.Can you give your app a babysitter wrapper service? This sounds like it might be useful just for uptime. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thomas Bendler
2010-Nov-01 08:12 UTC
Re: [Puppet Users] Re: require service started at another node
2010/11/1 Leonko <the.leonko@gmail.com>> [...] > > 2. Make your application server tolerant of database downtime (that > > is, have the applications generate sensible errors while the db is down > > and recover when it is up, rather than just crash and require an > > application server restart). > > If appserver (java app server like jboss) start and can''t find db > it''s crash and need to restart by hand. We are unable to do anything > with it. >Make a start script for the Appserver which do the steps for you: #! /bin/sh checkdb () { [... code to check if DB is up ...] } startdb () { [... code to start DB if down ...] } startApp () { [... code to start App if down ...] } if [ ! $(checkdb) ]; then startdb sleep 60 if [ ! $(checkdb) ]; then echo "Failed, couldn''t start DB!"; exit else startApp fi fi You can also implement it as a watchdog if you put your code in a construct like this: while true; do [... start logic with checks ...] sleep 30 done Kind regards, Thomas -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
You can say more about it? I do not understand what you say?> Can you give your app a babysitter wrapper service? This sounds like it might be useful just for uptime.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Patrick
2010-Nov-01 08:20 UTC
Re: [Puppet Users] Re: require service started at another node
On Nov 1, 2010, at 1:14 AM, Leonko wrote:> You can say more about it? I do not understand what you say? > > >> Can you give your app a babysitter wrapper service? This sounds like it might be useful just for uptime.The idea is that you wrap this app in a service. The wrapper is started, stopped, and restarted like a normal service. When the wrapper is running, ensures that your application is running. If your application is not running, the wrapper waits a set time and then starts your app. The wait time is because you don''t want to load the server by instantly restarting. This is because if you app crashes during startup every time, you don''t want your server to be excessively loaded by the restart attempts. Stopping the wrapper stops your app. Starting the wrapper starts your app. (then makes sure it keeps running) Sending a restart to the wrapper, stops the wrapper and then starts the wrapper. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
John Warburton
2010-Nov-01 10:12 UTC
Re: [Puppet Users] require service started at another node
On 29 October 2010 22:56, Leonko <the.leonko@gmail.com> wrote:> Hello, > Anybody now how make with puppet dependence on other service on > another node? > > You could try looking at it like an application control problem and usetools that sit on top of puppet - like ControlTier - http://blog.controltier.com/2009/04/new-whitepaper-achieving-fully.html john -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thank you. But I think I prefer "func" for this job and start it from main node On Nov 1, 11:12 am, Thomas Bendler <thomas.bend...@cimt.de> wrote:> 2010/11/1 Leonko <the.leo...@gmail.com> > > > [...] > > > 2. Make your application server tolerant of database downtime (that > > > is, have the applications generate sensible errors while the db is down > > > and recover when it is up, rather than just crash and require an > > > application server restart). > > > If appserver (java app server like jboss) start and can''t find db > > it''s crash and need to restart by hand. We are unable to do anything > > with it. > > Make a start script for the Appserver which do the steps for you: > > #! /bin/sh > > checkdb () { > [... code to check if DB is up ...] > > } > > startdb () { > [... code to start DB if down ...] > > } > > startApp () { > [... code to start App if down ...] > > } > > if [ ! $(checkdb) ]; then > startdb > sleep 60 > if [ ! $(checkdb) ]; then > echo "Failed, couldn''t start DB!"; exit > else > startApp > fi > fi > > You can also implement it as a watchdog if you put your code in a construct > like this: > > while true; do > [... start logic with checks ...] > sleep 30 > done > > Kind regards, Thomas-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thank you. It''s real helpful. On Nov 1, 1:12 pm, John Warburton <jwarbur...@gmail.com> wrote:> On 29 October 2010 22:56, Leonko <the.leo...@gmail.com> wrote: > > > Hello, > > Anybody now how make with puppet dependence on other service on > > another node? > > > You could try looking at it like an application control problem and use > > tools that sit on top of puppet - like ControlTier -http://blog.controltier.com/2009/04/new-whitepaper-achieving-fully.html > > john-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Bruce Richardson
2010-Nov-01 15:12 UTC
Re: [Puppet Users] Re: require service started at another node
> > 2. Make your application server tolerant of database downtime (that > > is, have the applications generate sensible errors while the db is down > > and recover when it is up, rather than just crash and require an > > application server restart). > > If appserver (java app server like jboss) start and can''t find db > it''s crash and need to restart by hand. We are unable to do anything > with it.Then you need to rethink how you design and deploy your java applications. I have worked with Java, Tomcat, Jboss and similar systems; it is perfectly possible to deploy java applications in a way which allows them to cope with the temporary absence of a database server. -- Bruce Bitterly it mathinketh me, that I spent mine wholle lyf in the lists against the ignorant. -- Roger Bacon, "Doctor Mirabilis" -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.