Re: resolve dependency between services

2014-05-21 Thread Sebastian
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 ro...@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@lists.ubuntu.com
 Modify settings or unsubscribe at:
 https://lists.ubuntu.com/mailman/listinfo/juju


-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: resolve dependency between services

2014-05-21 Thread Andrew Wilkins
On Wed, May 21, 2014 at 10:53 PM, Tudor Rogoz ro...@adobe.com wrote:

   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.

Stuart answered the main points; I'd like to add one more thing: we have
some work scheduled to enable charms to report that they are not yet ready.
The driver is exactly what you're describing: applications that require a
relation to be usable.

  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@lists.ubuntu.com
 Modify settings or unsubscribe at:
 https://lists.ubuntu.com/mailman/listinfo/juju


-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju