Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My service recipe: DB Server <-> App Server <-> Web Reverse Proxy.

My relation requirements are:

  • 1 unit of DB Server related 1 (specific) unit of App Server
  • 1 unit of Web Reverse Proxy related to all App Servers

Given below is a sequence of Juju commands, that will happen in my case

Expected Steps are (correct me if I am wrong):

Phase - Install

  1. Deploy Db
  2. Deploy App Server
  3. Deploy Web Reverse Proxy
  4. Add relation App Server to Db
  5. Add relation Web Reverse Proxy to App Server

Phase - Scaling

  1. Add unit Db
  2. Add unit App Server (Problem step): Oh no! I don't need the automatic behavior based on Provides/Required setting in charm metadata. I want to specify the App server to Db relation at a unit level here.

Ideally, I want the relation-xxx hooks to fire only on the new unit of Db. May be an add-unit parameter passing mechanism similar to one proposed for deploy ?

My thoughts for a work around given the current features are as following:

  • One way is to conditional execute in callbacks. Check if already related to a remote unit and ignore the incoming relation-added/Changed call back. Would be messy. When restarting services may be buggy cause of sequence of start for each db app unit pair has to be carefully managed or wrong app service will talk to wrong db service. I am already using Juju as a back-end service with a python script managing the juju cli.
  • Another way is that I have a specific code which is common to the app server / db pair. Much like the set command for post deploy phase, can I use it to set values to specific service instances post add-unit?

  • Another option is a subordinate service with a container scope - but I want Db as a separate machine instance not on the app server machine instance..

As for the web proxy, I expect the hooks to be fired, so proxy can add the new app server as a back-end. Current Juju behavior is ideal.

I am looking forwards to a optimal way to go about this. Thanks in advance..

share|improve this question
    
One more possibility is that I have a specific code which is common to the app server / db pair. –  Antojk Jul 24 '12 at 7:25

1 Answer 1

up vote 2 down vote accepted

It sounds to me like you want the two appservers to be uniquely bound to unique database servers. This would mean that they are really two separate services. This might make sense then:

juju deploy mysql app1-db
juju deploy app app1
juju deploy mysql app2-db
juju deploy app app2
juju add-relation app1-db app1
juju add-relation app2-db app2

This will make it so app1 and app2 are both independent (even though they have the same charm), which I THINK is what you want. If you want them both to be load balanced from the same haproxy:

juju deploy haproxy app-reverse-proxy
juju add-relation app1 app-reverse-proxy
juju add-relation app2 app-reverse-proxy

Note that older versions of haproxy couldn't handle this (before charm revision 23).

Here is the bug which tracked the fix:

https://bugs.launchpad.net/charms/+source/haproxy/+bug/1029078

share|improve this answer
    
Thanks for the help. Looks like I was asking a question for the obvious :-) –  Antojk Aug 2 '12 at 8:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.