You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Claude Vedovini <cl...@vedovini.net> on 2009/06/05 13:56:29 UTC

Sling configuration

Hi all,

I use the sling web app on jBoss and I have issue with the location of
the sling home folder.

>From what I read in [1] it seems one can setup the sling.home property
either using the sling.property or the web.xml file, both located
inside the sling war file, am I right?

If so, how may I deliver an application that can be deployed on
different environments (test, UAT, prod) without repackaging the whole
stuff each time?

Thanks in advance, regards,
Claude

[1] http://incubator.apache.org/sling/site/configuration.html

Re: Sling configuration

Posted by Carsten Ziegeler <cz...@apache.org>.
Bertrand Delacretaz wrote:
> Hi,
> 
> On Tue, Jun 9, 2009 at 1:58 PM, Claude
> Vedovini<cl...@gmail.com> wrote:
>>> Thus given the system poroperty sling.home.prefix is set to
>>> "/var/sling". In this case the default sling.home for the /sling/i1 web
>>> app would be "/var/sling/_sling_i1".
>>>
>>> Would such a prefix suit your needs ?
>> That would certainly do, but why introduce a new concept?
>> Let's say that the sling.home property in the sling.property file, the
>> sling.home init-param in the web.xml and the sling.home system
>> property override each others (in this order) and they all specify the
>> root where each deployed sling servlet is going to create its
>> workspace.
> 
> I agree that having a single sling.home property would be simpler, so why not
> 
>   sling.home = ./sling/{1}
> 
> by default, where {1} is replaced by the (suitably escaped)
> SlingServlet's context path?
> 
> This would make things fully configurable, while allowing multiple
> instances of the SlingServlet to each have their own storage folder.
> 
I think this opens a door for misconfigurations. What happens if someone
forgets
about this {1} when configuring the system property and there are
several sling instances?
I think using the prefix as Felix suggested is much easier.

Regards
Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org

Re: Sling configuration

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Tue, Jun 9, 2009 at 1:58 PM, Claude
Vedovini<cl...@gmail.com> wrote:
>> Thus given the system poroperty sling.home.prefix is set to
>> "/var/sling". In this case the default sling.home for the /sling/i1 web
>> app would be "/var/sling/_sling_i1".
>>
>> Would such a prefix suit your needs ?
>
> That would certainly do, but why introduce a new concept?
> Let's say that the sling.home property in the sling.property file, the
> sling.home init-param in the web.xml and the sling.home system
> property override each others (in this order) and they all specify the
> root where each deployed sling servlet is going to create its
> workspace.

I agree that having a single sling.home property would be simpler, so why not

  sling.home = ./sling/{1}

by default, where {1} is replaced by the (suitably escaped)
SlingServlet's context path?

This would make things fully configurable, while allowing multiple
instances of the SlingServlet to each have their own storage folder.

-Bertrand

Re: Sling configuration

Posted by Felix Meschberger <fm...@gmail.com>.
Thanks for reporting. I added the findings of the mail thread as
implementation notes.

Regards
Felix

Claude Vedovini schrieb:
> Salut B.
> 
> Just created SLING-1004
> I did not bother reading any guideline for issue creation but I hope
> you'll like it :)
> 
> Cheers,
> Claude
> 
> 
> On Thu, Jun 11, 2009 at 2:36 PM, Bertrand
> Delacretaz<bd...@apache.org> wrote:
>> Salut Claude,
>>
>> On Thu, Jun 11, 2009 at 2:07 PM, Claude
>> Vedovini<cl...@gmail.com> wrote:
>>> ...Should I (can I) open a JIRA issue for this?..
>> yes please - the sling.home.prefix way seems to be the best, as Felix
>> suggests in his last message here.
>>
>> -Bertrand
>>
> 

Re: Sling configuration

Posted by Claude Vedovini <cl...@vedovini.net>.
Salut B.

Just created SLING-1004
I did not bother reading any guideline for issue creation but I hope
you'll like it :)

Cheers,
Claude


On Thu, Jun 11, 2009 at 2:36 PM, Bertrand
Delacretaz<bd...@apache.org> wrote:
> Salut Claude,
>
> On Thu, Jun 11, 2009 at 2:07 PM, Claude
> Vedovini<cl...@gmail.com> wrote:
>> ...Should I (can I) open a JIRA issue for this?..
>
> yes please - the sling.home.prefix way seems to be the best, as Felix
> suggests in his last message here.
>
> -Bertrand
>

Re: Sling configuration

