Environment-specific configuration

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Environment-specific configuration

pc3356
This post was updated on .
Hi,

We have a requirement to be able to specify per environment (dev, test, stage and live, not just dev and prod) where to look for our persistence layer.

On local dev machines, this might be specified as something like:

<property as="xs:anyURI"
        name="oxf.fr.persistence.xforms-persistence.uri"
        value="http://localhost:8180/xforms"/>

But on "later" environments, we would want this to be something more like:

<property as="xs:anyURI"
        name="oxf.fr.persistence.xforms-persistence.uri"
        value="https://${enviroment}.abc.com/xforms"/>

We have a mechanism internally based on Spring placeholder properties configurer to handle this situation in our own apps, but I wanted to check to see if there was a specific Orbeon way of doing this first before I went ahead down this route.

Is this something that is dealt with by Orbeon out of the box, or are we going to have to roll our own custom solution?

Many thanks,

Phil.
Reply | Threaded
Open this post in threaded view
|

Re: Environment-specific configuration

Alessandro  Vernet
Administrator
Hi Phil,

Right now, there is no such "declare a variable and use it later"
mechanism in property files. Maybe related, there is a concept of "run
mode", which allows you to use different properties for different
environments, declare those properties in different files (e.g.
properties-local-prod.xml and properties-local-dev.xml), and select
which mode you want to be in through the web.xml. You'll find more on
this in this blog post:

http://blog.orbeon.com/2012/05/run-modes.html

Alex

On Wed, Feb 6, 2013 at 9:23 AM, pc3356 <[hidden email]> wrote:

> Hi,
>
> We have a requirement to be able to specify per environment (dev, test,
> stage and live, not just dev and prod) where to look for our persistence
> layer.
>
> On local dev machines, this might be specified as something like:
>
> <property as="xs:anyURI"
>         name="oxf.fr.persistence.isite2.uri"
>         value="http://localhost:8180/xforms"/>
>
> But on "later" environments, we would want this to be something more like:
>
> <property as="xs:anyURI"
>         name="oxf.fr.persistence.isite2.uri"
>         value="https://${enviroment}.abc.com"/>
>
> We have a mechanism internally based on Spring placeholder properties
> configurer to handle this situation in our own apps, but I wanted to check
> to see if there was a specific Orbeon way of doing this first before I went
> ahead down this route.
>
> Is this something that is dealt with by Orbeon out of the box, or are we
> going to have to roll our own custom solution?
>
> Many thanks,
>
> Phil.
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Environment-specific-configuration-tp4656243.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Environment-specific configuration

pc3356
Hi Alex,

We worked out a way to do this which (so far) seems to be working:

1) In web.xml (which is aware of various external variables) we added a new FilesystemResourceManager as the first in the priority list (we now have 3) and pointed its sandbox directory to:

${CATALINA_BASE}/webapps/orbeon/ext-conf/${ENVIRONMENT}/

And put a series of environment-specific config directories under here.

2) In each of the environment-specific directories, we created a minimal properties-local.xml which just contained the things that would change between environments.

3) At the ext-conf root, we put a common-properties.xml file containing the config common to all environments.

4) Used XInclude to include ../../common-properties.xml from within each environment-specific config file.

Took a day of fiddling, but it works now :)

Cheers,

Phil.

On 12 Feb 2013, at 02:38, Alessandro Vernet [via Orbeon Forms (ops-users)] wrote:

Hi Phil,

Right now, there is no such "declare a variable and use it later"
mechanism in property files. Maybe related, there is a concept of "run
mode", which allows you to use different properties for different
environments, declare those properties in different files (e.g.
properties-local-prod.xml and properties-local-dev.xml), and select
which mode you want to be in through the web.xml. You'll find more on
this in this blog post:

http://blog.orbeon.com/2012/05/run-modes.html

Alex

On Wed, Feb 6, 2013 at 9:23 AM, pc3356 <<a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=0" target="_top" rel="nofollow" link="external">[hidden email]> wrote:

