You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by owain <ow...@integration.technology> on 2016/09/14 09:47:57 UTC

Fuse Blueprint properties override

Hi,

In Fuse it looks as though if you have a property set in xml in
cm:property-placeholder then you cannot override it in persistent.id.cfg
file in /etc.  I could see the properties in there but they appeared not to
be used by the route, it just used the ones set in the xml.

Is this true, if so I couldn't see it documented anywhere?

O.



--
View this message in context: http://camel.465427.n5.nabble.com/Fuse-Blueprint-properties-override-tp5787541.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Fuse Blueprint properties override

Posted by Brad Johnson <br...@mediadriver.com>.
As for the sensitive settings in the properties XML/cfg files, I'd probably
go this way:

http://camel.apache.org/jasypt.html

On Fri, Sep 16, 2016 at 12:34 PM, Brad Johnson <brad.johnson@mediadriver.com
> wrote:

> I've tried to find ways to override the values of a pid, though haven't
> dug into it in depth.  Also the possibility of using multiple pids in a
> single blueprint (achieving much the same.)
>
> Theoretically it is possible and I think it is in DS but I'm not a big
> user of DS so don't take that as gospel.  I think even blueprint permits
> but the problem is in the implementation (again don't quote me on that
> one.) My recollection is that it should be possible but the Camel blueprint
> and Aries of at least some earlier versions didn't support it.  I've become
> so used to using a single PID that I don't worry about it. One solution is
> you can create an OSGi service for the functionality that is required by
> and shared between the bundles and call that service instead of duplicating
> it across bundles.
>
> Brad
>
> On Fri, Sep 16, 2016 at 4:20 AM, owain <ow...@integration.technology>
> wrote:
>
>> Ranx,
>>
>> Thanks for the tip.  I have a parent project (POM) and modules, one each
>> for
>> services.  So currently I have a pid for each service but some of the cfg
>> settings are common across projects (e.g. kafka server address which is a
>> pointer to a docker linked container).
>>
>> What would be cool would be to have some defaults in a parent pid and then
>> over-rides and additional ones in the modules pid (or same pid?).  Is
>> there
>> a way to do this?
>>
>> Additionally, some of the properties should not be in git since they are
>> "secure".  At the moment I am deploying them via a volume mount from the
>> fuse docker container to /etc and intend to manage them via a fabric
>> profile
>> (next stage).  Any tips on this.
>>
>> A very useful reply, might be a blog post?  Only the basics are covered in
>> the Camel in Action and Cookbook.
>>
>> Thanks again.
>>
>> O.
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.
>> com/Fuse-Blueprint-properties-override-tp5787541p5787633.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>

Re: Fuse Blueprint properties override

Posted by Brad Johnson <br...@mediadriver.com>.
I've tried to find ways to override the values of a pid, though haven't dug
into it in depth.  Also the possibility of using multiple pids in a single
blueprint (achieving much the same.)