Posted by Bertrand Delacretaz <bd...@apache.org>.
Salut Claude,

On Thu, Jun 11, 2009 at 2:07 PM, Claude
Vedovini<cl...@gmail.com> wrote:
> ...Should I (can I) open a JIRA issue for this?..

yes please - the sling.home.prefix way seems to be the best, as Felix
suggests in his last message here.

-Bertrand

Re: Sling configuration

Posted by Claude Vedovini <cl...@gmail.com>.
Hi all,
Should I (can I) open a JIRA issue for this?
C.

Re: Sling configuration

Posted by Claude Vedovini <cl...@gmail.com>.
> Thus given the system poroperty sling.home.prefix is set to
> "/var/sling". In this case the default sling.home for the /sling/i1 web
> app would be "/var/sling/_sling_i1".
>
> Would such a prefix suit your needs ?

That would certainly do, but why introduce a new concept?
Let's say that the sling.home property in the sling.property file, the
sling.home init-param in the web.xml and the sling.home system
property override each others (in this order) and they all specify the
root where each deployed sling servlet is going to create its
workspace.

WDYT?

Regards,
Claude

Re: Sling configuration

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Claude,

Claude Vedovini schrieb:
> Hi Felix, Bertrand,
> 
> There is something I don't get :)
> 
> Felix, in the example you gave previously, each deployed servlet adds
> its own context path to the sling.home folder

This is not correct. What I said is that sling.home is derieved from the
prefix "sling" plus the mangled servlet context path.

>> E.g. sling.home for the web app at /sling/i1 is "sling/_sling_i1".

Correct. But if you set sling.home as an init-param, the default does
not apply and the init-param value is used as-is. (which is another
problem, if you deploy the exact same web app with the same sling.home
init-param in the same container, you lost again).

> 
> In that case, setting the sling.home at the system property level
> would not do any harm.

It does not because it is ignored by the Sling web app.

> Anyway, if there are gotchas, this can be considered an acceptable
> solution with known limitations that would be useful for people with
> my kind of requirements, cannot it?

