resolve dependency between services

Sebastian sebas5384 at gmail.com
Wed May 21 17:35:25 UTC 2014


Hey Tudor! thanks for doing a new charm! :D

I can show you a charm I'm doing for Drupal, take a look:
https://github.com/sebas5384/charm-drupal

Drupal needs MySQL to work, so you can do:
- Only enable ports like 80 when the db-relation-changed hook is fired, and
the relation to mysql must be required in the metadata.yaml
- You can do a bundle to ensure the topology, like openstack for example.

I'm planning to do the two :)

Cheers,
Sebas.



2014-05-21 11:53 GMT-03:00 Tudor Rogoz <rogoz at adobe.com>:

>   Hi,
>
>
>  I'm new to juju and I just started to work on a new charm and I'm not
> sure how to solve several issues.I will appreciate any advice on this.
>
>
>  The topology that I want to achieve is described bellow:
>
>
>  My service (i will call it application service) "strongly" depends on
> the mongodb service [0].This means that the application service cannot be
> installed and started without a mongo previously configured for storing the
> application data.The problem is that when I'm deploying the service,
> automatically the install, config-service and start hooks will be
> triggered, but at this point my service cannot know about mongo service
> because a relation between the 2 services is not established yet.So, it's
> impossible for me to perform the product installation in the install
> hook.An ugly workaround would be to perform the installation in the
> relation-joined/relation-cahnged hook, but this would be my last
> option.Even in this case the service unit will appear as "started" after
> the start hook ends, but nothing will actually run there.
>
> I would like for the charm to support the following scenario.
>
> 1/I deploy the application service
>
> 2/ the service unit remains in a pending state before the installation
> hook will run because the service unit has no access to a mongo service
>
> 3/ deploy the mongo service which successfully starts
>
> 4/ add a relation between mongo and application service. The app service
> will get the mongo connection information
>
> 5/ application service installation starts (the install hook is
> unblocked), and successfully starts
>
>
>
>  Another problem that i have is the following:
>
>    For example, one of my application units is getting the connection
> details from a specific mongodb unit while running the relation hook, were
> i can store the specific information for using it in another hook? Is there
> anything implemented in juju for this, or I should write the information in
> a file and store it on disk and read from there when is need it?
>
>
>  [0] https://github.com/charms/mongodb
>     <https://github.com/charms/mongodb>
>   charms/mongodb · GitHub
>  mongodb - Mirror of juju charm, pull requests and modifications welcome!
>  Read more... <https://github.com/charms/mongodb>
>>
>
>  Thanks a lot,
>
> Tudor
>
>
>
> --
> Juju mailing list
> Juju at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20140521/26f9d2ca/attachment.html>


More information about the Juju mailing list