Theoretically it is possible and I think it is in DS but I'm not a big user
of DS so don't take that as gospel.  I think even blueprint permits but the
problem is in the implementation (again don't quote me on that one.) My
recollection is that it should be possible but the Camel blueprint and
Aries of at least some earlier versions didn't support it.  I've become so
used to using a single PID that I don't worry about it. One solution is you
can create an OSGi service for the functionality that is required by and
shared between the bundles and call that service instead of duplicating it
across bundles.

Brad

On Fri, Sep 16, 2016 at 4:20 AM, owain <ow...@integration.technology> wrote:

> Ranx,
>
> Thanks for the tip.  I have a parent project (POM) and modules, one each
> for
> services.  So currently I have a pid for each service but some of the cfg
> settings are common across projects (e.g. kafka server address which is a
> pointer to a docker linked container).
>
> What would be cool would be to have some defaults in a parent pid and then
> over-rides and additional ones in the modules pid (or same pid?).  Is there
> a way to do this?
>
> Additionally, some of the properties should not be in git since they are
> "secure".  At the moment I am deploying them via a volume mount from the
> fuse docker container to /etc and intend to manage them via a fabric
> profile
> (next stage).  Any tips on this.
>
> A very useful reply, might be a blog post?  Only the basics are covered in
> the Camel in Action and Cookbook.
>
> Thanks again.
>
> O.
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Fuse-Blueprint-properties-override-tp5787541p5787633.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Fuse Blueprint properties override

Posted by owain <ow...@integration.technology>.
Ranx,

Thanks for the tip.  I have a parent project (POM) and modules, one each for
services.  So currently I have a pid for each service but some of the cfg
settings are common across projects (e.g. kafka server address which is a
pointer to a docker linked container). 

What would be cool would be to have some defaults in a parent pid and then
over-rides and additional ones in the modules pid (or same pid?).  Is there
a way to do this?

Additionally, some of the properties should not be in git since they are
"secure".  At the moment I am deploying them via a volume mount from the
fuse docker container to /etc and intend to manage them via a fabric profile
(next stage).  Any tips on this.

A very useful reply, might be a blog post?  Only the basics are covered in
the Camel in Action and Cookbook.

Thanks again.

O.





--
View this message in context: http://camel.465427.n5.nabble.com/Fuse-Blueprint-properties-override-tp5787541p5787633.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Fuse Blueprint properties override

Posted by Brad Johnson <br...@mediadriver.com>.
Oops.  That should read:

 "Commonly then I can keep a standard file called configuration.cfg in the
filtered-resources..."  Of course you can call it anything you like, the
point is just that if it is always the same name the features install
becomes much easier especially when tired or harried (and really is there
any other mode of operation for a developer?)

On Thu, Sep 15, 2016 at 9:50 AM, Brad Johnson <br...@mediadriver.com>
wrote:

> Owain,
>
> Cool.  If you made that header change I think you'll see what you are
> after.  Incidentally I'll commonly use the groupId and artifactId as my PID
> name.  Commonly then I can keep a standard file called config.cfg in the
> filtered-resources of the project and in the features file have it install
> the config.cfg as groupId.artifactId.cfg.  You'll need this in your parent
> or even child POM.
>
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>build-helper-maven-plugin</artifactId>
> <executions>
>
> <execution>
> <id>attach-artifacts</id>
> <phase>package</phase>
> <goals>
> <goal>attach-artifact</goal>
> </goals>
>
> <configuration>
> <skipAttach>${skip.attachment}</skipAttach>
> <artifacts>
> <artifact>
> <file>src/main/filtered-resources/configuration.cfg</file>
> <type>cfg</type>
> <classifier>configuration</classifier>
> </artifact>
> </artifacts>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
> Note the skip.attachment flag. By default I'll set that to true so the
> child has to explicitly set it to false in order to get the
> filtered-resource attached.
>
> In the features file you can add a line like this:
>
> <configfile finalname="/etc/com.foo.bar.cfg" override="false">mvn:com.foo/
> bar/${project.version}/cfg/configuration</configfile>
>
> That then installs the standard configuration.cfg file contained in your
> project into the etc directory with the same name as the groupId and
> artifcatId.  It makes it easy to remember what the PID is then as well
> since you are telling to get the cfg out of the com.foo/bar Maven repo and
> so that should be the name of your cfg file as long as your PID in the
> blueprint properties matches that.
>
> That works well for largish projects but if you aren't using features
> files or if that seems too convoluted then just do it some other way.  The
> one advantage is that you always know the name of the configuration.cfg
> file you want to get from your bundle and all your projects are fairly
> standardized then - more convention over configuration.
>
> On Thu, Sep 15, 2016 at 4:27 AM, owain <ow...@integration.technology>
> wrote:
>
>> Thanks for the two responses.  The blog post is very comprehensive.  I
>> have
>> updated blueprint-cm-1.1.0 and have added the update strategy to reload.
>>
>> Yes the persistent-id does not have cfg on the end, just the filename.
>> (also the persistent id cannot have a - in it ends up being a Java method
>> name, another gotcha!)
>>
>> I have yet to test the override but will report back.
>>
>> Thanks again.
>>
>> O.
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.
>> com/Fuse-Blueprint-properties-override-tp5787541p5787590.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>

Re: Fuse Blueprint properties override

Posted by Brad Johnson <br...@mediadriver.com>.
Owain,

Cool.  If you made that header change I think you'll see what you are
after.  Incidentally I'll commonly use the groupId and artifactId as my PID
name.  Commonly then I can keep a standard file called config.cfg in the
filtered-resources of the project and in the features file have it install
the config.cfg as groupId.artifactId.cfg.  You'll need this in your parent
or even child POM.

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>

<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>

<configuration>
<skipAttach>${skip.attachment}</skipAttach>
<artifacts>
<artifact>
<file>src/main/filtered-resources/configuration.cfg</file>
<type>cfg</type>
<classifier>configuration</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>

Note the skip.attachment flag. By default I'll set that to true so the
child has to explicitly set it to false in order to get the
filtered-resource attached.

In the features file you can add a line like this:

<configfile finalname="/etc/com.foo.bar.cfg"
override="false">mvn:com.foo/bar/${project.version}/cfg/configuration</configfile>

That then installs the standard configuration.cfg file contained in your
project into the etc directory with the same name as the groupId and
artifcatId.  It makes it easy to remember what the PID is then as well
since you are telling to get the cfg out of the com.foo/bar Maven repo and
so that should be the name of your cfg file as long as your PID in the
blueprint properties matches that.

That works well for largish projects but if you aren't using features files
or if that seems too convoluted then just do it some other way.  The one
advantage is that you always know the name of the configuration.cfg file
you want to get from your bundle and all your projects are fairly
standardized then - more convention over configuration.

On Thu, Sep 15, 2016 at 4:27 AM, owain <ow...@integration.technology> wrote:

> Thanks for the two responses.  The blog post is very comprehensive.  I have
> updated blueprint-cm-1.1.0 and have added the update strategy to reload.
>
> Yes the persistent-id does not have cfg on the end, just the filename.
> (also the persistent id cannot have a - in it ends up being a Java method
> name, another gotcha!)
>
> I have yet to test the override but will report back.
>
> Thanks again.
>
> O.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Fuse-Blueprint-properties-override-tp5787541p5787590.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Fuse Blueprint properties override

Posted by owain <ow...@integration.technology>.
Thanks for the two responses.  The blog post is very comprehensive.  I have
updated blueprint-cm-1.1.0 and have added the update strategy to reload.

Yes the persistent-id does not have cfg on the end, just the filename. 
(also the persistent id cannot have a - in it ends up being a Java method
name, another gotcha!)

I have yet to test the override but will report back.

Thanks again.

O.



--
View this message in context: http://camel.465427.n5.nabble.com/Fuse-Blueprint-properties-override-tp5787541p5787590.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Fuse Blueprint properties override

Posted by Brad Johnson <br...@mediadriver.com>.
As Grzegorz pointed out you have to have the reload flag in to hot swap
values.  And it's important that you make sure you specify the 1.1.0 of cm
in your header as the reload doesn't work earlier.

Having said that, if you change the value in the .cfg file and then start
you Fuse instance it should preferentially use the .cfg  values.  Is that
much happening?  Also, when you look  at the


Header to make sure the reload works.

 http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd">

//May be obvious but make sure the .cfg is not part of the PID.  Otherwise
if the PID below were foo.bar.cfg it would be looking in the etc directory
for a file called foo.bar.cfg.cfg.

<cm:property-placeholder persistent-id="foo.bar" update-strategy="reload">
<cm:default-properties>
<cm:property name="some" value="value" />
</cm:default-properties>
</cm:property-placeholder>

On Wed, Sep 14, 2016 at 6:28 AM, Grzegorz Grzybek <gr...@gmail.com>
wrote:

> Hello
>
> Did you use update-strategy="reload" in <cm:property-placeholder>?
> See technical explanation here:
> http://ggrzybek.blogspot.com/2015/12/camel-blueprint-test-support.html
>
> regards
> Grzegorz Grzybek
>
> 2016-09-14 11:47 GMT+02:00 owain <ow...@integration.technology>:
>
> > Hi,
> >
> > In Fuse it looks as though if you have a property set in xml in
> > cm:property-placeholder then you cannot override it in persistent.id.cfg
> > file in /etc.  I could see the properties in there but they appeared not
> to
> > be used by the route, it just used the ones set in the xml.
> >
> > Is this true, if so I couldn't see it documented anywhere?
> >
> > O.
> >
> >
> >
> > --
> > View this message in context: http://camel.465427.n5.nabble.
> > com/Fuse-Blueprint-properties-override-tp5787541.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>

Re: Fuse Blueprint properties override

Posted by Grzegorz Grzybek <gr...@gmail.com>.
Hello

Did you use update-strategy="reload" in <cm:property-placeholder>?
See technical explanation here:
http://ggrzybek.blogspot.com/2015/12/camel-blueprint-test-support.html

regards
Grzegorz Grzybek

2016-09-14 11:47 GMT+02:00 owain <ow...@integration.technology>:

> Hi,
>
> In Fuse it looks as though if you have a property set in xml in
> cm:property-placeholder then you cannot override it in persistent.id.cfg
> file in /etc.  I could see the properties in there but they appeared not to
> be used by the route, it just used the ones set in the xml.
>
> Is this true, if so I couldn't see it documented anywhere?
>
> O.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Fuse-Blueprint-properties-override-tp5787541.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>