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


How to change run mode in Sling8

2017-01-10 Thread lancedolan
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: Join new member to Sling Oak cluster?

2017-01-10 Thread lancedolan
- What kind of discovery mechanism do you use? 

I don't know - whichever is the default discovery mechanism when running
org.apache.sling.launchpad-8-webapp.war on Tomcat 8 and I've modified the
content of the war file so that it will start with run modes oak|oak_mongo,
so that by default it's looking for mongo on localhost.

- Are the Sling/Oak instances and MongoDB clocks in sync? 
I didn't realize this is important, but they must be as it's all in my local
machine. I'm not even using vagrant or virtual machines - just a buncha
stuff on local MacOS.

- Do you have anything suspicious in the error logs when the instances 
shut themselves down? 
See my reply above. Nothing very indicative, just the instance declaring
that the clusterview has changed and itself is no longer in it...

- What happens if after the instances are shut down and a new leader is 
elected you restart one of the old instances? 
Then they boot out the other other guy. They just take turns booting each
other out. To be specific, I had a sling instance on :8080 and another on
:8081, and they were connected to mongo localhost. Everything worked great
as I developed on them for a good 6 hours. Then I added and instance on
:8082 and when it connected to mongo localhost, tomcat 8080 and 8081 both
shut down, and the log file is just their mutual agreement that the new
clusterview doesn't include them. I immediately started 8080 and 8081 back
up again, and the same thing happened but in reverse, with 8082 shutting
itself down.



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/Join-new-member-to-Sling-Oak-cluster-tp4069454p4069493.html
Sent from the Sling - Users mailing list archive at Nabble.com.


Re: Join new member to Sling Oak cluster?

2017-01-10 Thread lancedolan
Not sure if I've experienced an intermittent but severe defect, or if I did
something wrong when attempting this yesterday.

I followed the exact same steps today, and the new instance *did*
successfully join. Either I'm wrong, and I actually did something
differently yesterday, or this is an intermittent defect and a big bummer.
I'll keep trying to reproduce. 

Here is the log output from one of the instances that was already in the
cluster when the new one joined:

**
09.01.2017 16:20:36.062 *INFO*
[DocumentDiscoveryLiteService-BackgroundWorker-[1]]
org.apache.jackrabbit.oak.plugins.document.DocumentDiscoveryLiteService
doCheckView: view has changed from: a ClusterView[valid=true, viewSeqNum=2,
clusterViewId=ae406105-3c77-4498-b8fc-1557b012d46d, activeIds=1,2,
recoveringIds=null, inactiveIds=null] to: a ClusterView[valid=true,
viewSeqNum=3, clusterViewId=ae406105-3c77-4498-b8fc-1557b012d46d,
activeIds=1, recoveringIds=null, inactiveIds=2] - sending event...
09.01.2017 16:20:36.063 *INFO*
[DocumentDiscoveryLiteService-BackgroundWorker-[1]]
org.apache.jackrabbit.oak.plugins.document.DocumentDiscoveryLiteService
checkView: view changed from: a
ClusterView[{"seq":2,"final":true,"id":"ae406105-3c77-4498-b8fc-1557b012d46d","me":1,"active":[1,2],"deactivating":[],"inactive":[]}],
to: a
ClusterView[{"seq":3,"final":false,"id":"ae406105-3c77-4498-b8fc-1557b012d46d","me":1,"active":[1],"deactivating":[2],"inactive":[]}],
hasInstancesWithBacklog: true
09.01.2017 16:20:37.168 *INFO* [Thread-31]
org.apache.sling.discovery.impl.DiscoveryServiceImpl enqueueForAll: sending
PROPERTIES_CHANGED to all listeners (oldView=TopologyViewImpl
[current=false, super.hashCode=1259039663, instances=[an
InstanceDescription[slindId=3d4f31d9-b3ba-4e32-aa10-36ef150a37f0,
isLeader=true, isOwn=true,
clusterViewId=20a0797b-e957-4b8e-845b-9b9e0b6a246d,
properties={org.apache.sling.instance.endpoints=,
org.apache.sling.event.jobs.consumer.topics=/,com/composum/sling/core/pckgmgr/PackageJobExecutor,com/composum/sling/core/script/GroovyJobExecutor,org/apache/sling/event/impl/jobs/tasks/HistoryCleanUpTask,sling/webconsole/test,
org.apache.sling.instance.name=Instance
3d4f31d9-b3ba-4e32-aa10-36ef150a37f0,
org.apache.sling.instance.description=Instance with id
3d4f31d9-b3ba-4e32-aa10-36ef150a37f0 and run modes [oak_mongo, oak]}], an
InstanceDescription[slindId=cc9e3513-8f6c-460d-b27e-dd3844aa629d,
isLeader=false, isOwn=false,
clusterViewId=20a0797b-e957-4b8e-845b-9b9e0b6a246d,
properties={org.apache.sling.instance.endpoints=,
org.apache.sling.event.jobs.consumer.topics=/,com/composum/sling/core/pckgmgr/PackageJobExecutor,com/composum/sling/core/script/GroovyJobExecutor,org/apache/sling/event/impl/jobs/tasks/HistoryCleanUpTask,sling/webconsole/test,
org.apache.sling.instance.name=Instance
cc9e3513-8f6c-460d-b27e-dd3844aa629d,
org.apache.sling.instance.description=Instance with id
cc9e3513-8f6c-460d-b27e-dd3844aa629d and run modes [oak_mongo, oak]}]]],
newView=TopologyViewImpl [current=true, super.hashCode=238080023,
instances=[an
InstanceDescription[slindId=3d4f31d9-b3ba-4e32-aa10-36ef150a37f0,
isLeader=true, isOwn=true,
clusterViewId=20a0797b-e957-4b8e-845b-9b9e0b6a246d,
properties={org.apache.sling.instance.endpoints=,
org.apache.sling.event.jobs.consumer.topics=/,com/composum/sling/core/pckgmgr/PackageJobExecutor,com/composum/sling/core/script/GroovyJobExecutor,org/apache/sling/event/impl/jobs/tasks/HistoryCleanUpTask,sling/webconsole/test,
org.apache.sling.instance.name=Instance
3d4f31d9-b3ba-4e32-aa10-36ef150a37f0,
org.apache.sling.instance.description=Instance with id
3d4f31d9-b3ba-4e32-aa10-36ef150a37f0 and run modes [oak_mongo, oak]}], an
InstanceDescription[slindId=cc9e3513-8f6c-460d-b27e-dd3844aa629d,
isLeader=false, isOwn=false,
clusterViewId=20a0797b-e957-4b8e-845b-9b9e0b6a246d,
properties={org.apache.sling.instance.endpoints=,
org.apache.sling.event.jobs.consumer.topics=/,org/apache/sling/event/impl/jobs/tasks/HistoryCleanUpTask,sling/webconsole/test,
org.apache.sling.instance.name=Instance
cc9e3513-8f6c-460d-b27e-dd3844aa629d,
org.apache.sling.instance.description=Instance with id
cc9e3513-8f6c-460d-b27e-dd3844aa629d and run modes [oak_mongo, oak]}]]]).
09.01.2017 16:20:37.171 *INFO*
[DocumentDiscoveryLiteService-BackgroundWorker-[1]]
org.apache.jackrabbit.oak.plugins.document.DocumentDiscoveryLiteService
checkView: view changed from: a
ClusterView[{"seq":3,"final":false,"id":"ae406105-3c77-4498-b8fc-1557b012d46d","me":1,"active":[1],"deactivating":[2],"inactive":[]}],
to: a
ClusterView[{"seq":3,"final":true,"id":"ae406105-3c77-4498-b8fc-1557b012d46d","me":1,"active":[1],"deactivating":[],"inactive":[2]}],
hasInstancesWithBacklog: false 
***
 From there onward, the log file is just the normal shut-down logs as OSGI
unregisters bundles and the servlet container shuts down.



--
View this message in context: 

JS Use API usability or limitations

2017-01-10 Thread lancedolan
I've got years of experience writing backing beans for Sling (aem)
components, but can't seem to get a simple JS backing working using the new
Javascript Use API.

All I want to do is print out a resource's children resources.

My JS backing bean:

use([], function () {
 
 var returnObj = {
content: ""
};

  var parent = resource.parent;
  var children = parent.getChildren();

  for (res in Iterator(children)) {
   returnObj.content += res.name;
  }
   
return returnObj;
});

The contents of returnObj.content will be the word "undefined" repeated X
times, where X is the number of children nodes of parent. This tells me it
successfully iterates the Iterable once for each item in it, but it's
failing to give me a reference to a child. If I try res.getName() instead, I
get:

org.mozilla.javascript.EcmaError: TypeError: Cannot find default value for
object

In fact, every single variation I've tried for iterating that collection has
lead to that exact Exception.