> Hi,
>
> We have a requirement to be able to specify per environment (dev, test,
> stage and live, not just dev and prod) where to look for our persistence
> layer.
>
> On local dev machines, this might be specified as something like:
>
> <property as="xs:anyURI"
>         name="oxf.fr.persistence.isite2.uri"
>         value="http://localhost:8180/xforms"/>
>
> But on "later" environments, we would want this to be something more like:
>
> <property as="xs:anyURI"
>         name="oxf.fr.persistence.isite2.uri"
>         value="https://${enviroment}.abc.com"/>
>
> We have a mechanism internally based on Spring placeholder properties
> configurer to handle this situation in our own apps, but I wanted to check
> to see if there was a specific Orbeon way of doing this first before I went
> ahead down this route.
>
> Is this something that is dealt with by Orbeon out of the box, or are we
> going to have to roll our own custom solution?
>
> Many thanks,
>
> Phil.
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Environment-specific-configuration-tp4656243.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the <a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=1" target="_top" rel="nofollow" link="external">[hidden email] mailing list.
> To unsubscribe: mailto:<a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=2" target="_top" rel="nofollow" link="external">[hidden email]
> For general help: mailto:<a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=3" target="_top" rel="nofollow" link="external">[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>

--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet


--
You receive this message as a subscriber of the <a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=4" target="_top" rel="nofollow" link="external">[hidden email] mailing list.
To unsubscribe: mailto:<a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=5" target="_top" rel="nofollow" link="external">[hidden email]
For general help: mailto:<a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=6" target="_top" rel="nofollow" link="external">[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws



If you reply to this email, your message will be added to the discussion below:
http://orbeon-forms-ops-users.24843.n4.nabble.com/Environment-specific-configuration-tp4656243p4656255.html
To unsubscribe from Environment-specific configuration, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Re: Environment-specific configuration

Alessandro  Vernet
Administrator

Hi Phil,

Yes, this is perfect! I couldn't have suggested a better way to do it. We often resort to using a combination of additional resource managers and XInclude to deal with "special cases" like this one. Maybe this is something we should write about in the documentation or blog about. In the meantime, hopefully people searching about this will find your post here. Thanks for sharing,

Alex

On Feb 12, 2013 12:55 AM, "pc3356" <[hidden email]> wrote:
Hi Alex,

We worked out a way to do this which (so far) seems to be working:

1) In web.xml (which is aware of various external variables) we added a new FilesystemResourceManager as the first in the priority list (we now have 3) and pointed its sandbox directory to:

${CATALINA_BASE}/webapps/orbeon/ext-conf/${ENVIRONMENT}/

And put a series of environment-specific config directories under here.

2) In each of the environment-specific directories, we created a minimal properties-local.xml which just contained the things that would change between environments.

3) At the ext-conf root, we put a common-properties.xml file containing the config common to all environments.

4) Used XInclude to include ../../common-properties.xml from within each environment-specific config file.

Took a day of fiddling, but it works now :)

Cheers,

Phil.

On 12 Feb 2013, at 02:38, Alessandro Vernet [via Orbeon Forms (ops-users)] wrote:

Hi Phil,

Right now, there is no such "declare a variable and use it later"
mechanism in property files. Maybe related, there is a concept of "run
mode", which allows you to use different properties for different
environments, declare those properties in different files (e.g.
properties-local-prod.xml and properties-local-dev.xml), and select
which mode you want to be in through the web.xml. You'll find more on
this in this blog post:

http://blog.orbeon.com/2012/05/run-modes.html

Alex

On Wed, Feb 6, 2013 at 9:23 AM, pc3356 <<a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=0" target="_top" rel="nofollow" link="external">[hidden email]> wrote:

> Hi,
>
> We have a requirement to be able to specify per environment (dev, test,
> stage and live, not just dev and prod) where to look for our persistence
> layer.
>
> On local dev machines, this might be specified as something like:
>
> <property as="xs:anyURI"
>         name="oxf.fr.persistence.isite2.uri"
>         value="http://localhost:8180/xforms"/>
>
> But on "later" environments, we would want this to be something more like:
>
> <property as="xs:anyURI"
>         name="oxf.fr.persistence.isite2.uri"
>         value="https://${enviroment}.abc.com"/>
>
> We have a mechanism internally based on Spring placeholder properties
> configurer to handle this situation in our own apps, but I wanted to check
> to see if there was a specific Orbeon way of doing this first before I went
> ahead down this route.
>
> Is this something that is dealt with by Orbeon out of the box, or are we
> going to have to roll our own custom solution?
>
> Many thanks,
>
> Phil.
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Environment-specific-configuration-tp4656243.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the <a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=1" target="_top" rel="nofollow" link="external">[hidden email] mailing list.
> To unsubscribe: mailto:<a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=2" target="_top" rel="nofollow" link="external">[hidden email]
> For general help: mailto:<a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=3" target="_top" rel="nofollow" link="external">[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>

