resolve dependency between services

Tudor Rogoz rogoz at adobe.com
Wed May 21 14:53:34 UTC 2014


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://avatars1.githubusercontent.com/u/1050808?s=400]<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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20140521/491580bd/attachment.html>


More information about the Juju mailing list