The problem is that this is one of those kinds of things where it is
very hard to find out whether using a system property is ok (in your
case presumably) and when not (in cases where there are multiple Sling
instances in the same servlet container.


But then, as proposed by Bertrand: we could add a sling.home.prefix
property, which would be used taken from the init-param or system
property and replace the current "sling" prefix.

Thus given the system poroperty sling.home.prefix is set to
"/var/sling". In this case the default sling.home for the /sling/i1 web
app would be "/var/sling/_sling_i1".

Would such a prefix suit your needs ?

Regards
Felix


> 
> Cheers,
> Claude
> 
> 
> On Tue, Jun 9, 2009 at 8:53 AM, Felix Meschberger<fm...@gmail.com> wrote:
>> Hi,
>>
>> Bertrand Delacretaz schrieb:
>>> Hi,
>>>
>>> On Tue, Jun 9, 2009 at 8:03 AM, Felix Meschberger<fm...@gmail.com> wrote:
>>>> Claude Vedovini schrieb:
>>>>> ...I guess that now that each deployed sling servlet has it's own
>>>>> subfolder under sling.home to store configuration to, then may be
>>>>> overriding the sling.home from the system properties could be a good
>>>>> idea.
>>>> Since system properties apply to the whole VM, multiple sling web
>>>> applications deployed to the same servlet container would then use the
>>>> same sling.home system property, which will not work....
>>> But if each deployed Sling servlet adds its own suffix (its context
>>> path) to the base sling.home path, that would work, not?
>>>
>>> The best might be to allow overriding sling.home from system
>>> properties (to allow people to control where that goes), yet have each
>>> sling servlet add its own context path to that value to define its own
>>> storage path.
>> I was also thinking about such a prefix. But I would then name it
>> sling.home.prefix or such to not confuse the use of sling.home as the
>> actual location or just the prefix.
>>
>> Just using this special prefix property as from the system properties
>> looks ok for me.
>>
>> Regards
>> Felix
>>
>>
> 

Re: Sling configuration

Posted by Claude Vedovini <cl...@gmail.com>.
Hi Felix, Bertrand,

There is something I don't get :)

Felix, in the example you gave previously, each deployed servlet adds
its own context path to the sling.home folder
> E.g. sling.home for the web app at /sling/i1 is "sling/_sling_i1".

In that case, setting the sling.home at the system property level
would not do any harm.

Anyway, if there are gotchas, this can be considered an acceptable
solution with known limitations that would be useful for people with
my kind of requirements, cannot it?

Cheers,
Claude


On Tue, Jun 9, 2009 at 8:53 AM, Felix Meschberger<fm...@gmail.com> wrote:
> Hi,
>
> Bertrand Delacretaz schrieb:
>> Hi,
>>
>> On Tue, Jun 9, 2009 at 8:03 AM, Felix Meschberger<fm...@gmail.com> wrote:
>>> Claude Vedovini schrieb:
>>>> ...I guess that now that each deployed sling servlet has it's own
>>>> subfolder under sling.home to store configuration to, then may be
>>>> overriding the sling.home from the system properties could be a good
>>>> idea.
>>> Since system properties apply to the whole VM, multiple sling web
>>> applications deployed to the same servlet container would then use the
>>> same sling.home system property, which will not work....
>>
>> But if each deployed Sling servlet adds its own suffix (its context
>> path) to the base sling.home path, that would work, not?
>>
>> The best might be to allow overriding sling.home from system
>> properties (to allow people to control where that goes), yet have each
>> sling servlet add its own context path to that value to define its own
>> storage path.
>
> I was also thinking about such a prefix. But I would then name it
> sling.home.prefix or such to not confuse the use of sling.home as the
> actual location or just the prefix.
>
> Just using this special prefix property as from the system properties
> looks ok for me.
>
> Regards
> Felix
>
>

Re: Sling configuration

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Bertrand Delacretaz schrieb:
> Hi,
> 
> On Tue, Jun 9, 2009 at 8:03 AM, Felix Meschberger<fm...@gmail.com> wrote:
>> Claude Vedovini schrieb:
>>> ...I guess that now that each deployed sling servlet has it's own
>>> subfolder under sling.home to store configuration to, then may be
>>> overriding the sling.home from the system properties could be a good
>>> idea.
>> Since system properties apply to the whole VM, multiple sling web
>> applications deployed to the same servlet container would then use the
>> same sling.home system property, which will not work....
> 
> But if each deployed Sling servlet adds its own suffix (its context
> path) to the base sling.home path, that would work, not?
> 
> The best might be to allow overriding sling.home from system
> properties (to allow people to control where that goes), yet have each
> sling servlet add its own context path to that value to define its own
> storage path.

I was also thinking about such a prefix. But I would then name it
sling.home.prefix or such to not confuse the use of sling.home as the
actual location or just the prefix.

Just using this special prefix property as from the system properties
looks ok for me.

Regards
Felix


Re: Sling configuration

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Tue, Jun 9, 2009 at 8:03 AM, Felix Meschberger<fm...@gmail.com> wrote:
> Claude Vedovini schrieb:
>> ...I guess that now that each deployed sling servlet has it's own
>> subfolder under sling.home to store configuration to, then may be
>> overriding the sling.home from the system properties could be a good
>> idea.
>
> Since system properties apply to the whole VM, multiple sling web
> applications deployed to the same servlet container would then use the
> same sling.home system property, which will not work....

But if each deployed Sling servlet adds its own suffix (its context
path) to the base sling.home path, that would work, not?

The best might be to allow overriding sling.home from system
properties (to allow people to control where that goes), yet have each
sling servlet add its own context path to that value to define its own
storage path.

-Bertrand

Re: Sling configuration

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Claude,

Claude Vedovini schrieb:
> my problem currently is that not only UAT and production should use
> the same binaries with different sling.home (under linux) but
> developers are using windows, thus we cannot have one war for all and
> this obviously complicates the build and is error prone for admins and
> developers alike.

I understand. So you *don't* set the sling.home init-param and use the
built-in default.

> 
> a fact as well is that upgrading Sling could be as simple as dropping
> a new war if I had not to unpack it.

Exactly, don't touch the war ;-)

> 
> I guess that now that each deployed sling servlet has it's own
> subfolder under sling.home to store configuration to, then may be
> overriding the sling.home from the system properties could be a good
> idea.

Since system properties apply to the whole VM, multiple sling web
applications deployed to the same servlet container would then use the
same sling.home system property, which will not work.

For this reason, I removed support for setting sling.home as a system
property for the Sling web application (it is only supported for the
sling standalone application).

In general system properties are fine for standalone applications but
for web applications it is a bit more complicated and I am not sure,
whether using system properties to configure web applications is a good
thing.

Regards
Felix

> 
> my 2cts
> Claude
> 
> On Sun, Jun 7, 2009 at 12:09 PM, Felix Meschberger<fm...@gmail.com> wrote:
>> Hi,
>>
>> Claude Vedovini schrieb:
>>> Hi all,
>>>
>>> I use the sling web app on jBoss and I have issue with the location of
>>> the sling home folder.
>>>
>>> >From what I read in [1] it seems one can setup the sling.home property
>>> either using the sling.property or the web.xml file, both located
>>> inside the sling war file, am I right?
>> For the Sling Web app, the sling home folder is set through the
>> sling.home init-property of the Sling Servlet or the Sling Servlet Context.
>>
>> If neither is set, the sling home folder is derived from the servlet
>> context path prepended with "sling" and the path converted to a single
>> name replacing slashes by underscores.
>>
>> E.g. sling.home for the web app at /sling/i1 is "sling/_sling_i1".
>>
>> This ensures sensible default values and prevents collisions if the
>> sling web app is installed multiple times in the same container.
>>
>>> If so, how may I deliver an application that can be deployed on
>>> different environments (test, UAT, prod) without repackaging the whole
>>> stuff each time?
>> If you don't really care, where your sling.home is, you might be happy
>> using the default value.
>>
>> Otherwise, there is not currently another option that to repackage.
>>
>> If you have a good idea on how to prevent this, we are certainly
>> open-ears ;-)
>>
>> Hope this helps.
>>
>> Regards
>> Felix
>>
> 

