Re: How to change run mode in Sling8

2017-01-13 Thread Bertrand Delacretaz
Hi Lance,

On Fri, Jan 13, 2017 at 1:54 AM, lancedolan  wrote:
> ...It's just some text files that neatly describe
> which OSGI bundles and configurations (including run modes) you'd like
> present in a new .war file which is then built using *actual* sling
> artifacts from completely different projects

Indeed!

There are some docs about this at
https://sling.apache.org/documentation/development/slingstart.html
(and patches welcome on that as usual)

-Bertrand


RE: How to change run mode in Sling8

2017-01-12 Thread lancedolan
Update: Ok, I get it now. Thank you - this is really slick. 


For posterity:

The "source code" for the "Sling Source Release" artifact at [1] is really
not the project source code. It's just some text files that neatly describe
which OSGI bundles and configurations (including run modes) you'd like
present in a new .war file which is then built using *actual* sling
artifacts from completely different projects.  This is called Sling
Provisioning, but shouldn't be confused with actual provisioning tools like
vagrant or something. I had expected to see actual source code when I
clicked that link and that felt wrong. Now I understand. 

All you have to do is download the "source code," set your run mode in
boot.txt, modify the list of artifacts if you wish (in
groupid/artifactid/version format) and run maven clean install. And if you
come from an older Sling background like I do, where you can change run
modes willy-nilly with JVM arguments, I guess you just have to suck it up
and provision a new Sling instance. If you use a remote datastore (such as
oak_mongo) then you can do so without losing your JCR data as well. 

[1] http://sling.apache.org/downloads.cgi



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/How-to-change-run-mode-in-Sling8-tp4069494p4069554.html
Sent from the Sling - Users mailing list archive at Nabble.com.


RE: How to change run mode in Sling8

2017-01-12 Thread lancedolan
This is fantastic information!

I'd love a nice clear how-to documentation for getting this done, but hey
it's open source stuff, hah. I'll go fumble through the
slingstart-maven-plugin and probably have a question or two along the way.

Thanks guys.



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/How-to-change-run-mode-in-Sling8-tp4069494p4069552.html
Sent from the Sling - Users mailing list archive at Nabble.com.


RE: How to change run mode in Sling8

2017-01-12 Thread Stefan Seifert
you should use the sling provisioning file format together with the slingstart 
maven plugin [1]. these are very powerful tools and allows you to quickly build 
your own set of sling bundles together with your own application bundles and 
all required OSGi configuration and sling run modes by describing it in a text 
file and building either a standalone jar or WAR file out of it. the launchpad 
itself is build exactly this way. unfortunately there is no overall 
documentation how to do this the best way besides the documentation of the 
individual parts like [1]. and if you start building your own Launchpad with 
only the bundles you need you of course need to know which bundles you need - 
which may be a difficult task for someone new to sling regarding the great 
number of OSGi bundles.

the sling Launchpad itself is a good starting point for this. if you want to 
use all bundles includes you can directly reference the provisioning feature 
file and add your bundles [2]. but in most cases you will use only a subset, 
and then you can start copying the definition file of the Launchpad [3] and 
remove everything you do not need. a good source for inspiration are also 
integration tests projects which often make use of the provisioning file format 
as well to setup a sling instance for testing, either based on the sling 
Launchpad as in [4], or by using a minimal set of bundles like [5].

stefan


[1] https://sling.apache.org/documentation/development/slingstart.html
[2] 
http://repo1.maven.org/maven2/org/apache/sling/org.apache.sling.launchpad/8/org.apache.sling.launchpad-8-slingfeature.txt
[3] 
https://github.com/apache/sling/tree/trunk/launchpad/builder/src/main/provisioning
[4] 
https://github.com/apache/sling/tree/trunk/bundles/extensions/caconfig/integration-tests
[5] 
https://github.com/wcm-io-caravan/caravan-tooling/tree/develop/integration-test/minimal-launchpad


>-Original Message-
>From: lancedolan [mailto:lance.do...@gmail.com]
>Sent: Thursday, January 12, 2017 4:18 AM
>To: users@sling.apache.org
>Subject: Re: How to change run mode in Sling8
>
>I guess downloading and copying the source for the software I want to
>use
>and just using that as the basis for my own custom version of that
>software
>just feels like a bad development practice. Like, how do I upgrade to
>future
>versions of Sling? By respecting the Sling war as a deployable artifact,
>I
>could just swap in future version in our provisioning scripts. I feel
>like
>there are other examples of how that's awkward as well, but it's late
>and
>I'm getting foggy hah.
>
>If the war file provided as a release isn't intended to be more than an
>example, copying and modifying the source is the way Sling is intended
>to be
>used by the developers, then fair enough.
>
>This sounds like valuable information for beginning developers that find
>https://sling.apache.org. It's easy to get lost.
>
>
>
>
>
>--
>View this message in context: http://apache-
>sling.73963.n3.nabble.com/How-to-change-run-mode-in-Sling8-
>tp4069494p4069533.html
>Sent from the Sling - Users mailing list archive at Nabble.com.




