You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Udara Liyanage <ud...@wso2.com> on 2014/09/17 11:11:34 UTC

Extending metadata service with service group

Metadata service with service grouping

Current implementation of metadata service only allows posting
username,password,hostname to metadata service. This works for MySQL,
however this might not be the case all the time. A cluster have multiple
dependent clusters. For instance SugarCRM depends on MySQL and PHP. So
SugarCRM cluster depends on both MySQL cluster and PHP cluster. Details
exposed by MySQL and PHP varies. MySQL publishes its username,password,ip
where as PHP might publishes some other infromation such as hostIp. So it
is better to have them as generic key value pairs.

AutoScaler publishes
dependencies of a cluster
properties of all clusters
to metadata service using metadata APIs. Cartridge agent within instances
can retrive the properties using metadata API. Below I listed done draft
REST APIs of metadata.

Please note that API endpoint are not yet finalized.

*Get all dependencies of a cluster*
GET /metadata/application/<app_id>/cluster/<cluster_id>/dependencies
c1, c2,c3

*Get properties of a cluster*
GET /metadata/application/<app_id>/cluster/<cluster_id>/properties
username=udara, hostip=192.268.16.90,password=password

*Get a specific property of a cluster*
GET /metadata/application/<app_id>/cluster/<cluster_id>/properties/host
192.168.12.34

GET /metadata/application/<app_id>/cluster/<cluster_id>/properties/password
temp123

*Add dependencies*

POST /metadata/application/<app_id>/cluster<cluster_id>/dependencies
   "dependencies":[
{cluster=c1,dependson=c2},
{cluster=c1,dependson=c3},
{cluster=c2,dependson=c4}
   ]

*Add properties*

POST /metadata/application/<app_id>/cluster/<cluster_id>/properties

   "properties":[
{name=host,value=192.168.12.34},
{name=username,value=udara},
{name=password,value=temp123}
   ]

*Add a property*

POST /metadata/application/<app_id>/cluster/<cluster_id>/properties/username
udara


-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897

Re: Extending metadata service with service group

Posted by Isuru Haththotuwa <is...@apache.org>.
Hi Udara,

AFAIU, the following are the use cases to put/get meta data:

Add meta data:

   1. Add meta data to a application
   2. Add meta data to a particular cluster in an application
   3. Add dependency cluster ids for a cluster in an application
   4. Add dependency meta data for a cluster, which will be shared among
   other clusters in the same application

Get meta data:

   1. Get all meta data / a single specific meta data value related to a
   application
   2. Get all meta data / a single meta data value related to a cluster in
   a application
   3. Get dependency cluster ids for a particular cluster in a application
   4. Get all meta data exposed as dependency related information for a
   cluster

Shall we make sure all these operations are supported?

On Fri, Sep 19, 2014 at 6:47 PM, Udara Liyanage <ud...@wso2.com> wrote:

> Hi Akila,
>
> Thanks for the suggestion. I will have a look at it.
>
> *Get properties for a cluster*
>
> GET application/webapp/cluster/php/cluster/properties
> {
>   "properties": [
>     {
>       "key": "password",
>       "values": "password"
>     },
>     {
>       "key": "host",
>       "values": "metadata.stratos.com"
>     },
>     {
>       "key": "dependencies",
>       "values": [
>         "mongoCluster",
>         "mysqlCluster"
>       ]
>     }
>   ]
> }
>
> *Add properties of a cluster*
>
> POST -d @props application/webapp/cluster/php/properties
>
> {
>   "properties": [
>     {
>       "key": "host",
>       "values": "metadata.stratos.com"
>     },
>     {
>       "key": "dependencies",
>       "values": [
>         "mongoCluster",
>         "mysqlCluster"
>       ]
>     },
>         {
>       "key": "password",
>       "values": "password"
>     }
>   ]
> }
>
> On Thu, Sep 18, 2014 at 4:47 PM, Gayan Gunarathne <ga...@wso2.com> wrote:
>
>> +1 for this as above we are sending all the available properties/values,
>> not just the ones want to update. So we can use PUT and get that state
>> idempotent behavior for meta data.
>>
>> On Thu, Sep 18, 2014 at 1:55 PM, Shiroshica Kulatilake <sh...@wso2.com>
>> wrote:
>>
>>>
>>>
>>> On Thu, Sep 18, 2014 at 1:51 PM, Akila Ravihansa Perera <
>>> ravihansa@wso2.com> wrote:
>>>
>>>> Hi Udara,
>>>>
>>>> IMHO, since we are explicitly naming the URL objects when adding
>>>> dependencies and properties (<app_id> <cluster_id> <property name>)
>>>> it's better to use PUT operation instead of POST.
>>>>
>>>> PUT operation is idempotent while POST is not. So when creating named
>>>> resources we should use PUT since repetitive requests will not have
>>>> any effect.
>>>>
>>>> IMO, we should change our REST API to adhere to RESTful design.
>>>>
>>>
>>> +1 to this
>>>
>>>>
>>>> wdyt?
>>>>
>>>> Thanks.
>>>>
>>>> On Wed, Sep 17, 2014 at 5:04 PM, Udara Liyanage <ud...@wso2.com> wrote:
>>>> >
>>>> > Hi,
>>>> >
>>>> > Thanks for the suggestion. My basic idea was to get the ideas of the
>>>> > workflow and requires REST API s.
>>>> >
>>>> > Touched, not typed. Erroneous words are a feature, not a typo.
>>>>
>>>>
>>>>
>>>> --
>>>> Akila Ravihansa Perera
>>>> Software Engineer, WSO2
>>>>
>>>> Blog: http://ravihansa3000.blogspot.com
>>>>
>>>
>>>
>>>
>>> --
>>> Shiroshica Kulatilake
>>>
>>> Architect,
>>> WSO2, Inc. http://wso2.com/
>>> Phone: +94 776523867
>>>
>>
>>
>>
>> --
>> Best Regards,
>>
>> Gayan Gunarathne
>> Technical Lead
>> WSO2 Inc. (http://wso2.com)
>> email  : gayang@wso2.com  | mobile : +94 766819985
>>
>>
>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>
> --
> Thanks and Regards,
>
> Isuru H.
> +94 716 358 048* <http://wso2.com/>*
>
>
> * <http://wso2.com/>*
>
>
>

Re: Extending metadata service with service group

Posted by Udara Liyanage <ud...@wso2.com>.
Hi Akila,

Thanks for the suggestion. I will have a look at it.

*Get properties for a cluster*

GET application/webapp/cluster/php/cluster/properties
{
  "properties": [
    {
      "key": "password",
      "values": "password"
    },
    {
      "key": "host",
      "values": "metadata.stratos.com"
    },
    {
      "key": "dependencies",
      "values": [
        "mongoCluster",
        "mysqlCluster"
      ]
    }
  ]
}

*Add properties of a cluster*

POST -d @props application/webapp/cluster/php/properties

{
  "properties": [
    {
      "key": "host",
      "values": "metadata.stratos.com"
    },
    {
      "key": "dependencies",
      "values": [
        "mongoCluster",
        "mysqlCluster"
      ]
    },
        {
      "key": "password",
      "values": "password"
    }
  ]
}

On Thu, Sep 18, 2014 at 4:47 PM, Gayan Gunarathne <ga...@wso2.com> wrote:

> +1 for this as above we are sending all the available properties/values,
> not just the ones want to update. So we can use PUT and get that state
> idempotent behavior for meta data.
>
> On Thu, Sep 18, 2014 at 1:55 PM, Shiroshica Kulatilake <sh...@wso2.com>
> wrote:
>
>>
>>
>> On Thu, Sep 18, 2014 at 1:51 PM, Akila Ravihansa Perera <
>> ravihansa@wso2.com> wrote:
>>
>>> Hi Udara,
>>>
>>> IMHO, since we are explicitly naming the URL objects when adding
>>> dependencies and properties (<app_id> <cluster_id> <property name>)
>>> it's better to use PUT operation instead of POST.
>>>
>>> PUT operation is idempotent while POST is not. So when creating named
>>> resources we should use PUT since repetitive requests will not have
>>> any effect.
>>>
>>> IMO, we should change our REST API to adhere to RESTful design.
>>>
>>
>> +1 to this
>>
>>>
>>> wdyt?
>>>
>>> Thanks.
>>>
>>> On Wed, Sep 17, 2014 at 5:04 PM, Udara Liyanage <ud...@wso2.com> wrote:
>>> >
>>> > Hi,
>>> >
>>> > Thanks for the suggestion. My basic idea was to get the ideas of the
>>> > workflow and requires REST API s.
>>> >
>>> > Touched, not typed. Erroneous words are a feature, not a typo.
>>>
>>>
>>>
>>> --
>>> Akila Ravihansa Perera
>>> Software Engineer, WSO2
>>>
>>> Blog: http://ravihansa3000.blogspot.com
>>>
>>
>>
>>
>> --
>> Shiroshica Kulatilake
>>
>> Architect,
>> WSO2, Inc. http://wso2.com/
>> Phone: +94 776523867
>>
>
>
>
> --
> Best Regards,
>
> Gayan Gunarathne
> Technical Lead
> WSO2 Inc. (http://wso2.com)
> email  : gayang@wso2.com  | mobile : +94 766819985
>
>



-- 

Udara Liyanage
Software Engineer
WSO2, Inc.: http://wso2.com
lean. enterprise. middleware

web: http://udaraliyanage.wordpress.com
phone: +94 71 443 6897

Re: Extending metadata service with service group

Posted by Gayan Gunarathne <ga...@wso2.com>.
+1 for this as above we are sending all the available properties/values,
not just the ones want to update. So we can use PUT and get that state
idempotent behavior for meta data.

On Thu, Sep 18, 2014 at 1:55 PM, Shiroshica Kulatilake <sh...@wso2.com>
wrote:

>
>
> On Thu, Sep 18, 2014 at 1:51 PM, Akila Ravihansa Perera <
> ravihansa@wso2.com> wrote:
>
>> Hi Udara,
>>
>> IMHO, since we are explicitly naming the URL objects when adding
>> dependencies and properties (<app_id> <cluster_id> <property name>)
>> it's better to use PUT operation instead of POST.
>>
>> PUT operation is idempotent while POST is not. So when creating named
>> resources we should use PUT since repetitive requests will not have
>> any effect.
>>
>> IMO, we should change our REST API to adhere to RESTful design.
>>
>
> +1 to this
>
>>
>> wdyt?
>>
>> Thanks.
>>
>> On Wed, Sep 17, 2014 at 5:04 PM, Udara Liyanage <ud...@wso2.com> wrote:
>> >
>> > Hi,
>> >
>> > Thanks for the suggestion. My basic idea was to get the ideas of the
>> > workflow and requires REST API s.
>> >
>> > Touched, not typed. Erroneous words are a feature, not a typo.
>>
>>
>>
>> --
>> Akila Ravihansa Perera
>> Software Engineer, WSO2
>>
>> Blog: http://ravihansa3000.blogspot.com
>>
>
>
>
> --
> Shiroshica Kulatilake
>
> Architect,
> WSO2, Inc. http://wso2.com/
> Phone: +94 776523867
>



-- 
Best Regards,

Gayan Gunarathne
Technical Lead
WSO2 Inc. (http://wso2.com)
email  : gayang@wso2.com  | mobile : +94 766819985

Re: Extending metadata service with service group

Posted by Shiroshica Kulatilake <sh...@wso2.com>.
On Thu, Sep 18, 2014 at 1:51 PM, Akila Ravihansa Perera <ra...@wso2.com>
wrote:

> Hi Udara,
>
> IMHO, since we are explicitly naming the URL objects when adding
> dependencies and properties (<app_id> <cluster_id> <property name>)
> it's better to use PUT operation instead of POST.
>
> PUT operation is idempotent while POST is not. So when creating named
> resources we should use PUT since repetitive requests will not have
> any effect.
>
> IMO, we should change our REST API to adhere to RESTful design.
>

+1 to this

>
> wdyt?
>
> Thanks.
>
> On Wed, Sep 17, 2014 at 5:04 PM, Udara Liyanage <ud...@wso2.com> wrote:
> >
> > Hi,
> >
> > Thanks for the suggestion. My basic idea was to get the ideas of the
> > workflow and requires REST API s.
> >
> > Touched, not typed. Erroneous words are a feature, not a typo.
>
>
>
> --
> Akila Ravihansa Perera
> Software Engineer, WSO2
>
> Blog: http://ravihansa3000.blogspot.com
>



-- 
Shiroshica Kulatilake

Architect,
WSO2, Inc. http://wso2.com/
Phone: +94 776523867

Re: Extending metadata service with service group

Posted by Akila Ravihansa Perera <ra...@wso2.com>.
Hi Udara,

IMHO, since we are explicitly naming the URL objects when adding
dependencies and properties (<app_id> <cluster_id> <property name>)
it's better to use PUT operation instead of POST.

PUT operation is idempotent while POST is not. So when creating named
resources we should use PUT since repetitive requests will not have
any effect.

IMO, we should change our REST API to adhere to RESTful design.

wdyt?

Thanks.

On Wed, Sep 17, 2014 at 5:04 PM, Udara Liyanage <ud...@wso2.com> wrote:
>
> Hi,
>
> Thanks for the suggestion. My basic idea was to get the ideas of the
> workflow and requires REST API s.
>
> Touched, not typed. Erroneous words are a feature, not a typo.



-- 
Akila Ravihansa Perera
Software Engineer, WSO2

Blog: http://ravihansa3000.blogspot.com

Re: Extending metadata service with service group

Posted by Udara Liyanage <ud...@wso2.com>.
Hi,

Thanks for the suggestion. My basic idea was to get the ideas of the
workflow and requires REST API s.

Touched, not typed. Erroneous words are a feature, not a typo.

Re: Extending metadata service with service group

Posted by Isuru Haththotuwa <is...@apache.org>.
Hi Udara,

I'm not a REST expert, generally in a POST request we put data in the body
itself.

For an example, POST
/metadata/application/<app_id>/cluster/<cluster_id>/properties can be
changed to POST /metadata/application/cluster/, and then put the <app_id>
and <cluster_id> in the request body itself. Shall we check which method is
the best practice?

On Wed, Sep 17, 2014 at 2:41 PM, Udara Liyanage <ud...@wso2.com> wrote:

>
> Metadata service with service grouping
>
> Current implementation of metadata service only allows posting
> username,password,hostname to metadata service. This works for MySQL,
> however this might not be the case all the time. A cluster have multiple
> dependent clusters. For instance SugarCRM depends on MySQL and PHP. So
> SugarCRM cluster depends on both MySQL cluster and PHP cluster. Details
> exposed by MySQL and PHP varies. MySQL publishes its username,password,ip
> where as PHP might publishes some other infromation such as hostIp. So it
> is better to have them as generic key value pairs.
>
> AutoScaler publishes
> dependencies of a cluster
> properties of all clusters
> to metadata service using metadata APIs. Cartridge agent within instances
> can retrive the properties using metadata API. Below I listed done draft
> REST APIs of metadata.
>
> Please note that API endpoint are not yet finalized.
>
> *Get all dependencies of a cluster*
> GET /metadata/application/<app_id>/cluster/<cluster_id>/dependencies
> c1, c2,c3
>
> *Get properties of a cluster*
> GET /metadata/application/<app_id>/cluster/<cluster_id>/properties
> username=udara, hostip=192.268.16.90,password=password
>
> *Get a specific property of a cluster*
> GET /metadata/application/<app_id>/cluster/<cluster_id>/properties/host
> 192.168.12.34
>
> GET /metadata/application/<app_id>/cluster/<cluster_id>/properties/password
> temp123
>
> *Add dependencies*
>
> POST /metadata/application/<app_id>/cluster<cluster_id>/dependencies
>    "dependencies":[
> {cluster=c1,dependson=c2},
> {cluster=c1,dependson=c3},
> {cluster=c2,dependson=c4}
>    ]
>
> *Add properties*
>
> POST /metadata/application/<app_id>/cluster/<cluster_id>/properties
>
>    "properties":[
> {name=host,value=192.168.12.34},
> {name=username,value=udara},
> {name=password,value=temp123}
>    ]
>
> *Add a property*
>
> POST
> /metadata/application/<app_id>/cluster/<cluster_id>/properties/username
> udara
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>
> --
> Thanks and Regards,
>
> Isuru H.
> +94 716 358 048* <http://wso2.com/>*
>
>
> * <http://wso2.com/>*
>
>
>