You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Chetan Mehrotra <ch...@gmail.com> on 2012/08/20 07:31:13 UTC

Launching Sling standalone in exploded format

For some work I have to frequently launch Sling standalone jar with clean
start. The development flow is like

1. Start sling
2. Debug startup logic and initial installation
3. Shutdown
4. Update certain bundles in resources/install folder based on #2. For this
install them in Maven first
5. Clean existing sling home directory
6. Repackage Sling standalone so that updated bundle from #4 gets picked up
7. Use the newly created standalone jar

In this flow step #6 takes some time (~30-40 sec). To reduce the turnaround
time I would like to run the standalone jar in exploded format. So that I
can bypass #6 and just update the jar in install folder directly. I tried
to run Sling by exploding the standalone jar and explicitly passing Main
class in startup. However this does not work as it uses
ClassloaderResourceProvider and in that getChilderen() does not work.

Is there any other way I can simplify my development workflow such that I
can bypass repackaging step #6?

Otherwise I was thinking to modify the MainDelgate to uses some sort
FilesystemResourceProvider depending on startup mode.

Any thoughts/suggestions!!

Chetan Mehrotra

Re: Launching Sling standalone in exploded format

Posted by Chetan Mehrotra <ch...@gmail.com>.
This looks promising!!. So to confirm

- I need to package file installer bundle explicitly at boot level. Or I
just need to pass on the directory path via system property as Bertrand
suggested

- When the installer merges the two list what constitutes as a latest
version. Does it compares the timestamp (as both are snapshots)

Chetan Mehrotra


On Mon, Aug 20, 2012 at 2:18 PM, Carsten Ziegeler <cz...@apache.org>wrote:

> Hi,
>
> if you're using the Sling launchpad, then all the bundles are
> installed by launchpad and not the OSGi installer.
> We(=Adobe)'re using this configuration for the launchpad plugin instead:
>                     <bundlesDirectory>install</bundlesDirectory>
>                     <bootDirectory>bundles</bootDirectory>
> Now only bundles marked as boot level bundles are installed by
> launchpad, everything else is installed by the OSGi installer. Of
> course this requires the OSGi installer and some other bundles to be
> in the boot level. If you now put the file installer bundle there as
> well and point it to a directory like Bertrand suggested, the OSGi
> installer will get two bundles lists, one from the launchpad and one
> from the file installer, merges it and installs the latest versions.
>
> Carsten
>
> 2012/8/20 Chetan Mehrotra <ch...@gmail.com>:
> > Hi Bertrand,
> >
> > In current setup the bundles I am working are related to Oak and I need
> to
> > start the system from a clean state to validate some changes. So the
> > updated bundles has to be picked up at the first launch itself.
> >
> > The method you suggest works fine for already running system or restarts
> > but for fresh install I need a way to update the existing bundle present
> in
> > the standalone jar/resources/install folder.
> >
> > Chetan Mehrotra
> >
> >
> > On Mon, Aug 20, 2012 at 1:40 PM, Bertrand Delacretaz <
> bdelacretaz@apache.org
> >> wrote:
> >
> >> Hi Chetan,
> >>
> >> On Mon, Aug 20, 2012 at 7:31 AM, Chetan Mehrotra
> >> <ch...@gmail.com> wrote:
> >> ...
> >> > 4. Update certain bundles in resources/install folder based on #2. For
> >> this
> >> > install them in Maven first
> >> > 5. Clean existing sling home directory
> >> > 6. Repackage Sling standalone so that updated bundle from #4 gets
> picked
> >> up...
> >>
> >> Can't you just copy your new/modified bundles to an install folder on
> >> the filesystem, that's picked up by the file installer?
> >>
> >> You can specify the name of that folder with
> >> -Dsling.fileinstall.dir=/path-to-that-folder on the JVM command line.
> >>
> >> You could also install them directly via the OSGi console or the
> >> maven-sling-plugin.
> >>
> >> -Bertrand
> >>
>
>
>
> --
> Carsten Ziegeler
> cziegeler@apache.org
>