--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet


--
You receive this message as a subscriber of the <a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=4" target="_top" rel="nofollow" link="external">[hidden email] mailing list.
To unsubscribe: mailto:<a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=5" target="_top" rel="nofollow" link="external">[hidden email]
For general help: mailto:<a href="x-msg://150/user/SendEmail.jtp?type=node&amp;node=4656255&amp;i=6" target="_top" rel="nofollow" link="external">[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws



If you reply to this email, your message will be added to the discussion below:
http://orbeon-forms-ops-users.24843.n4.nabble.com/Environment-specific-configuration-tp4656243p4656255.html
To unsubscribe from Environment-specific configuration, click here.
NAML



View this message in context: Re: Environment-specific configuration
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Environment-specific configuration

bgawel
In reply to this post by pc3356
Hi,

The other solution is to integrate Orbeon with a Maven build process by simply moving the WEB-INF directory from orbeon.war into src/main/webapp. Then you can benefit from resources filtering provided by maven-war-plugin and fill placeholders specified in properties-local*.xml,
something like that:

<artifactId>maven-war-plugin</artifactId>                               
<configuration>       
<webResources>                                       
  <resource>
     <directory>your directory with properties-local*.xml</directory>
     <filtering>true</filtering>
     <includes>
          <include>properties-local*.xml</include>
     </includes>
     <targetPath>WEB-INF/resources/config</targetPath>                           
  </resource>
   …
</webResources>                   
</configuration>

We are using this solution to filter properties-local*.xml, web.xml and log4j.xml.

--
Regards,
 Bartek

pc3356 wrote
Hi Alex,

We worked out a way to do this which (so far) seems to be working:

1) In web.xml (which is aware of various external variables) we added a new FilesystemResourceManager as the first in the priority list (we now have 3) and pointed its sandbox directory to:

${CATALINA_BASE}/webapps/orbeon/ext-conf/${ENVIRONMENT}/

And put a series of environment-specific config directories under here.

2) In each of the environment-specific directories, we created a minimal properties-local.xml which just contained the things that would change between environments.

3) At the ext-conf root, we put a common-properties.xml file containing the config common to all environments.

4) Used XInclude to include ../../common-properties.xml from within each environment-specific config file.

Took a day of fiddling, but it works now :)

Cheers,

Phil.

On 12 Feb 2013, at 02:38, Alessandro Vernet [via Orbeon Forms (ops-users)] wrote:

> Hi Phil,
>
> Right now, there is no such "declare a variable and use it later"
> mechanism in property files. Maybe related, there is a concept of "run
> mode", which allows you to use different properties for different
> environments, declare those properties in different files (e.g.
> properties-local-prod.xml and properties-local-dev.xml), and select
> which mode you want to be in through the web.xml. You'll find more on
> this in this blog post:
>
> http://blog.orbeon.com/2012/05/run-modes.html
>
> Alex
>
> On Wed, Feb 6, 2013 at 9:23 AM, pc3356 <[hidden email]> wrote:
>
> > Hi,
> >
> > We have a requirement to be able to specify per environment (dev, test,
> > stage and live, not just dev and prod) where to look for our persistence
> > layer.
> >
> > On local dev machines, this might be specified as something like:
> >
> > <property as="xs:anyURI"
> >         name="oxf.fr.persistence.isite2.uri"
> >         value="http://localhost:8180/xforms"/>
> >
> > But on "later" environments, we would want this to be something more like:
> >
> > <property as="xs:anyURI"
> >         name="oxf.fr.persistence.isite2.uri"
> >         value="https://${enviroment}.abc.com"/>
> >
> > We have a mechanism internally based on Spring placeholder properties
> > configurer to handle this situation in our own apps, but I wanted to check
> > to see if there was a specific Orbeon way of doing this first before I went
> > ahead down this route.
> >
> > Is this something that is dealt with by Orbeon out of the box, or are we
> > going to have to roll our own custom solution?
> >
> > Many thanks,
> >
> > Phil.
> >
> >
> >
> > --
> > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Environment-specific-configuration-tp4656243.html
> > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Environment-specific configuration

