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