stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanjiva Weerawarana <sanj...@wso2.com>
Subject Re: Cartridge Store for Stratos, REST communication plan with Puppet Master's Node.
Date Sat, 14 Jun 2014 01:51:55 GMT
IMO this is not quite right yet:

> 1 /modules/<type> GET Get all installed modules in puppet master ["java",
"php"]
I don't understand .. are you saying GET /modules/java (for example)? If so
what will it return??

> user must be autenticated. 200 on success 401 on unauthorized request

First of all you don't need to keep saying 200 on success and 401 on unauth
.. that's just the way HTTP works. All you need to say at the top is that
you must have an authenticated session over SSL for the calls to work.

> /modules/<type>/<modulename>/url/<download URL>/checksum/<value>
POST
Downloiad and install given module to the puppet master

IMO this should be:

POST /modules/install?name=XX&URL=XX&checksum=XX

Things that are parameters to the request should be params and not path
segments IMO. Being more RESTful doesn't mean you can't use params :-).

> ["your moudle will be installed soon!!"] or ["Module is already
installed"]

Its wrong to return 200 and say "I'll do it soon". Then you should return
202 [1].

If the module is already installed then it should be something like 200 (if
you want the operation to be idempotent) or some type of error saying
"don't bother me like this". Not sure which error code is right .. please
look around other APIs to see!

> /modules/<type>/<modulename>/progress GET

If this is a status check then why not GET /modules/status/<type>?name=XX

Why do we need <type>?? Aren't names unique?

> /modules/<type>/<modulename>/status GET
> /modules/<type>/status GET

I guess I didn't understand the status idea at all.

Can someone explain what exactly what this API is for? Maybe I didn't get
that properly :(.

Sanjiva.
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html


On Thu, Jun 12, 2014 at 11:13 PM, Roshan Wijesena <roshan@wso2.com> wrote:

> Hi,
>
> We have changed API endpoints URLs bit in order to make it  more
> restful.Please find the attached pdf. It has the detailed table of
> endpoints.
>
> Please correct us, if there is something wrong.
>
> Thanks.
>
>
> On Thu, Jun 12, 2014 at 8:42 AM, Roshan Wijesena <roshan@wso2.com> wrote:
>
>> Thanks Nirmal for your advice, we will do the need-full and update the
>> progress here!
>>
>> Thanks.
>>
>>
>> On Wed, Jun 11, 2014 at 2:06 PM, Nirmal Fernando <nirmal070125@gmail.com>
>> wrote:
>>
>>> Great progress guys!
>>>
>>>
>>> On Wed, Jun 11, 2014 at 3:57 PM, Roshan Wijesena <roshan@wso2.com>
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> We have been working on Stratos manager - Puppet master communication
>>>>  REST API. Please find the progress update of it as below.
>>>>
>>>> *Security*
>>>> We have used  HTTP basic auth[1] security mode over SSL so far, and in
>>>> the  future we can  extend this in to a further advance mode like OAuth 
[2
>>>> ].
>>>>
>>>> *EndPoints*
>>>> So far we have following endpoints.
>>>>
>>>> 1  /login - this will handle auth logging.
>>>>
>>>> 2  /getModuleList - this endpoint will  return current  installed
>>>> modules in puppet master.
>>>>
>>>>    sample response json ["java", "php"]
>>>>
>>>> 3  /installPuppetModule/url/{cartridge URL}/name/{{Module name}} - we
>>>> have to pass cartridge url and module name,then this endpoint will take
>>>> care of module installation on puppet master.
>>>>
>>>> 4  /getModuleInstallationProgress/name/{{Module name}}
>>>>
>>>
>>> Are these the REST resource paths? If so, it is not correct to have
>>> these verbs (getModuleInstallationProgress) in it. We should design the
>>> paths properly. For an example, IMO, this should be something like; POST
>>> /module/status/{name}
>>>
>>> Also please send the permission model. I guess, you need something like
>>> table here, with all the operations :-)
>>>
>>>
>>>
>>>>  - using this endpoint we can see the actual progress of a installation
>>>> process.
>>>>
>>>>     sample response json
>>>>     [
>>>>          "Downloading:
>>>> AAM1sXjadDd1s42Ez83xcC8mQSd9U7IFrfdIRl-JqWp07g?dl=1 Bytes: 1255
>>>>          ",
>>>>          "1255  [100.00%]
>>>>          ",
>>>>          "File Download complete
>>>>          "
>>>>     ]
>>>>
>>>> 5  /getModuleStatus/name/{{module name}} - this endpoint will return
>>>> "install" , "inprogress" ,"error" responses to the client according to
>>>> client request. Those status will be saved in 3 XML  files  at the moment.
>>>>
>>>> 6  /getAllModulesStatus-  This will return all modules with their
>>>> corresponding status value.
>>>>
>>>>     sample response json {"inprogress": ["ruby"], "error":
>>>> ["wordpress"], "installed": ["java", "php"]}
>>>>
>>>> We will provide comprehensive  documentation on this soon as we are
>>>> working on it.
>>>>
>>>> Git hub - https://github.com/stratos-cartridge-store/python_restapi
>>>>
>>>> [1] http://en.wikipedia.org/wiki/Basic_access_authentication
>>>> [2] http://en.wikipedia.org/wiki/OAuth
>>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>> On Mon, Jun 2, 2014 at 4:15 AM, Lakmal Warusawithana <lakmal@wso2.com>
>>>> wrote:
>>>>
>>>>> AFAIU, puppet api's only support for install modules from puppet lab
>>>>> hence we can't used it. If we can point puppet module from our store
and
>>>>> install from puppet api's we should used it from our generic client.
>>>>>
>>>>>
>>>>> On Mon, Jun 2, 2014 at 7:34 AM, Nirmal Fernando <
>>>>> nirmal070125@gmail.com> wrote:
>>>>>
>>>>>> Well, have a look at this;
>>>>>> http://docs.puppetlabs.com/puppet/latest/reference/modules_installing.html
>>>>>>
>>>>>> Isn't this the same you are referring to?
>>>>>>
>>>>>>
>>>>>> On Mon, Jun 2, 2014 at 7:28 AM, Dakshika Jayathilaka <
>>>>>> dakshika@wso2.com> wrote:
>>>>>>
>>>>>>> Yes we already checked that, currently you can installed modules
>>>>>>> which reside on puppetlabs repo. but PMT[1] doesn't contain any
exposed API
>>>>>>> for that.
>>>>>>>
>>>>>>>
>>>>>>> [1]
>>>>>>> http://puppetlabs.com/blog/module-of-the-week-puppet-module-tool-part-1
>>>>>>>
>>>>>>> *Dakshika Jayathilaka*
>>>>>>> Software Engineer
>>>>>>> WSO2, Inc.
>>>>>>> lean.enterprise.middleware
>>>>>>> 0771100911
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Jun 2, 2014 at 1:10 AM, Nirmal Fernando <
>>>>>>> nirmal070125@gmail.com> wrote:
>>>>>>>
>>>>>>>> Puppet Lab's modules can be installed using puppet CLI. There
>>>>>>>> should be a REST API for that, I believe.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sun, Jun 1, 2014 at 6:36 PM, Dakshika Jayathilaka <
>>>>>>>> dakshika@wso2.com> wrote:
>>>>>>>>
>>>>>>>>> Hi Pradeep,
>>>>>>>>>
>>>>>>>>> AFAIK puppetlabs REST API currently doesn't support for
module
>>>>>>>>> deployment. Unfortunately its limited.  Also we are trying
to implement
>>>>>>>>> generic agent which can be further improve to support
for Docker and Chef
>>>>>>>>> as wel.
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> *Dakshika Jayathilaka*
>>>>>>>>>  Software Engineer
>>>>>>>>> WSO2, Inc.
>>>>>>>>> lean.enterprise.middleware
>>>>>>>>> 0771100911
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Sun, Jun 1, 2014 at 6:02 PM, Pradeep Fernando <
>>>>>>>>> pradeepfn@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Roshan,
>>>>>>>>>>
>>>>>>>>>> There seems to be a REST API exposed by puppet master.
>>>>>>>>>>
>>>>>>>>>> http://docs.puppetlabs.com/guides/rest_api.html
>>>>>>>>>>
>>>>>>>>>> Can't we use that ? Is it a limited API ?
>>>>>>>>>>
>>>>>>>>>> thanks,
>>>>>>>>>> --Pradeep
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Sun, Jun 1, 2014 at 3:07 PM, Roshan Wijesena <roshan@wso2.com>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> We are going to do  REST communication between
Puppet Master's
>>>>>>>>>>> node and Stratos  Manager's node as described
below.
>>>>>>>>>>>
>>>>>>>>>>> We will use webpy[1] simple python opensource
framework in order
>>>>>>>>>>> to build our REST API to communicate with Puppet
master's node. In order to
>>>>>>>>>>> achieve this we may follow below steps.
>>>>>>>>>>>
>>>>>>>>>>> 1. Install Webpy framework + our python REST
API code  on Puppet
>>>>>>>>>>> Master's Computer. Initially we  have decided
 to stay on Webpy's built in
>>>>>>>>>>> web server,but when we are getting more hits
on our store we might need to
>>>>>>>>>>> install webpy on Light-httpd server or HTTPD
server in order to handle more
>>>>>>>>>>> requests as they recommend it.
>>>>>>>>>>>
>>>>>>>>>>> 2. Indeed this service must be very secured as
we are executing
>>>>>>>>>>> some root command using our API . For an example
we need to extract puppet
>>>>>>>>>>> modules to puppet master's /etc/puppet/ folder!!.
So our security plan is
>>>>>>>>>>> to use SSL with built in cherrypy server [2]
and secure our API using a
>>>>>>>>>>> security token.
>>>>>>>>>>>
>>>>>>>>>>> 3. At last but not least we may create automation
scripts in
>>>>>>>>>>> order to automate above steps.
>>>>>>>>>>>
>>>>>>>>>>> Here below I ll list some sample REST calls that
we are going to
>>>>>>>>>>> shoot!
>>>>>>>>>>>
>>>>>>>>>>> List Current available puppet Modules - GET 
https://{{Server}}/listmodules.
>>>>>>>>>>> (out put should be a json)
>>>>>>>>>>>
>>>>>>>>>>> Install a module - GET https://
>>>>>>>>>>> {{Server}}/install/{{Module-name}}.
>>>>>>>>>>>
>>>>>>>>>>> So this is our current plan for the integration
and this is
>>>>>>>>>>>  open to discuss !!
>>>>>>>>>>>
>>>>>>>>>>> [1] http://webpy.org/
>>>>>>>>>>>
>>>>>>>>>>> [2] http://webpy.org/cookbook/ssl
>>>>>>>>>>>
>>>>>>>>>>> Thanks very much.
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Best Regards,
>>>>>>>>>>>  Senior Software Engineer-WSO2 Inc.
>>>>>>>>>>> Roshan Wijesena
>>>>>>>>>>> Mobile: *+94752126789*
>>>>>>>>>>> Email: roshan@wso2.com
>>>>>>>>>>> *WSO2, Inc. :** wso2.com <http://wso2.com/>*
>>>>>>>>>>> lean.enterprise.middleware.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Pradeep Fernando.
>>>>>>>>>> http://pradeepfernando.blogspot.com/
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Best Regards,
>>>>>>>> Nirmal
>>>>>>>>
>>>>>>>> Nirmal Fernando.
>>>>>>>> PPMC Member & Committer of Apache Stratos,
>>>>>>>> Senior Software Engineer, WSO2 Inc.
>>>>>>>>
>>>>>>>> Blog: http://nirmalfdo.blogspot.com/
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best Regards,
>>>>>> Nirmal
>>>>>>
>>>>>> Nirmal Fernando.
>>>>>> PPMC Member & Committer of Apache Stratos,
>>>>>> Senior Software Engineer, WSO2 Inc.
>>>>>>
>>>>>> Blog: http://nirmalfdo.blogspot.com/
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Lakmal Warusawithana
>>>>> Vice President, Apache Stratos
>>>>> Director - Cloud Architecture; WSO2 Inc.
>>>>> Mobile : +94714289692
>>>>> Blog : http://lakmalsview.blogspot.com/
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Best Regards,
>>>>  Senior Software Engineer-WSO2 Inc.
>>>> Roshan Wijesena
>>>> Mobile: *+94752126789*
>>>> Email: roshan@wso2.com
>>>> *WSO2, Inc. :** wso2.com <http://wso2.com/>*
>>>> lean.enterprise.middleware.
>>>>
>>>
>>>
>>>
>>> --
>>> Best Regards,
>>> Nirmal
>>>
>>> Nirmal Fernando.
>>> PPMC Member & Committer of Apache Stratos,
>>> Senior Software Engineer, WSO2 Inc.
>>>
>>> Blog: http://nirmalfdo.blogspot.com/
>>>
>>
>>
>>
>> --
>> Best Regards,
>>  Senior Software Engineer-WSO2 Inc.
>> Roshan Wijesena
>> Mobile: *+94752126789*
>> Email: roshan@wso2.com
>> *WSO2, Inc. :** wso2.com <http://wso2.com/>*
>> lean.enterprise.middleware.
>>
>
>
>
> --
> Best Regards,
>  Senior Software Engineer-WSO2 Inc.
> Roshan Wijesena
> Mobile: *+94752126789*
> Email: roshan@wso2.com
> *WSO2, Inc. :** wso2.com <http://wso2.com/>*
> lean.enterprise.middleware.
>



-- 
Sanjiva Weerawarana, Ph.D.
Founder, Chairman & CEO; WSO2, Inc.;  http://wso2.com/
email: sanjiva@wso2.com; office: (+1 650 745 4499 | +94  11 214 5345)
x5700; cell: +94 77 787 6880 | +1 408 466 5099; voip: +1 650 265 8311
blog: http://sanjiva.weerawarana.org/; twitter: @sanjiva
Lean . Enterprise . Middleware

Mime
View raw message