You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by Azhar I Hashmi <ai...@us.ibm.com> on 2015/01/23 00:15:50 UTC

NEW DOC-- AWESOME! But......

Hello guys,

I loved the new doc:
https://brooklyn.incubator.apache.org/learnmore/catalog/index.html
It really helped me a lot to understand and to use config/sensors etc....

However, this new doc is still incomplete for some entries for example:  It
is missing some of the configs.  In Tomcat entity it does not have
files.install. I believe it should be there b/c I used it and it works
fine.

The other issue is the description is not complete. For example:



This does not tell what should be the key in this map.  For example, I
cannot put any customize keys like  ":my_ram_key". I do not think customize
keys are supported by Brooklyn yet. I think document should list all
possible values for the map that Brooklyn   can understand and consume. For
example:
           minRam, minCores and minDisk, etc....

And provide an example, like this:

provisioning.properties:
  minRam: 2048mb
  minCores: 2
  minDisk: 25gb


Similarly, I have no idea what is it mean that "(will substitute things
like ${version} automatically)" if my download.url: http:// MY_URL how come
it will be replaced in version ?????




Thanks

Azhar





From:	Svetoslav Neykov <sv...@cloudsoftcorp.com>
To:	dev@brooklyn.incubator.apache.org
Date:	01/22/2015 04:44 AM
Subject:	Re: "using variable later in postprovisionscript or any other
            script"



Hi Azhar,

I tried your blueprint and here?s what I found out:
1.
  * setup.script needs to be specified inside the location. I tried to pass
it inside the entity config, but it?s not picked up.
  * setup.script can be used only with jclouds locations. It?s doesn?t get
executed for localhost or byon.
  * When passing formatString parameters to setup.script.vars you will get
a " Cannot coerce type class ? exception. It?s not supported currently.
  * setup.script should only be used for system-wide configuration where
you don?t need dynamic parameters.
  * In your case it?s best to move all tomcat configuration from your
script into a custom server.conf template and pass it to the entity. To
access the entity config use ${config.MY_VARIABLE}.
  * If you really need to pass variables to a script then you can use one
of pre.install.command, post.install.command. The former will get executed
before any installation steps take place so if you need to execute a script
download it from a URL. The latter can use the files from files.install.
Both work with localhost and byon. Note that the values for those are bash
commands, not script URLs.
  * To pass parameters to the above use shell.env.
  * Here?s a tested example:

location: <location>
services:
- type: brooklyn.entity.webapp.tomcat.TomcatServer
  brooklyn.config:
    files.install:
      "
http://central.maven.org/maven2/org/apache/tomcat/tomcat-dbcp/7.0.30/tomcat-dbcp-7.0.30.jar
": apache-tomcat-7.0.56/lib/tomcat-dbcp-7.0.30.jar
      "
http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.10/mysql-connector-java-5.1.10.jar
": apache-tomcat-7.0.56/lib/mysql-connector-java-5.1.10.jar
      ?<script url>": "/tmp/myscript.sh"
    files.runtime:
      "https://provision/tomcat-users.xml <
https://artifactory:AP5QT5YLhmBu3ET9Qe8wwkrNs3r@artifactory.mms.ibmcloud.com/artifactory/ext-release-local/amm-bss/provision/tomcat-users.xml
>": conf/tomcat-users.xml
  pre.install.command: bash <(wget <script url> -qO -)
  post.install.command: chmod +x /tmp/myscript.sh;/tmp/myscript.sh
  shell.env:
    myvar: $brooklyn:component("machine").attributeWhenReady
("host.address")
- type: brooklyn.entity.machine.MachineEntity
  id: machine


2. When you want to copy tomcat libraries you need files.install (as used
in your example). Since the tomcat distribution is extracted one level
below the ?files.install? folder you need:

files.install:
  "
http://central.maven.org/maven2/org/apache/tomcat/tomcat-dbcp/7.0.30/tomcat-dbcp-7.0.30.jar
": apache-tomcat-7.0.56/lib/tomcat-dbcp-7.0.30.jar
  "