It seems to me Rhino is getting in the way. Am I right? What is the
community consensus on use of the JS Use API? Is it production-ready and
stable? Is my problem a user-error? What limitations exist here? I was
planning on doing the same things in JS that I've always done in Java, which
is usually a lot of read/write operations on the JCR.



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/JS-Use-API-usability-or-limitations-tp4069490.html
Sent from the Sling - Users mailing list archive at Nabble.com.


RE: Sling 8 Resource Versioning? Jira access?

2017-01-10 Thread lancedolan
Ahh, yes you're right. I was getting a 403 apparently because of an old bad
Chrome Plugin that was injecting Basic Auth headers into my request... my
fault.





--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/Sling-8-Resource-Versioning-Jira-access-tp4069484p4069486.html
Sent from the Sling - Users mailing list archive at Nabble.com.


RE: Sling 8 Resource Versioning? Jira access?

2017-01-10 Thread Stefan Seifert
you should be able to access the JIRA link!
it is a public JIRA instance, any anyone has read access to it without further 
authentication.

stefan

>-Original Message-
>From: lancedolan [mailto:lance.do...@gmail.com]
>Sent: Tuesday, January 10, 2017 8:42 PM
>To: users@sling.apache.org
>Subject: Sling 8 Resource Versioning? Jira access?
>
>The announcement for sling 8 announces a feature we're excited to use:
>Versioning through the Resource API:
>
>https://sling.apache.org/news/sling-launchpad-8-released.html#versioning-
>support-in-the-resource-api
>
>However, the only info it provides is a JIRA link I can't access:
>https://issues.apache.org/jira/browse/SLING-848
>
>My questions:
>1) How can I get access to Jira to see this?
>2) Can we get put this information somewhere outside of JIRA, such as
>sling.apache.org or https://cwiki.apache.org/confluence/display/SLING ? (My
>apologies if it actually is out there somewhere, I've searched with no
>luck)
>
>
>
>--
>View this message in context: http://apache-
>sling.73963.n3.nabble.com/Sling-8-Resource-Versioning-Jira-access-
>tp4069484.html
>Sent from the Sling - Users mailing list archive at Nabble.com.




Sling 8 Resource Versioning? Jira access?

2017-01-10 Thread lancedolan
The announcement for sling 8 announces a feature we're excited to use:
Versioning through the Resource API:

https://sling.apache.org/news/sling-launchpad-8-released.html#versioning-support-in-the-resource-api

However, the only info it provides is a JIRA link I can't access:
https://issues.apache.org/jira/browse/SLING-848

My questions:
1) How can I get access to Jira to see this?
2) Can we get put this information somewhere outside of JIRA, such as
sling.apache.org or https://cwiki.apache.org/confluence/display/SLING ? (My
apologies if it actually is out there somewhere, I've searched with no luck)



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/Sling-8-Resource-Versioning-Jira-access-tp4069484.html
Sent from the Sling - Users mailing list archive at Nabble.com.


Re: Join new member to Sling Oak cluster?

2017-01-10 Thread Robert Munteanu
Hi,

On Mon, 2017-01-09 at 17:52 -0700, lancedolan wrote:
> Hey guys, sorry for multiple recent question. I'm biting down hard on
> Sling
> right now and hitting tons of learning curve and growing pains.

Don't worry, we like these kinds of questions :-)

> 
> My problem: If I create a fresh instance of MongoDB, and connect
> multiple
> fresh instances of Sling to it (each running in a separate tomcat
> instance),
> they all plug-and-play happily. They just discover each other and my
> clusterview is very stable at /system/console/topology.
> 
> However, if I used the cluster for a while (deploy some OSGI bundles,
> create
> some JCR content) and *then* connect a new sling instance, what
> happens is
> that all of the current instances shut down (they literally send a
> shut down
> signal to tomcat's shut down port) and then the single new instance
> votes
> itself as the new leader, and only member, of a new 1-instance
> cluster.

That sounds unintended. I am not the best person to debug this but I
suppose the following information will be useful:

- What kind of discovery mechanism do you use?
- Are the Sling/Oak instances and MongoDB clocks in sync?
- Do you have anything suspicious in the error logs when the instances
shut themselves down?
- What happens if after the instances are shut down and a new leader is
elected you restart one of the old instances?

> Is this a known issue? Do I need to "prime" my new member with the
> current
> state of the cluster before connecting it to the cluster or something
> (perhaps by uploading all the bundles and content that has been
> uploaded to
> the cluster?)

It's not known to me at least and to my knowledge there should be no
extra steps needed.

Thanks,

Robert