brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Azhar I Hashmi" <aihas...@us.ibm.com>
Subject "using variable later in postprovisionscript or any other script"
Date Thu, 22 Jan 2015 01:10:58 GMT

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
          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.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
": 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
": lib/mysql-connector-java-5.1.10.jar
          "https://provision/tomcat-users.xml": conf/tomcat-users.xml


Thanks
Azhar



From:	Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
To:	dev@brooklyn.incubator.apache.org
Date:	01/21/2015 06:08 PM
Subject:	Re: "force resolution of localhost to be loopback, otherwise we
            hit problems"




Sam-

If the localhost IP is set up right there should be no problem changing
or removing the flag in the launch script for that one case.

Background though is exactly as Richard described.  Several people have
hit problems deploying to "localhost" because localhost is mapped to a
bad IP address.

This can happen in clouds where /etc/hosts is foolishly set up.

Worse, on Mac it was sometimes the case that localhost resolves to the
subnet IP.  That IP would be cached, and then if you change wifi points,
localhost deployments could get very confused.  This might be better in
yosemite (localhost resolves to 127.0.0.1 for me at least) but it's hard
to be sure.  Maybe someone else knows better?

Why do you want localhost to resolve to something else?  It seems unusual.

--A


On 19/01/2015 10:34, Richard Downer wrote:
> Sam,
>
> I would guess that if the hostname/domain name are properly configured
> everything should work. Unfortunately, it's easy to *not* quite
> configure networking correctly.
>
> My understanding of the canonical way to set the system hostname and
> domain name is as follows:
>
> /etc/hosts:
>
> 127.0.0.1  hostname hostname.domainname localhost
> # that must be the first non-comment line
>
> Configure the system hostname (without domainname); IIRC, on
> Debian-derivatives you write it to the file /etc/hostname, and on
> RedHat-derivatives there's a variable in /etc/sysconfig/network
>
> Then either run "hostname newhostname" or "service network restart" or
reboot.
>
> Check it works:
> # hostname
> (returns the bare hostname)
> # hostname --fqdn
> (returns the hostname and DNS domainname)
>
>
>
>
> On 18 January 2015 at 10:32, Sam Corbett <sam.corbett@cloudsoftcorp.com>
wrote:
>> BrooklynServiceAttributes defines the property and has a comment saying:
>>
>> /** in some cases localhost does not resolve correctly
>>   * (e.g. to an interface which is defined locally but not in operation,
>>   * or where multiple NICs are available and java's
>> InetAddress.getLocalHost() strategy is not doing what is desired);
>>   * use this to supply a specific address (e.g. "127.0.0.1" or a
specific IP
>> on a specific NIC or FW)
>>   */
>>
>> I guess this answers my question but it doesn't give me much assurance.
>>
>> On 18 January 2015 at 10:02, Sam Corbett <sam.corbett@cloudsoftcorp.com>
>> wrote:
>>
>>> Hi,
>>>
>>> The `brooklyn` launch script sets
>>> `-Dbrooklyn.location.localhost.address=127.0.0.1` with the cryptic
>>> explanation that 'otherwise we hit problems'. Can anybody explain what
>>> problems are avoided? I have a case in which I'd like the hostname of a
>>> localhost location to be the hostname of the machine, but I'd also like
to
>>> know what will happen if I change or remove the flag.
>>>
>>> Thanks,
>>>
>>> Sam
>>>


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message