http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.10/mysql-connector-java-5.1.10.jar
": apache-tomcat-7.0.56/lib/mysql-connector-java-5.1.10.jar

For tomcat-users.xml add:

files.runtime:
  "https://provision/tomcat-users.xml <
https://artifactory:AP5QT5YLhmBu3ET9Qe8wwkrNs3r@artifactory.mms.ibmcloud.com/artifactory/ext-release-local/amm-bss/provision/tomcat-users.xml
>": conf/tomcat-users.xml

which will copy the file to the ../apps/../conf folder.

Svet.

> On 22.01.2015 г., at 3:10, Azhar I Hashmi <ai...@us.ibm.com> wrote:
>
> Hello,
>
> Brooklyn provides a way to define variable and set their value using
sensor. However, I am not able to successfully use those variables. I could
not find those variables. I defined them in two different ways to use them
later in post script but was not able to find them. Here is a piece of the
YAML blueprint example:
>
> memberSpec:
> $brooklyn:entitySpec:
> type: brooklyn.entity.webapp.tomcat.TomcatServer
> id: tomcatServer
> location:
> named:standard-location-wdc01:
> customizerType:
io.cloudsoft.ibm.mms.amp.location.SoftlayerLocationCustomizer
> postInstallScriptUri: https://USE_VARIABLE_IN_SCRIPT.sh <
https://artifactory:AP5QT5YLhmBu3ET9Qe8wwkrNs3r@artifactory.mms.ibmcloud.com/artifactory/ext-release-local/amm-bss/provision/bss-tomcat.sh
>
> privateNetworkOnly: false
> brooklyn.config:
> https.port: 8443+
> MY_VARIABLE: $brooklyn:formatString("%s",
> component("BSSMySQLDB").attributeWhenReady("host.subnet.address"))
> setup.script: https://USE_VARIABLE_IN_SCRIPT <
https://artifactory:AP5QT5YLhmBu3ET9Qe8wwkrNs3r@artifactory.mms.ibmcloud.com/artifactory/ext-release-local/amm-bss/provision/bss-tomcat.sh
>.sh
> setup.script.vars:
> $brooklyn:formatString("tomcatPublicIP:%s,runPath:%s,webappUrl:%s",
> component("tomcatServer").attributeWhenReady("host.address"),
> component("tomcatServer").attributeWhenReady("run.dir"),
> component("tomcatServer").attributeWhenReady("webapp.url"))
>
> Question 1: How do I use these variables in my scrips?
> Question 2: I need following jars and xml file in Tomcat/apache catalina
lib and conf directories respectively. However, following piece of yaml
blueprint put them under /home/...../install/...../lib/
and /home/...../install/..../conf/ directories. I need the jar files under
lib folder of Catalina/tomcat 's lib directory and .xml file
under /home/..../apps/.......TomcatEntity/conf directory. Is there a
variable that I can use in <key,value> pair instead of lib/ and conf/
directories?
>
> files.install:
> "
http://central.maven.org/maven2/org/apache/tomcat/tomcat-dbcp/7.0.30/tomcat-dbcp-7.0.30.jar
 <
http://central.maven.org/maven2/org/apache/tomcat/tomcat-dbcp/7.0.30/tomcat-dbcp-7.0.30.jar
>": lib/tomcat-dbcp-7.0.30.jar
> "
http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.10/mysql-connector-java-5.1.10.jar
 <
http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.10/mysql-connector-java-5.1.10.jar
>": lib/mysql-connector-java-5.1.10.jar
> "https://provision/tomcat-users.xml <
https://artifactory:AP5QT5YLhmBu3ET9Qe8wwkrNs3r@artifactory.mms.ibmcloud.com/artifactory/ext-release-local/amm-bss/provision/tomcat-users.xml
>": conf/tomcat-users.xml
>
>
> Thanks
> Azhar
>