pc3356
Hi Bartek,

This is a fantastic idea; we're in the middle of a release at the moment, but when we have a little breathing space I'll give this a try and see how it all looks.

Thanks very much!

Phil.

On 14 February 2013 08:21, bgawel [via Orbeon Forms (ops-users)] <[hidden email]> wrote:
Hi,

The other solution is to integrate Orbeon with a Maven build process by simply moving the WEB-INF directory from orbeon.war into src/main/webapp. Then you can benefit from resources filtering provided by maven-war-plugin and fill placeholders specified in properties-local*.xml,
something like that:

<artifactId>maven-war-plugin</artifactId>                               
<configuration>       
<webResources>                                       
  <resource>
     <directory>your directory with properties-local*.xml</directory>
     <filtering>true</filtering>
     <includes>
          <include>properties-local*.xml</include>
     </includes>
     <targetPath>WEB-INF/resources/config</targetPath>                           
  </resource>
   …
</webResources>                   
</configuration>

We are using this solution to filter properties-local*.xml, web.xml and log4j.xml.

--
Regards,
 Bartek

pc3356 wrote
Hi Alex,

We worked out a way to do this which (so far) seems to be working:

1) In web.xml (which is aware of various external variables) we added a new FilesystemResourceManager as the first in the priority list (we now have 3) and pointed its sandbox directory to:

${CATALINA_BASE}/webapps/orbeon/ext-conf/${ENVIRONMENT}/

And put a series of environment-specific config directories under here.

2) In each of the environment-specific directories, we created a minimal properties-local.xml which just contained the things that would change between environments.

3) At the ext-conf root, we put a common-properties.xml file containing the config common to all environments.

4) Used XInclude to include ../../common-properties.xml from within each environment-specific config file.

Took a day of fiddling, but it works now :)

Cheers,

Phil.

On 12 Feb 2013, at 02:38, Alessandro Vernet [via Orbeon Forms (ops-users)] wrote:

> Hi Phil,
>
> Right now, there is no such "declare a variable and use it later"
> mechanism in property files. Maybe related, there is a concept of "run
> mode", which allows you to use different properties for different
> environments, declare those properties in different files (e.g.
> properties-local-prod.xml and properties-local-dev.xml), and select
> which mode you want to be in through the web.xml. You'll find more on
> this in this blog post:
>
> http://blog.orbeon.com/2012/05/run-modes.html
>
> Alex
>
> On Wed, Feb 6, 2013 at 9:23 AM, pc3356 <[hidden email]> wrote:
>
> > Hi,
> >
> > We have a requirement to be able to specify per environment (dev, test,
> > stage and live, not just dev and prod) where to look for our persistence
> > layer.
> >
> > On local dev machines, this might be specified as something like:
> >
> > <property as="xs:anyURI"
> >         name="oxf.fr.persistence.isite2.uri"
> >         value="http://localhost:8180/xforms"/>
> >
> > But on "later" environments, we would want this to be something more like:
> >
> > <property as="xs:anyURI"
> >         name="oxf.fr.persistence.isite2.uri"
> >         value="https://${enviroment}.abc.com"/>
> >
> > We have a mechanism internally based on Spring placeholder properties
> > configurer to handle this situation in our own apps, but I wanted to check
> > to see if there was a specific Orbeon way of doing this first before I went
> > ahead down this route.
> >
> > Is this something that is dealt with by Orbeon out of the box, or are we
> > going to have to roll our own custom solution?
> >
> > Many thanks,
> >
> > Phil.
> >
> >
> >
> > --
> > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Environment-specific-configuration-tp4656243.html
> > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.



If you reply to this email, your message will be added to the discussion below:
http://orbeon-forms-ops-users.24843.n4.nabble.com/Environment-specific-configuration-tp4656243p4656261.html
To unsubscribe from Environment-specific configuration, click here.
NAML