Re: How to change run mode in Sling8

2017-01-11 Thread lancedolan
Ok that makes sense. It sounds like developing a new codebase *based on* the
launchpad might be my next step. I guess the launchpad is really an example,
and not intended to be deployed to production as provided from the war
download link here: https://sling.apache.org/downloads.cgi.

I guess downloading and copying the source for the software I want to use
and just using that as the basis for my own custom version of that software
just feels like a bad development practice. Like, how do I upgrade to future
versions of Sling? By respecting the Sling war as a deployable artifact, I
could just swap in future version in our provisioning scripts. I feel like
there are other examples of how that's awkward as well, but it's late and
I'm getting foggy hah.

If the war file provided as a release isn't intended to be more than an
example, copying and modifying the source is the way Sling is intended to be
used by the developers, then fair enough.

This sounds like valuable information for beginning developers that find
https://sling.apache.org. It's easy to get lost.





--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/How-to-change-run-mode-in-Sling8-tp4069494p4069533.html
Sent from the Sling - Users mailing list archive at Nabble.com.


Re: How to change run mode in Sling8

2017-01-11 Thread Justin Edelson
Yes, I mean your application code. In my experience, the actual Sling
launchpad is not very useful by itself except as a learning tool. In any
real-world case, you will end up creating your own launchpad by taking the
standard Sling launchpad and adding additional bundles to it.

And while yes, you can certainly deploy code to a running Sling instance,
the trend seems to be away from this (except for development) and towards
immutable instances.

On Thu, Jan 12, 2017 at 10:52 AM lancedolan  wrote:

> Hmm, my genuine apologies, I'm not sure what custom application bits are.
> If
> you're saying that I can deploy code that I write to Sling, that's
> absolutely true, but my understanding is that I need to change the  runmode
> BEFORE the Sling instance starts up for the very first time, and I can only
> deploy my code to Sling OSGI AFTER the sling instance starts up for the
> very
> first time.
>
> I don't understand how to tell Sling to use oak_mongo instead of oako_tar.
> Might only solution right now is to either unzip the war and change the
> properties file before deploying for the first time, or to branch off the
> Sling source code and rebuild with that property changed. Is this what the
> Sling developers expect of me? It feels hacky. Isn't there a more
> conventional way for me to control my runmodes?
>
>
>
> --
> View this message in context:
> http://apache-sling.73963.n3.nabble.com/How-to-change-run-mode-in-Sling8-tp4069494p4069528.html
> Sent from the Sling - Users mailing list archive at Nabble.com.
>


Re: How to change run mode in Sling8

2017-01-11 Thread Justin Edelson
I would say that's how the creators of JavaEE intended for deployment
options to be specified :)

On Thu, Jan 12, 2017 at 10:53 AM lancedolan  wrote:

> I can look into overriding init params through some servlet container
> features. Is that the way that Sling devs expect me to turn on Mongo
> functionality?
>
>
>
> --
> View this message in context:
> http://apache-sling.73963.n3.nabble.com/How-to-change-run-mode-in-Sling8-tp4069494p4069529.html
> Sent from the Sling - Users mailing list archive at Nabble.com.
>


Re: How to change run mode in Sling8

2017-01-11 Thread lancedolan
I can look into overriding init params through some servlet container
features. Is that the way that Sling devs expect me to turn on Mongo
functionality?



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/How-to-change-run-mode-in-Sling8-tp4069494p4069529.html
Sent from the Sling - Users mailing list archive at Nabble.com.


Re: How to change run mode in Sling8

2017-01-11 Thread lancedolan
Hmm, my genuine apologies, I'm not sure what custom application bits are. If
you're saying that I can deploy code that I write to Sling, that's
absolutely true, but my understanding is that I need to change the  runmode
BEFORE the Sling instance starts up for the very first time, and I can only
deploy my code to Sling OSGI AFTER the sling instance starts up for the very
first time.

