You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by Jose Carrasco <jo...@lcc.uma.es> on 2016/05/05 01:49:50 UTC

BrooklynNode with a explicit httpPort in cloud

Hi all,

I tried to deploy a BrooklynNode entity with an explicit web console port (8082) over a AWS VM machine. Using the following plan:

name: BrooklynNode
location:
  jclouds:aws-ec2:
    region: us-west-2
    identity: ****
    credential: ****
services:
- type: org.apache.brooklyn.entity.brooklynnode.BrooklynNode
  id: brooklynNode
  name: brooklynNode
  brooklyn.config:
    onExistingProperties: do_not_use
    brooklynnode.webconsole.nosecurity: true
    brooklynnode.webconsole.httpPort: 8082 

However I found an error because the entity did not look to be up (SERVICE_UP retrieved false). Then, I tried to figure out a bit. The BrooklynNode instance was installed and executed correctly but the VM’s security group did not have any rule to enable the 8082 port. It looks that the problem is here [1], the following if code condition:

(PortRange.class.isAssignableFrom(k.getType()) || portsPattern.matcher(k.getName()).matches()) 

returns false because when the BrooklynNode.HTTPS_PORT is evaluated the entity is not assignable from PortRange because the config key instance is retrieved by [2], which returns a ConfigKey<Object>, so the type is not assignable from PortRange.class. 
Moreover, the config key name is brooklynnode.webconsole.httpPort, which is not matchable by the portPattern “*.port”. 
Then, the port that is specified from BrooklynNode.HTTPS_PORT config key is  not  evaluated as a PortRange config key, and it is not returned by getRequiredOpenPorts() method. Then you can see that the VM does not contains the necessary flags [3] to open the specified http port, so as result the Brooklyn node web console is not accesible. 
I have seen that there is a test which check the BrooklynNode.HTTPS_PORT in BrooklynNodeIntegrationTest [4], but  (I think) different ports are tested over the local machine where all ports are accessible.

If you consider that this behavior should be solved, I have two different proposal.
First,  adapting the BrooklynNode.HTTPS_PORT name to the portPattern, so “brooklynnode.webconsole.httpPort” should be replaced by “brooklynnode.webconsole.http.port”. I think it is the best option. (it should be necessary review the rest of config keys too).
Modify the InboundPortsUtils#getRequiredOpenPorts method in order to support config keys whose value is assignable from PortRange. In this case I have written a little commit [commit].

I would like to solve this issue.
Thought?

Please, note that if you configure the BrooklynNode.HTTPS_PORT pointing to 8081 (default value) the web console will be not accessible because the configuration follows the same process that 8082 scenario. 
If no port is defined, the 8081 will be accessible because  config keys will be retrieved by the entityType [5] that provides the default entities’ ConfigKeys whose types will be assignable from PortRange.class.

Jose
GSoC student

[1] https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java#L85

[2] https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java#L80

[3] https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java#L374 

[4] https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java

[commit]  https://github.com/kiuby88/brooklyn-server/commit/06086c346719abe9c9162dce773677d2abad5d05

[5] https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java#L78 


Re: BrooklynNode with a explicit httpPort in cloud

Posted by Jose Carrasco <jo...@lcc.uma.es>.
Hi Andrea and all,

thanks for your reply.

I have opened a PR in brooklyn-server, #136 (https://github.com/apache/brooklyn-server/pull/136). 
It is composed by two different commits. First, I added a simple test which tries to show the issue. 
Then, I modified the InboundPortsUtils#getRequiredOpenPorts methods in order to support 
config keys whose value is assignable from PortRange.

Probably, we should continue the discussion in Github. 

Thanks a lot
Jose

El 05/05/2016, a las 10:47, Andrea Turli <an...@cloudsoftcorp.com> escribió:

> Jose,
> 
> On 5 May 2016 at 10:30, Jose Carrasco <jo...@lcc.uma.es> wrote:
> 
>> Hi all,
>> 
>> Andrea, thanks for your reply. I have opened a jira issue
>> https://issues.apache.org/jira/browse/BROOKLYN-263
> 
> 
> Thanks!
> 
>> 
>> Just a pair of question, do you think I should add a gsoc label to my
>> tasks in order to maintain the gsoc flavor?
>> What routing should I follow? I mean, I would like to work in this issue,
>> so probably somebody should assigns the task to my jira profile (kiuby88),
>> right?
>> 
> 
> I'm not sure about the gsoc label as it seems more a brooklyn induction to
> me rather than a gsoc related task, but not strong feelings.
> Feel free to start looking at the jira issue you just created and propose a
> fix that reference a PR (this would be ideal IMHO) even if you are not
> explicitly assigned to the task.
> 
> 
>> Let me try your first workaround (required.ports), I assume that I have to
>> add the result in the jira task. About second advice, yes I am using the
>> default port. Currently, this issue is not a problem for me. I find this
>> issue while deploying some examples and I thought it could be starting
>> point for the gsoc immersion in the community.
>> 
> 
> Excellent! Let us know if the former suggestion fixes the issue for the
> time being.
> 
> Looking forward for your PR!
> 
> Great job!
> Andrea


Re: BrooklynNode with a explicit httpPort in cloud

Posted by Andrea Turli <an...@cloudsoftcorp.com>.
Jose,

On 5 May 2016 at 10:30, Jose Carrasco <jo...@lcc.uma.es> wrote:

> Hi all,
>
> Andrea, thanks for your reply. I have opened a jira issue
> https://issues.apache.org/jira/browse/BROOKLYN-263


Thanks!

>
> Just a pair of question, do you think I should add a gsoc label to my
> tasks in order to maintain the gsoc flavor?
> What routing should I follow? I mean, I would like to work in this issue,
> so probably somebody should assigns the task to my jira profile (kiuby88),
> right?
>

I'm not sure about the gsoc label as it seems more a brooklyn induction to
me rather than a gsoc related task, but not strong feelings.
Feel free to start looking at the jira issue you just created and propose a
fix that reference a PR (this would be ideal IMHO) even if you are not
explicitly assigned to the task.


> Let me try your first workaround (required.ports), I assume that I have to
> add the result in the jira task. About second advice, yes I am using the
> default port. Currently, this issue is not a problem for me. I find this
> issue while deploying some examples and I thought it could be starting
> point for the gsoc immersion in the community.
>

Excellent! Let us know if the former suggestion fixes the issue for the
time being.

Looking forward for your PR!

Great job!
Andrea

Re: BrooklynNode with a explicit httpPort in cloud

Posted by Jose Carrasco <jo...@lcc.uma.es>.
Hi all,

Andrea, thanks for your reply. I have opened a jira issue
https://issues.apache.org/jira/browse/BROOKLYN-263

Just a pair of question, do you think I should add a gsoc label to my tasks in order to maintain the gsoc flavor?
What routing should I follow? I mean, I would like to work in this issue, so probably somebody should assigns the task to my jira profile (kiuby88), right?

Let me try your first workaround (required.ports), I assume that I have to add the result in the jira task. About second advice, yes I am using the default port. Currently, this issue is not a problem for me. I find this issue while deploying some examples and I thought it could be starting point for the gsoc immersion in the community.    

Thanks a lot.

Jose
GSoC student


El 05/05/2016, a las 08:18, Andrea Turli <an...@cloudsoftcorp.com> escribió:

> Jose,
> 
> Thanks for that. Can you open a jira task to track this issue properly and
> add the jira issue url in this thread later on?
> 
> There are a couple of workaround to ypur problem:
> 
> 1. Can you try a list of
> 
> required.ports:
> - 22
> - 8082
> 
> in the provisioning.properties of your entity?
> 
> 2. Alternatively, can you just use the default 8081, maybe?
> 
> Thanks,
> Andrea
> 
> Andrea
> Il 05/mag/2016 03:49, "Jose Carrasco" <jo...@lcc.uma.es> ha scritto:
> 
>> Hi all,
>> 
>> I tried to deploy a BrooklynNode entity with an explicit web console port
>> (8082) over a AWS VM machine. Using the following plan:
>> 
>> name: BrooklynNode
>> location:
>> jclouds:aws-ec2:
>>   region: us-west-2
>>   identity: ****
>>   credential: ****
>> services:
>> - type: org.apache.brooklyn.entity.brooklynnode.BrooklynNode
>> id: brooklynNode
>> name: brooklynNode
>> brooklyn.config:
>>   onExistingProperties: do_not_use
>>   brooklynnode.webconsole.nosecurity: true
>>   brooklynnode.webconsole.httpPort: 8082
>> 
>> However I found an error because the entity did not look to be up (
>> SERVICE_UP retrieved false). Then, I tried to figure out a bit. The
>> BrooklynNode instance was installed and executed correctly but the VM’s
>> security group did not have any rule to enable the 8082 port. It looks that
>> the problem is here [1], the following if code condition:
>> 
>> (PortRange.class.isAssignableFrom(k.getType()) ||
>> portsPattern.matcher(k.getName()).matches())
>> 
>> returns false because when the BrooklynNode.HTTPS_PORT is evaluated the
>> entity is not assignable from PortRange because the config key instance
>> is retrieved by [2], which returns a ConfigKey<Object>, so the type is
>> not assignable from PortRange.class.
>> Moreover, the config key name is brooklynnode.webconsole.httpPort, which
>> is not matchable by the portPattern “*.port”.
>> Then, the port that is specified from BrooklynNode.HTTPS_PORT config key
>> is  not  evaluated as a PortRange config key, and it is not returned by
>> getRequiredOpenPorts() method. Then you can see that the VM does not
>> contains the necessary flags [3] to open the specified http port, so as
>> result the *Brooklyn node web console* is not accesible.
>> I have seen that there is a test which check the BrooklynNode.HTTPS_PORT
>> in BrooklynNodeIntegrationTest [4], but  (I think) different ports are
>> tested over the local machine where all ports are accessible.
>> 
>> If you consider that this behavior should be solved, I have two different
>> proposal.
>> 
>>   - First,  adapting the BrooklynNode.HTTPS_PORT name to the
>>   portPattern, so “brooklynnode.webconsole.httpPort” should be replaced
>>   by “brooklynnode.webconsole.http.port”. I think it is the best option.
>>   (it should be necessary review the rest of config keys too).
>>   - Modify the InboundPortsUtils#getRequiredOpenPorts method in order to
>>   support config keys whose value is assignable from PortRange. In this
>>   case I have written a little commit [commit].
>> 
>> 
>> I would like to solve this issue.
>> Thought?
>> 
>> Please, note that if you configure the BrooklynNode.HTTPS_PORT pointing to
>> 8081 (default value) the web console will be not accessible because the
>> configuration follows the same process that 8082 scenario.
>> If no port is defined, the 8081 will be accessible because config keys
>> will be retrieved by the entityType [5] that provides the default entities’
>> ConfigKeys whose types will be assignable from PortRange.class.
>> 
>> Jose
>> GSoC student
>> 
>> [1]
>> https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java#L85
>> 
>> [2]
>> https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java#L80
>> 
>> [3]
>> https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java#L374
>> 
>> [4]
>> https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
>> 
>> [commit]
>> https://github.com/kiuby88/brooklyn-server/commit/06086c346719abe9c9162dce773677d2abad5d05
>> 
>> [5]
>> https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java#L78
>> 
>> 


Re: BrooklynNode with a explicit httpPort in cloud

Posted by Andrea Turli <an...@cloudsoftcorp.com>.
Jose,

Thanks for that. Can you open a jira task to track this issue properly and
add the jira issue url in this thread later on?

There are a couple of workaround to ypur problem:

1. Can you try a list of

required.ports:
- 22
- 8082

in the provisioning.properties of your entity?

2. Alternatively, can you just use the default 8081, maybe?

Thanks,
Andrea

Andrea
Il 05/mag/2016 03:49, "Jose Carrasco" <jo...@lcc.uma.es> ha scritto:

> Hi all,
>
> I tried to deploy a BrooklynNode entity with an explicit web console port
> (8082) over a AWS VM machine. Using the following plan:
>
> name: BrooklynNode
> location:
>  jclouds:aws-ec2:
>    region: us-west-2
>    identity: ****
>    credential: ****
> services:
> - type: org.apache.brooklyn.entity.brooklynnode.BrooklynNode
>  id: brooklynNode
>  name: brooklynNode
>  brooklyn.config:
>    onExistingProperties: do_not_use
>    brooklynnode.webconsole.nosecurity: true
>    brooklynnode.webconsole.httpPort: 8082
>
> However I found an error because the entity did not look to be up (
> SERVICE_UP retrieved false). Then, I tried to figure out a bit. The
> BrooklynNode instance was installed and executed correctly but the VM’s
> security group did not have any rule to enable the 8082 port. It looks that
> the problem is here [1], the following if code condition:
>
> (PortRange.class.isAssignableFrom(k.getType()) ||
> portsPattern.matcher(k.getName()).matches())
>
> returns false because when the BrooklynNode.HTTPS_PORT is evaluated the
> entity is not assignable from PortRange because the config key instance
> is retrieved by [2], which returns a ConfigKey<Object>, so the type is
> not assignable from PortRange.class.
> Moreover, the config key name is brooklynnode.webconsole.httpPort, which
> is not matchable by the portPattern “*.port”.
> Then, the port that is specified from BrooklynNode.HTTPS_PORT config key
> is  not  evaluated as a PortRange config key, and it is not returned by
> getRequiredOpenPorts() method. Then you can see that the VM does not
> contains the necessary flags [3] to open the specified http port, so as
> result the *Brooklyn node web console* is not accesible.
> I have seen that there is a test which check the BrooklynNode.HTTPS_PORT
> in BrooklynNodeIntegrationTest [4], but  (I think) different ports are
> tested over the local machine where all ports are accessible.
>
> If you consider that this behavior should be solved, I have two different
> proposal.
>
>    - First,  adapting the BrooklynNode.HTTPS_PORT name to the
>    portPattern, so “brooklynnode.webconsole.httpPort” should be replaced
>    by “brooklynnode.webconsole.http.port”. I think it is the best option.
>    (it should be necessary review the rest of config keys too).
>    - Modify the InboundPortsUtils#getRequiredOpenPorts method in order to
>    support config keys whose value is assignable from PortRange. In this
>    case I have written a little commit [commit].
>
>
> I would like to solve this issue.
> Thought?
>
> Please, note that if you configure the BrooklynNode.HTTPS_PORT pointing to
> 8081 (default value) the web console will be not accessible because the
> configuration follows the same process that 8082 scenario.
> If no port is defined, the 8081 will be accessible because config keys
> will be retrieved by the entityType [5] that provides the default entities’
> ConfigKeys whose types will be assignable from PortRange.class.
>
> Jose
> GSoC student
>
> [1]
> https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java#L85
>
> [2]
> https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java#L80
>
> [3]
> https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java#L374
>
> [4]
> https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/test/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
>
> [commit]
> https://github.com/kiuby88/brooklyn-server/commit/06086c346719abe9c9162dce773677d2abad5d05
>
> [5]
> https://github.com/apache/brooklyn-server/blob/9b0fe8a6d1766728753e0d3ae7bf7c87602a443a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/InboundPortsUtils.java#L78
>
>