Re: Launching Sling standalone in exploded format

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi,

if you're using the Sling launchpad, then all the bundles are
installed by launchpad and not the OSGi installer.
We(=Adobe)'re using this configuration for the launchpad plugin instead:
                    <bundlesDirectory>install</bundlesDirectory>
                    <bootDirectory>bundles</bootDirectory>
Now only bundles marked as boot level bundles are installed by
launchpad, everything else is installed by the OSGi installer. Of
course this requires the OSGi installer and some other bundles to be
in the boot level. If you now put the file installer bundle there as
well and point it to a directory like Bertrand suggested, the OSGi
installer will get two bundles lists, one from the launchpad and one
from the file installer, merges it and installs the latest versions.

Carsten

2012/8/20 Chetan Mehrotra <ch...@gmail.com>:
> Hi Bertrand,
>
> In current setup the bundles I am working are related to Oak and I need to
> start the system from a clean state to validate some changes. So the
> updated bundles has to be picked up at the first launch itself.
>
> The method you suggest works fine for already running system or restarts
> but for fresh install I need a way to update the existing bundle present in
> the standalone jar/resources/install folder.
>
> Chetan Mehrotra
>
>
> On Mon, Aug 20, 2012 at 1:40 PM, Bertrand Delacretaz <bdelacretaz@apache.org
>> wrote:
>
>> Hi Chetan,
>>
>> On Mon, Aug 20, 2012 at 7:31 AM, Chetan Mehrotra
>> <ch...@gmail.com> wrote:
>> ...
>> > 4. Update certain bundles in resources/install folder based on #2. For
>> this
>> > install them in Maven first
>> > 5. Clean existing sling home directory
>> > 6. Repackage Sling standalone so that updated bundle from #4 gets picked
>> up...
>>
>> Can't you just copy your new/modified bundles to an install folder on
>> the filesystem, that's picked up by the file installer?
>>
>> You can specify the name of that folder with
>> -Dsling.fileinstall.dir=/path-to-that-folder on the JVM command line.
>>
>> You could also install them directly via the OSGi console or the
>> maven-sling-plugin.
>>
>> -Bertrand
>>



-- 
Carsten Ziegeler
cziegeler@apache.org

Re: Launching Sling standalone in exploded format

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Mon, Aug 20, 2012 at 10:17 AM, Chetan Mehrotra
<ch...@gmail.com> wrote:

> ...The method you suggest works fine for already running system or restarts
> but for fresh install I need a way to update the existing bundle present in
> the standalone jar/resources/install folder....

You could probably create a custom runnable jar with some bundles
omitted, and supply them via the file installer.

-Bertrand

Re: Launching Sling standalone in exploded format

Posted by Chetan Mehrotra <ch...@gmail.com>.
Hi Bertrand,

In current setup the bundles I am working are related to Oak and I need to
start the system from a clean state to validate some changes. So the
updated bundles has to be picked up at the first launch itself.

The method you suggest works fine for already running system or restarts
but for fresh install I need a way to update the existing bundle present in
the standalone jar/resources/install folder.

Chetan Mehrotra


On Mon, Aug 20, 2012 at 1:40 PM, Bertrand Delacretaz <bdelacretaz@apache.org
> wrote:

> Hi Chetan,
>
> On Mon, Aug 20, 2012 at 7:31 AM, Chetan Mehrotra
> <ch...@gmail.com> wrote:
> ...
> > 4. Update certain bundles in resources/install folder based on #2. For
> this
> > install them in Maven first
> > 5. Clean existing sling home directory
> > 6. Repackage Sling standalone so that updated bundle from #4 gets picked
> up...
>
> Can't you just copy your new/modified bundles to an install folder on
> the filesystem, that's picked up by the file installer?
>
> You can specify the name of that folder with
> -Dsling.fileinstall.dir=/path-to-that-folder on the JVM command line.
>
> You could also install them directly via the OSGi console or the
> maven-sling-plugin.
>
> -Bertrand
>

