Hi All,

I have improved this feature by allowing the end user to add application
contexts (a string containing application name, version, etc) together with
the domain names:

A sample scenario:
- Consider a Tomcat cartridge (single tenant or multi-tenant).
- A given server instance would contain a collection of applications.
- User would map a domain name to a subscription.
- This would generate a mapping as follows (sample):
https://some.organization.org/ -> http://lb-host:lb-port/
- Since this server contains multiple applications, the end user might need
to access his application as follows:
https://some.organization.org/application-name/version/file-path
- However if we consider "application-name/version" as the application
context, we could allow the domain mapping to include it together with the
domain name.
- The resulting would allow the user to map domain names as follows:
some.organization.org/file-path -> http://lb-host:lb-port
/application-name/version/file-path

Updated API methods:
1. Add subscription domains:
Send a POST request to the following URL with tenant credentials to add
subscription domains:

POST  https://sm-ip:sm-port
/stratos/admin/cartridge/{cartridgeType}/subscription/{subscriptionAlias}/domain/
{
  "domainName": "some.oragnization1.org",
  "applicationContext" : "application-name-version-etc"
}

2. Get subscription domains:
Send a GET get request to the following URL with tenant credentials to get
existing subscription domains:

GET  https://sm-ip:sm-port
/stratos/admin/cartridge/{cartridgeType}/subscription/{subscriptionAlias}/domain/

3. Remove subscription domains:
Send a DELETE request to the following URL with tenant credentials to
remove a given list of domain names:

DELETE  https://sm-ip:sm-port
/stratos/admin/cartridge/{cartridgeType}/subscription/{subscriptionAlias}/domain/
{
  "domainName": "some.oragnization1.org"
}

Thanks


On Wed, May 7, 2014 at 3:23 AM, Nirmal Fernando <nirmal070...@gmail.com>wrote:

> Cool.. thanks Imesh. I am gonna try this feature.
>
>
> On Wed, May 7, 2014 at 12:36 AM, Imesh Gunaratne <im...@apache.org> wrote:
>
>> A good question, tenant has a data structure like below:
>>
>> Tenant -> Subscription -> Subscription Domain
>>
>> Since tenant information is published to tenant topic periodically,
>> subscription domain information included in that.
>>
>>
>>
>> On Tue, May 6, 2014 at 9:27 PM, Nirmal Fernando 
>> <nirmal070...@gmail.com>wrote:
>>
>>> Hi Imesh,
>>>
>>> Thanks for the reply. How would LB withstand a re-start? How it gets to
>>> know about the existing domain mappings?
>>>
>>>
>>> On Tue, May 6, 2014 at 8:28 PM, Imesh Gunaratne <im...@apache.org>wrote:
>>>
>>>> No, domain mappings are persisted with the cartridge subscriptions (as
>>>> an aggregate to subscription) in SM.
>>>>
>>>>
>>>>
>>>> On Tue, May 6, 2014 at 7:00 PM, Nirmal Fernando <nirmal070...@gmail.com
>>>> > wrote:
>>>>
>>>>> Hi Imesh,
>>>>>
>>>>> Are you persisting these domain mappings in the topology?
>>>>>
>>>>>
>>>>> On Sun, May 4, 2014 at 10:48 PM, Imesh Gunaratne <im...@apache.org>wrote:
>>>>>
>>>>>> As I found HTTP DELETE requests do not include a message body,
>>>>>> therefore I have updated the subscription domain remove method as 
>>>>>> follows:
>>>>>>
>>>>>> *Remove subscription domains:*
>>>>>> *Send a DELETE request to the following URL with tenant credentials
>>>>>> to remove a domain:*
>>>>>>
>>>>>> *DELETE
>>>>>>  
>>>>>> https://sm-ip:sm-port/stratos/admin/cartridge/{cartridgeType}/subscription/{subscriptionAlias}/domain/some.oragnization1.org
>>>>>> <http://some.oragnization1.org/>*
>>>>>>
>>>>>> In-addition I have added a new method to validate domain names. This
>>>>>> method will return false if the given domain is already registered with a
>>>>>> subscription or true if it is valid for registration.
>>>>>>
>>>>>> *GET
>>>>>>  
>>>>>> https://sm-ip:sm-port/stratos/admin/cartridge/subscription/domain/some.oragnization1.org
>>>>>> <http://some.oragnization1.org/>/is-valid*
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>> On Fri, May 2, 2014 at 10:55 PM, Imesh Gunaratne <im...@apache.org>wrote:
>>>>>>
>>>>>>> Yes I think it will not cause any problems to request-in-flight
>>>>>>> (RIF) stats. The RIF stat collector was implemented to track requests
>>>>>>> in-flight count on each cluster:
>>>>>>>
>>>>>>>     // Map<ClusterId, Integer>
>>>>>>>     private Map<String, Integer> clusterIdRequestCountMap;
>>>>>>>
>>>>>>>
>>>>>>> On Fri, May 2, 2014 at 10:12 PM, Nirmal Fernando <
>>>>>>> nirmal070...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi Imesh,
>>>>>>>>
>>>>>>>> Sorry, I meant for the cluster. But I can't remember how we
>>>>>>>> implemented the request-in-flight stats collector. So, what I wanted 
>>>>>>>> to get
>>>>>>>> verified is even a user send a request from a mapped domain, we would 
>>>>>>>> still
>>>>>>>> collect stats for the corresponding cluster.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, May 2, 2014 at 10:05 PM, Imesh Gunaratne 
>>>>>>>> <im...@apache.org>wrote:
>>>>>>>>
>>>>>>>>> Hi Nirmal,
>>>>>>>>>
>>>>>>>>> Can you please explain this requirement further? I'm not sure why
>>>>>>>>> we need to track request-in-flight against domain names.
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, May 2, 2014 at 9:34 PM, Nirmal Fernando <
>>>>>>>>> nirmal070...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Imesh,
>>>>>>>>>>
>>>>>>>>>> We also need to support request in-flight stats for domain maaped
>>>>>>>>>> urls, in order to auto-scaling to work correctly. Do we have it 
>>>>>>>>>> covered?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Tue, Apr 29, 2014 at 9:59 AM, Imesh Gunaratne <
>>>>>>>>>> im...@apache.org> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> Currently tenants cannot map custom domain names to
>>>>>>>>>>> subscriptions. The only possibility is to use hostnames generated by
>>>>>>>>>>> Stratos Manager for accessing applications deployed in Stratos via 
>>>>>>>>>>> the load
>>>>>>>>>>> balancers.
>>>>>>>>>>>
>>>>>>>>>>> Therefore I thought it would be a great value addition to
>>>>>>>>>>> implement a new functionality to map domain names to subscriptions 
>>>>>>>>>>> as
>>>>>>>>>>> described below. Please add your thoughts.
>>>>>>>>>>>
>>>>>>>>>>> *Functional Design:*
>>>>>>>>>>>
>>>>>>>>>>> Subscription domains will be managed by Stratos Manager together
>>>>>>>>>>> with the subscription information. Once domains are added to a given
>>>>>>>>>>> subscription, a new event (SubscriptionDomainsAddedEvent 
>>>>>>>>>>> [serviceName,
>>>>>>>>>>> tenantId, clusterIds, domains]) will be published to the "tenant" 
>>>>>>>>>>> topic and
>>>>>>>>>>> it will be received by the load balancer. Load balancer will update 
>>>>>>>>>>> its
>>>>>>>>>>> internal cluster map with the given information. Similarly when 
>>>>>>>>>>> domains are
>>>>>>>>>>> removed, a new event (SubscriptionDomainsRemovedEvent [serviceName,
>>>>>>>>>>> tenantId, clusterIds, domains]) will be published to the "tenant" 
>>>>>>>>>>> topic and
>>>>>>>>>>> load balancer will update its cluster map accordingly.
>>>>>>>>>>>
>>>>>>>>>>> *New REST API methods:*
>>>>>>>>>>>
>>>>>>>>>>> 1. Add subscription domains:
>>>>>>>>>>> Send a POST request to the following URL with tenant credentials
>>>>>>>>>>> to add subscription domains:
>>>>>>>>>>>
>>>>>>>>>>> POST  https://sm-ip:sm-port
>>>>>>>>>>> /stratos/admin/cartridge/{cartridgeType}/subscription/{subscriptionAlias}/domain/
>>>>>>>>>>> {
>>>>>>>>>>>   "domains": [
>>>>>>>>>>>      "some.oragnization1.org" ,
>>>>>>>>>>>      "some.oragnization2.org" ,
>>>>>>>>>>>      "some.oragnization3.org"
>>>>>>>>>>>   ]
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> 2. Get subscription domains:
>>>>>>>>>>> Send a GET get request to the following URL with tenant
>>>>>>>>>>> credentials to get existing subscription domains:
>>>>>>>>>>>
>>>>>>>>>>> GET  https://sm-ip:sm-port
>>>>>>>>>>> /stratos/admin/cartridge/{cartridgeType}/subscription/{subscriptionAlias}/domain/
>>>>>>>>>>>
>>>>>>>>>>> 3. Remove subscription domains:
>>>>>>>>>>> Send a DELETE request to the following URL with tenant
>>>>>>>>>>> credentials to remove a given list of domain names:
>>>>>>>>>>>
>>>>>>>>>>> DELETE  https://sm-ip:sm-port
>>>>>>>>>>> /stratos/admin/cartridge/{cartridgeType}/subscription/{subscriptionAlias}/domain/
>>>>>>>>>>> {
>>>>>>>>>>>   "domains": [
>>>>>>>>>>>      "some.oragnization1.org"
>>>>>>>>>>>   ]
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Thanks
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Imesh Gunaratne
>>>>>>>>>>>
>>>>>>>>>>> Technical Lead, WSO2
>>>>>>>>>>> Committer & PPMC Member, Apache Stratos
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Best Regards,
>>>>>>>>>> Nirmal
>>>>>>>>>>
>>>>>>>>>> Nirmal Fernando.
>>>>>>>>>> PPMC Member & Committer of Apache Stratos,
>>>>>>>>>> Senior Software Engineer, WSO2 Inc.
>>>>>>>>>>
>>>>>>>>>> Blog: http://nirmalfdo.blogspot.com/
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Imesh Gunaratne
>>>>>>>>>
>>>>>>>>> Technical Lead, WSO2
>>>>>>>>> Committer & PPMC Member, Apache Stratos
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Best Regards,
>>>>>>>> Nirmal
>>>>>>>>
>>>>>>>> Nirmal Fernando.
>>>>>>>> PPMC Member & Committer of Apache Stratos,
>>>>>>>> Senior Software Engineer, WSO2 Inc.
>>>>>>>>
>>>>>>>> Blog: http://nirmalfdo.blogspot.com/
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Imesh Gunaratne
>>>>>>>
>>>>>>> Technical Lead, WSO2
>>>>>>> Committer & PPMC Member, Apache Stratos
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Imesh Gunaratne
>>>>>>
>>>>>> Technical Lead, WSO2
>>>>>> Committer & PPMC Member, Apache Stratos
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best Regards,
>>>>> Nirmal
>>>>>
>>>>> Nirmal Fernando.
>>>>> PPMC Member & Committer of Apache Stratos,
>>>>> Senior Software Engineer, WSO2 Inc.
>>>>>
>>>>> Blog: http://nirmalfdo.blogspot.com/
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Imesh Gunaratne
>>>>
>>>> Technical Lead, WSO2
>>>> Committer & PPMC Member, Apache Stratos
>>>>
>>>
>>>
>>>
>>> --
>>> Best Regards,
>>> Nirmal
>>>
>>> Nirmal Fernando.
>>> PPMC Member & Committer of Apache Stratos,
>>> Senior Software Engineer, WSO2 Inc.
>>>
>>> Blog: http://nirmalfdo.blogspot.com/
>>>
>>
>>
>>
>> --
>> Imesh Gunaratne
>>
>> Technical Lead, WSO2
>> Committer & PPMC Member, Apache Stratos
>>
>
>
>
> --
> Best Regards,
> Nirmal
>
> Nirmal Fernando.
> PPMC Member & Committer of Apache Stratos,
> Senior Software Engineer, WSO2 Inc.
>
> Blog: http://nirmalfdo.blogspot.com/
>



-- 
Imesh Gunaratne

Technical Lead, WSO2
Committer & PPMC Member, Apache Stratos

Reply via email to