Hooks and interfaces!
Tom Barber
tom at analytical-labs.com
Fri Feb 26 00:34:37 UTC 2016
Hello folks,
This is not a complaint more a story of how this afternoon has gone.
I'm writing a gitlab charm, in doing so marco suggested that we add some
hooks to optionally offload some of the services, like web server and
database elsewhere should the user desire. Very sane plan, I thought.
So today I figured I'd work out how to plugin another webserver over the
top. The charm is a new layered job that extends the basic layer and not
much more. Because of a curiosity about getting used to python, I have
recently been writing code in Juju in Python, I realise this slows me down
as most examples are in bash but its a good way to learn.
Out of the box Gitlab claims to support Apache2 and Nginx but to me it
basically looks like a standard reverse proxy although I'm yet to test it
in anger. So i figured I'd slap apache2 next to it and see how we got on.
We didn't. For some reason I am yet to fathom this block of now commented
code never seemed to fire:
https://github.com/OSBI/layer-gitlab/blob/master/reactive/gitlabhooks.py#L14
Am I missing something in reactive charms? If I juju debug-hooks and copied
the code into the website-relation-changed hook it ran fine.
Anyway, after a few hours messing around trying to figure that out and
giving up I realised after just randomly googling there was an http
interface that did a similar job. Low and behold 10 minutes later with
haproxy and one @when('website.available') method it seemed to be
configuring itself with haproxy just fine.
So here's the question. I'm all up for reactive charm stuff, but am I
missing something with hook triggering? Do I need a placeholder still in
the hooks directory? It appears not, but I'm not sure.
Also, and more importantly going forward after much digging around to
find interfaces.juju.solution is there, or will there be a way to find out
what charms implement what layers. For example, I now seem to have found
out that haproxy loves the http interface, but apache2 is yet to go
reactive, so I guess I'm stuck with hooks for that if I chose to use it,
but, without looking at the code, I don't know that. It would be great,
would it not, to expose that type of stuff. I'm sure its all in the
pipeline and you'll tell me its coming shortly, but I figure the feedback
might prove useful to someone. Also from an interface point of view, whilst
listing the supported interfaces in a charm in the charm store would be
great, what i would love, if it does not already exist, is for me to say,
okay, I need a reverseproxy through the http interface, what charms are
available that allow me to do that? Is it just haproxy, or are there
others. This information is key to easy (for those outside of canonical)
charm development.
Thanks and keep up the cool stuff in Juju 2.
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20160226/162d24d1/attachment.html>
More information about the Juju
mailing list