Does juju support 'named' interfaces?

Sidnei da Silva sidnei.da.silva at canonical.com
Tue Jun 26 01:05:30 UTC 2012


Hi there,

For Ubuntu One (and, I assume, for a couple other services out there),
we have named database shards that users are assigned to according to
a mapping specified by yet-another database.

So, in order to connect a service to those sharded databases, I need
to require not just a single pgsql interface, but a finite set of
'named' pgsql instances which will be assigned to each shard.

So to be more specific, when I do:

  juju add-relation my-app my-deployed-shard0

...where 'my-app' requires multiple pgsql backends (shard[0-N]) and
'my-deployed-shard0' would *have* to be used as 'shard0' by 'my-app',
how does one structure this?

I can see someone working around this by forking the pgsql charm as
'pgsql-shard[0-N]' and each of those charms only providing the
specific interface, and having the app require 'pgsql-shard[0-N]'
instead of a generic 'pgsql' charm, but clearly this would cause an
unnecessary interface explosion.

Here's an example of what the actual config file for the application looks like:

"""
defaults:
    options:
        isolation: repeatable-read
shards:
    new_user_shards: [shard0, shard1, shard2]
    shard_ids: [shard0, shard1, shard2]
stores:
    storage:
        host: storage.internal
        database: storage
    shard0:
        host: shard0.internal
        database: shard0
    shard0-slave:
        host: shard0-slave.internal
        database: shard0
    shard1:
        host: shard1.internal
        database: shard1
    shard1-slave:
        host: shard1-slave.internal
        database: shard1
    shard2:
        host: shard2.internal
        database: shard2
    shard2-slave:
        host: shard2-slave.internal
        database: shard2
    account:
        host: account.internal
        database: account
    account2:
        host: account2.internal
        database: account
"""

Thoughts?

-- 
Sidnei

Make the most of Ubuntu with Ubuntu One
http://one.ubuntu.com



More information about the Juju mailing list