Re: Launching Sling standalone in exploded format

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

On Mon, Aug 20, 2012 at 7:31 AM, Chetan Mehrotra
<ch...@gmail.com> wrote:
...
> 4. Update certain bundles in resources/install folder based on #2. For this
> install them in Maven first
> 5. Clean existing sling home directory
> 6. Repackage Sling standalone so that updated bundle from #4 gets picked up...

Can't you just copy your new/modified bundles to an install folder on
the filesystem, that's picked up by the file installer?

You can specify the name of that folder with
-Dsling.fileinstall.dir=/path-to-that-folder on the JVM command line.

You could also install them directly via the OSGi console or the
maven-sling-plugin.

-Bertrand

RE: Launching Sling standalone in exploded format

Posted by "Phillpotts, James" <Ja...@experian.com>.
Hi Chetan,

If it's useful, what we do is (using maven):

1) Define two modules for producing the launchpad artifacts (war and standalone jar), one that includes our bundles (this module is built by our CI server, or for release), and one that excludes them producing a war (so containing all the uplifted sling/etc bundle versions). Both modules use the same list.xml.

2) The latter module has maven config to run using jetty:run-war

3) Our content/etc bundle modules are defined with maven profile for doing a maven-sling-plugin:install

4) In eclipse, run configurations defined for running the jetty war, cleaning and running the jetty war, and sling-installing each bundle.

For general development, we have the jetty war running in the background, then just run mvn -P doSlingInstall install on each bundle module as it changes (you don't have to clean sling for an updated module if no dependencies have changed). When list.xml is changed and you need to clean the sling home (the scenario you describe), you just run the mvn clean jetty:run-war run configuration, followed by the install for each development bundle.

HTH

Cheers,
James

-----Original Message-----
From: Chetan Mehrotra [mailto:chetan.mehrotra@gmail.com]
Sent: 20 August 2012 06:31
To: users@sling.apache.org
Subject: Launching Sling standalone in exploded format

For some work I have to frequently launch Sling standalone jar with clean start. The development flow is like

1. Start sling
2. Debug startup logic and initial installation 3. Shutdown 4. Update certain bundles in resources/install folder based on #2. For this install them in Maven first 5. Clean existing sling home directory 6. Repackage Sling standalone so that updated bundle from #4 gets picked up 7. Use the newly created standalone jar

In this flow step #6 takes some time (~30-40 sec). To reduce the turnaround time I would like to run the standalone jar in exploded format. So that I can bypass #6 and just update the jar in install folder directly. I tried to run Sling by exploding the standalone jar and explicitly passing Main class in startup. However this does not work as it uses ClassloaderResourceProvider and in that getChilderen() does not work.

Is there any other way I can simplify my development workflow such that I can bypass repackaging step #6?

Otherwise I was thinking to modify the MainDelgate to uses some sort FilesystemResourceProvider depending on startup mode.

Any thoughts/suggestions!!

Chetan Mehrotra



Information in this e-mail and any attachments is confidential, and may not be copied or used by anyone other than the addressee, nor disclosed to any third party without our permission. There is no intention to create any legally binding contract or other binding commitment through the use of this electronic communication unless it is issued in accordance with the Experian Limited standard terms and conditions of purchase or other express written agreement between Experian Limited and the recipient. Although Experian has taken reasonable steps to ensure that this communication and any attachments are free from computer virus, you are advised to take your own steps to ensure that they are actually virus free. 

Companies Act information: Registered name: Experian Limited. Registered office: Landmark House, Experian Way, NG2 Business Park, Nottingham, NG80 1ZZ, United Kingdom. Place of registration: England and Wales. Registered number: 653331