[Supervisor-users] Newbie question: How to ensure program has access to e.g. database or AMQP server?

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

[Supervisor-users] Newbie question: How to ensure program has access to e.g. database or AMQP server?

Peter Valdemar Mørch
Supervisord looks like it is *exactly* what I need. Thank you!

Now, I have a [program:AMQPconsumer] that obviosly needs access to a running AMQP server. Probably on localhost, but that could change.

I've just installed the "supervisor" package in debian, and I haven't fiddled with /etc/init.d/supervisor, so there is no guarantee that supervisor will start my AMQP consumer after RabbitMQ has started.

What I've done for now is have a little loop that 30 times tries to connect to RabbitMQ and sleeps 1sec if it doesn't succeed. Works fine.

But being a newbie: Is there a best-practice on how to do this? I'd rather not make changes to /etc/init.d/supervisor to ensure it starts after RabbitMQ, because that doesn't scale. The next [program:whatever] may need some other service. Putting a "30 times: connect or sleep 1 second" loop in all my [program:?]s just seems sloppy to me.

Best regards,

Peter
--
Peter Valdemar Mørch
http://www.morch.com

_______________________________________________
Supervisor-users mailing list
[hidden email]
http://lists.supervisord.org/mailman/listinfo/supervisor-users
Reply | Threaded
Open this post in threaded view
|

Re: [Supervisor-users] Newbie question: How to ensure program has access to e.g. database or AMQP server?

Andres Reyes
You could try to start RabbitMQ with supervisor to, that way you can
set different startup priorities in the same place



2012/10/18 Peter Valdemar Mørch <[hidden email]>:

> Supervisord looks like it is *exactly* what I need. Thank you!
>
> Now, I have a [program:AMQPconsumer] that obviosly needs access to a running
> AMQP server. Probably on localhost, but that could change.
>
> I've just installed the "supervisor" package in debian, and I haven't
> fiddled with /etc/init.d/supervisor, so there is no guarantee that
> supervisor will start my AMQP consumer after RabbitMQ has started.
>
> What I've done for now is have a little loop that 30 times tries to connect
> to RabbitMQ and sleeps 1sec if it doesn't succeed. Works fine.
>
> But being a newbie: Is there a best-practice on how to do this? I'd rather
> not make changes to /etc/init.d/supervisor to ensure it starts after
> RabbitMQ, because that doesn't scale. The next [program:whatever] may need
> some other service. Putting a "30 times: connect or sleep 1 second" loop in
> all my [program:?]s just seems sloppy to me.
>
> Best regards,
>
> Peter
> --
> Peter Valdemar Mørch
> http://www.morch.com
>
> _______________________________________________
> Supervisor-users mailing list
> [hidden email]
> http://lists.supervisord.org/mailman/listinfo/supervisor-users
>



--
Andrés Reyes Monge
[hidden email]
+(505)-8873-7217
_______________________________________________
Supervisor-users mailing list
[hidden email]
http://lists.supervisord.org/mailman/listinfo/supervisor-users
Reply | Threaded
Open this post in threaded view
|

Re: [Supervisor-users] Newbie question: How to ensure program has access to e.g. database or AMQP server?

Peter Valdemar Mørch
On Thu, Oct 18, 2012 at 10:19 PM, Andres Reyes <[hidden email]> wrote:
You could try to start RabbitMQ with supervisor to, that way you can
set different startup priorities in the same place

But then I'm still making changes to init.d scripts and that still doesn't scale.

Today its RabbitMQ, soon it will be MySQL and memcached and snmpd (yes) and... Actually, in addition, the system already has other packages' init.d scripts that depend on mysql, so they'd have to be controlled by supervisor too. Pretty soon it will become an init.d replacement. And with that approach then I need to understand all the intricacies of starting each of them and test and debug it. No thanks. That is what the well tested debian /etc/init.d/ scripts and e.g. update-rc.d are for.

Sorry if I present myself as a newbie and then don't take the advice I'm given, but I sense system stability and maintenance issues going down that route. Then, for now, the 30*loop seems cleaner to me.

But thank you for taking the time to write!

Peter
--
Peter Valdemar Mørch
http://www.morch.com

_______________________________________________
Supervisor-users mailing list
[hidden email]
http://lists.supervisord.org/mailman/listinfo/supervisor-users
Reply | Threaded
Open this post in threaded view
|

Re: [Supervisor-users] Newbie question: How to ensure program has access to e.g. database or AMQP server?

Philip Zeyliger
In reply to this post by Peter Valdemar Mørch
I don't use the supervisord init scripts, but, in general, init scripts have a mechanism for ordering.  See http://wiki.debian.org/LSBInitScripts.  In short, the name of the symlink in /etc/rc[2-5].d determines the start order.

On Thu, Oct 18, 2012 at 1:15 PM, Peter Valdemar Mørch <[hidden email]> wrote:
Supervisord looks like it is *exactly* what I need. Thank you!

Now, I have a [program:AMQPconsumer] that obviosly needs access to a running AMQP server. Probably on localhost, but that could change.

I've just installed the "supervisor" package in debian, and I haven't fiddled with /etc/init.d/supervisor, so there is no guarantee that supervisor will start my AMQP consumer after RabbitMQ has started.

What I've done for now is have a little loop that 30 times tries to connect to RabbitMQ and sleeps 1sec if it doesn't succeed. Works fine.

But being a newbie: Is there a best-practice on how to do this? I'd rather not make changes to /etc/init.d/supervisor to ensure it starts after RabbitMQ, because that doesn't scale. The next [program:whatever] may need some other service. Putting a "30 times: connect or sleep 1 second" loop in all my [program:?]s just seems sloppy to me.

Best regards,

Peter
--
Peter Valdemar Mørch
http://www.morch.com

_______________________________________________
Supervisor-users mailing list
[hidden email]
http://lists.supervisord.org/mailman/listinfo/supervisor-users



_______________________________________________
Supervisor-users mailing list
[hidden email]
http://lists.supervisord.org/mailman/listinfo/supervisor-users