Health check curl example

Marc Roos
Mon, 25 Nov 2019 12:30:47 -0000

I can't yet use -p, the version I have is not supporting it still :(
Maybe it is better to wait until alpine linux updates the package.



-----Original Message-----

Subject: RE: Health check curl example

No worries. Now you are not using the passthrough(-p) mode. That is why
dovecot is telling you that your client is not compatible.

Using "script" without -p would require you to implement that
protocol:
http://doc.dovecot.org/admin_manual/health_check.html#script-protocol.

I believe all you want to do is to keep this line

  executable = script -p health-check.sh

and just replace health-check.sh with the script that you implemented.

> On November 25, 2019 11:48 AM Marc Roos via dovecot
<dovecot at dovecot.org> wrote:
>
>
> :) I really starting to feel a bit like an idiot, but all these 3
> configs[0] give error 'Client not compatible with this binary'
>
> [0]
> service health-check {
>   executable = script /bin/health-check.sh
>   inet_listener health-check {
>       port = 5001
>  }
> }
>
> service health-check {
>   executable = script -e "HOME PATH" /bin/health-check.sh
>   inet_listener health-check {
>       port = 5001
>  }
> }
>
> service health-check {
>   executable = script -e HOME PATH /bin/health-check.sh
>   inet_listener health-check {
>       port = 5001
>  }
> }
>
>
> Nov 25 11:44:52 test2 dovecot: script: Fatal: Client not compatible
> with this binary (connecting to wrong socket?)
>
>
> -----Original Message-----
> Subject: RE: Health check curl example
>
> The -e parameter is used to define a "list of environment
variables",
> so the error message telling you that you did not define a script is
right.
>
>
> So far i understood that you wanted to use passthrough mode, so do not

> use -e but -p. (except you need to define some environment-variables
> for your script).
>
> Executing the script executable standalone does not work it must be
> started from the dovecot master process, that is why you are getting
> the Panic.
>
> Markus
>
> > On November 25, 2019 10:06 AM Marc Roos <m.roos at
f1-outsourcing.eu>
> wrote:
> >
> >
> > Thanks, Markus, maybe we should add this to the admin_manual?
> > However I am now getting the error 'script: Fatal: Missing script
path'
> >
> > Similar as when I try via the command line bash-5.0#
> > /usr/libexec/dovecot/script -e  /bin/health-check.sh
> > Fatal: Missing script path
> >
> >
> > bash-5.0# /usr/libexec/dovecot/script -e  /bin/ health-check.sh
> > Panic: BUG: No IOs or timeouts set. Not waiting for infinity.
> > Aborted (core dumped)
> >
> >
> >
> >
> > -----Original Message-----
> > Subject: Re: Health check curl example
> >
> > Hi,
> >
> > you can use telnet or netcat to send input to that port and receive
> > the answer.
> >
> > echo "PING" | nc localhost 5001
> >
> > Best regards
> >
> > Markus
> >
> >
> > On 11/24/19 2:43 PM, Marc Roos via dovecot wrote:
> > >
> > > How do I check the standard script then on this port 5001 from
the

> > > command line?
> > >
> > >
> > > This one of alpine linux also does not have it yet bash-5.0#
> > > dovecot
>
> > > --version
> > > 2.3.7.2 (3c910f64b)
> > >
> > >
> > >
> > >
> > >
> > > -----Original Message-----
> > > Subject: RE: Health check curl example
> > >
> > > Yes. The passthrough option is rather new.
> > >
> > > Aki
> > >
> > > 	On 24/11/2019 15:28 Marc Roos via dovecot <
> dovecot at dovecot.org>
> > > wrote:
> > >
> > >
> > > 	I think I already have that, I am having this configured
> > >
> > > 	service health-check {
> > > 	# this is the default configuration using the simple
PING->PONG
>
> > > 	# example health-check.
> > > 	executable = script -p /bin/health-check.sh
> > > 	inet_listener health-check {
> > > 	port = 5001
> > > 	}
> > > 	}
> > >
> > > 	bash-5.0# /bin/health-check.sh
> > > 	HTTP/1.1 200 OK
> > > 	Connection: keep-alive
> > >
> > > 	OK
> > >
> > >
> > >
> > >
> > >
> > > 	-----Original Message-----
> > > 	Subject: Re: Health check curl example
> > >
> > > 	Your health check script should implement HTTP protocol. Then
> you
> > can
> > > 	use passthrough mode and use cURL.
> > >
> > > 	The provided script does not speak HTTP.
> > >
> > > 	Aki
> > >
> > > 	On 24/11/2019 15:12 Marc Roos via dovecot <
> dovecot at dovecot.org>
> > > 	wrote:
> > >
> > >
> > > 	I am not understanding how this health check[1] script should
> > work.
> > >
> > > 	From
> > > 	the commandline it works fine when I type a PING I get a
PONG.
> > But
> > > 	how
> > > 	do I do a curl to this 5001 port?
> > >
> > > 	Tried something like this:
> > >
> > > 	bash-5.0# curl http://localhost:5001/
> > > 	curl: (56) Recv failure: Connection reset by peer
> > >
> > > 	bash-5.0# curl http://localhost:5001/PING
> > > 	curl: (56) Recv failure: Connection reset by peer
> > >
> > > 	[1]
> > > 	https://doc.dovecot.org/admin_manual/health_check/
> > >
> > >
> > > 	---
> > > 	Aki Tuomi
> > >
> > >
> > > ---
> > > Aki Tuomi
> > >
> > >