backend/director admin states

Poul-Henning Kamp phk at
Fri May 4 07:42:33 UTC 2018

In message <CABoVN9CaL9pMqAaemi_3ehkqverv--034KEN7_wrSAD9RwG0_A at>
, Dridi Boukelmoune writes:

>I experimented with this a while back and tried this:
>I never completed the last experiment because the time I allocated
>eventually ran out and I lost motivation to nail down the schema part.

I appreciate the effort, having personally been down that road a
number of times in my career, all in vain.

I think my conclusion at this point is that I have not seen an
actual schema work anywhere - ever.  That is not to say that schemas
cannot ever work, they proabably can in certain limited circumstances.

The reason we have include/tbl/cli_cmds.h in the first place was
that I wanted some kind of "schema-light" for UX use, but that
didn't happen.

Instead varnishadm issues a "help" command, to get the _actual_
commands available.

Varnishadm was a convenience, and the intent was that people could
connect to the CLI with any random script they cared to write.

Once we did the PSK-authentication, telnet'ing became a lot less
relevant, and varnishadm became the defacto CLI access tool.

Therefore it is relevant to consider a design-change so varnishd
only responds with JSON (but it can and should be nicely formatted
JSON), and varnishadm gets to render that nicely for the user.

Amongst many other UX advantages, varnishadm can know the width of
terminal windows, and the availability of colors and exploit that.

But if you try to impose a schema between varnishd and varnishadm,
you either loose access to all the really nifty things varnishadm
could do, or you spend the rest of your life trying to define a
schema which can express them.

I would argue that almost everybody have given up on schemas by
now, and switched to shipping code:

Your average website sends a shitload of JS code and datastructures
for it to act on to your browser.

I don't see a need for varnishd to ship code to varnishadm though,
so I'd be happy with a design where varnishd CLI always spits out
JSON, and varnishadm is responsible for formatting it, if required.

As long as somebody who is not me writes the code for it...

PS: We have a solid JSON parser in the tree already.

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-dev mailing list