Re: Sling configuration

Posted by Claude Vedovini <cl...@gmail.com>.
Thanks Felix,

my problem currently is that not only UAT and production should use
the same binaries with different sling.home (under linux) but
developers are using windows, thus we cannot have one war for all and
this obviously complicates the build and is error prone for admins and
developers alike.

a fact as well is that upgrading Sling could be as simple as dropping
a new war if I had not to unpack it.

I guess that now that each deployed sling servlet has it's own
subfolder under sling.home to store configuration to, then may be
overriding the sling.home from the system properties could be a good
idea.

my 2cts
Claude

On Sun, Jun 7, 2009 at 12:09 PM, Felix Meschberger<fm...@gmail.com> wrote:
> Hi,
>
> Claude Vedovini schrieb:
>> Hi all,
>>
>> I use the sling web app on jBoss and I have issue with the location of
>> the sling home folder.
>>
>>>>From what I read in [1] it seems one can setup the sling.home property
>> either using the sling.property or the web.xml file, both located
>> inside the sling war file, am I right?
>
> For the Sling Web app, the sling home folder is set through the
> sling.home init-property of the Sling Servlet or the Sling Servlet Context.
>
> If neither is set, the sling home folder is derived from the servlet
> context path prepended with "sling" and the path converted to a single
> name replacing slashes by underscores.
>
> E.g. sling.home for the web app at /sling/i1 is "sling/_sling_i1".
>
> This ensures sensible default values and prevents collisions if the
> sling web app is installed multiple times in the same container.
>
>>
>> If so, how may I deliver an application that can be deployed on
>> different environments (test, UAT, prod) without repackaging the whole
>> stuff each time?
>
> If you don't really care, where your sling.home is, you might be happy
> using the default value.
>
> Otherwise, there is not currently another option that to repackage.
>
> If you have a good idea on how to prevent this, we are certainly
> open-ears ;-)
>
> Hope this helps.
>
> Regards
> Felix
>

Re: Sling configuration

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Claude Vedovini schrieb:
> Hi all,
> 
> I use the sling web app on jBoss and I have issue with the location of
> the sling home folder.
> 
>>>From what I read in [1] it seems one can setup the sling.home property
> either using the sling.property or the web.xml file, both located
> inside the sling war file, am I right?

For the Sling Web app, the sling home folder is set through the
sling.home init-property of the Sling Servlet or the Sling Servlet Context.

If neither is set, the sling home folder is derived from the servlet
context path prepended with "sling" and the path converted to a single
name replacing slashes by underscores.

E.g. sling.home for the web app at /sling/i1 is "sling/_sling_i1".

This ensures sensible default values and prevents collisions if the
sling web app is installed multiple times in the same container.

> 
> If so, how may I deliver an application that can be deployed on
> different environments (test, UAT, prod) without repackaging the whole
> stuff each time?

If you don't really care, where your sling.home is, you might be happy
using the default value.

Otherwise, there is not currently another option that to repackage.

If you have a good idea on how to prevent this, we are certainly
open-ears ;-)

Hope this helps.

Regards
Felix