I don't understand how to tell Sling to use oak_mongo instead of oako_tar.
Might only solution right now is to either unzip the war and change the
properties file before deploying for the first time, or to branch off the
Sling source code and rebuild with that property changed. Is this what the
Sling developers expect of me? It feels hacky. Isn't there a more
conventional way for me to control my runmodes?



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/How-to-change-run-mode-in-Sling8-tp4069494p4069528.html
Sent from the Sling - Users mailing list archive at Nabble.com.


Re: How to change run mode in Sling8

2017-01-11 Thread Justin Edelson
But don't you need your own artifact anyway to include your custom
application bits?

IIRC (and I can't find the code right now), we explicitly *don't* allow for
system properties to be used for sling properties in a webapp case since
multiple webapps can be deployed into the same container.

In any case, servlet containers generally support some mechanism to
override the init parameters in the web.xml file via some external file.
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html explains how to
do this in Tomcat.

Regards,
Justin

On Thu, Jan 12, 2017 at 4:49 AM lancedolan  wrote:

> What is the recommended process for setting that runmode on startup? I'm
> unzipping the war file, changing a properties file, and rezipping it...
> This
> means we'd need to maintain this custom deployment artifact for all of our
> deployments/provisioning, rather than just using Sling's. There must be a
> better way? Perhaps a JVM command line argument I could provide during
> startup that would override what's set in sling_install.properties ?
>
>
>
> --
> View this message in context:
> http://apache-sling.73963.n3.nabble.com/How-to-change-run-mode-in-Sling8-tp4069494p4069523.html
> Sent from the Sling - Users mailing list archive at Nabble.com.
>


Re: How to change run mode in Sling8

2017-01-11 Thread Julian Sedding
Why are you running the war file on Tomcat? It's not wrong of course.
However, I believe that most users use the standalone jar and
therefore help may be more readily available for that setup.

Regards
Julian


On Wed, Jan 11, 2017 at 4:19 AM, lancedolan  wrote:
> I cannot change run mode using the process I have in the past, with Sling8.
>
> The only thing that has worked for me was to crack open the
> org.apache.sling.launchpad-8-webapp.war file, crack open the oak jar file
> within it, edit sling_install.properties
> (sling.run.mode.install.options=oak|oak_mongo), and then zip it all back up
> again. This feels _wrong_ haha.
>
> Things I tried, which failed:
>
> -The Apache Sling Settings Service in OSGI console. It even says "The
> settings service manages some basic settings of Sling like run modes."
> However, there is no run mode config there.
>
> -JVM arguments. I've tried -Dsling.run.mode.options=oak,oak_mongo and
> -Dsling.run.modes=oak,oak_mongo. No luck.
>
> -Searched for other configurations in the configMgr console.
>
> How do I just tell a Sling instance to stop running oak_tar and start
> running oak_mongo?
>
>
>
> --
> View this message in context: 
> http://apache-sling.73963.n3.nabble.com/How-to-change-run-mode-in-Sling8-tp4069494.html
> Sent from the Sling - Users mailing list archive at Nabble.com.


Re: How to change run mode in Sling8

2017-01-10 Thread Robert Munteanu
Hi,

On Tue, 2017-01-10 at 20:19 -0700, lancedolan wrote:
> I cannot change run mode using the process I have in the past, with
> Sling8.
> 
> The only thing that has worked for me was to crack open the
> org.apache.sling.launchpad-8-webapp.war file, crack open the oak jar
> file
> within it, edit sling_install.properties
> (sling.run.mode.install.options=oak|oak_mongo), and then zip it all
> back up
> again. This feels _wrong_ haha.
> 
> Things I tried, which failed:
> 
> -The Apache Sling Settings Service in OSGI console. It even says "The
> settings service manages some basic settings of Sling like run
> modes."
> However, there is no run mode config there.
> 
> -JVM arguments. I've tried -Dsling.run.mode.options=oak,oak_mongo and
> -Dsling.run.modes=oak,oak_mongo. No luck.
> 
> -Searched for other configurations in the configMgr console.
> 
> How do I just tell a Sling instance to stop running oak_tar and start
> running oak_mongo?

You can't as these modes are defined in the
sling.run.mode.install.options [1] and they can only be changed at
startup, see [2] .

So when starting up a Sling 8 instance only one of oak_tar or oak_mongo
can be defined and it can't be changed after startup.

Robert

[1]: http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.launch
pad-8/src/main/provisioning/boot.txt
[2]: https://sling.apache.org/documentation/bundles/sling-settings-org-
apache-sling-settings.html#defining-valid-run-modes