Hi Wendell,
On 01/10/2015 10:31 PM, Wendell Piez wrote:
Hi Dirk,
I am still looking at this - I hope you'll be patient with another couple of questions. If you don't have the time to instruct me please let me know and accept my apologies. :-)
Sure, no problem. We are happy to help, but please always cc the mailing list, so others can benefit from this questions as well. I am quite sure you are not the only one wondering about stuff like this.
All the projects are local, and they typically rely on other applications in addition to BaseX (they tend to be XML/XSLT applications). So for convenience I want to run a single copy of BaseX with a single data directory, with different databases for the different projects.
It's fine if multiple servers run the different projects on multiple ports, but it's also fine if they all live together on one (8984 is fine). So there could be a single startup script for all the projects (as long as the code supporting each project can be distributed), or each project could have its own server.
I guess that means running something like the basexhttp shell script to run the server from a different directory, setting it up with its own webapp and thus all the advantages (and encapsulation) you cite?
How do I go about doing this? I have tried copying and modifying the basexhttp script, but I can't get the classpaths correct. (It seems to be designed to depend on its location in the file system relative to BaseX.) I am afraid I am missing a simple way to start up BaseX to run restXQ, except keep the latter code in a project directory. -- whether with a completely different webapp, or sharing the "space" among several projects - as long as their restXQ files can be found.
I would also advise against copying the basexhttp script. It is not really a clean solution, involves lots of manually copying if we change the script in the next version (and for the 8.0 snapshots this did happen). Also, copying the binary itself by principle sounds like not the best solution.
So -- I can give the project its own webapp directory, no problem. I can put a jetty.xml file in there. But how do I start BaseX (installed in /home/wendell/basex) to run from this webapp? (If my script calls ~/bin/basexhttp, BaseX starts up with its own webapp and .basex configuration etc.)
So if I understood your setup correctly, all BaseX settings in your different projects are the same except the RESTXQ path? So one option could be to set the RESTXQ path manually before starting basexhttp. Using the latest 8.0 snapshot, this is done using the global variable BASEX_JVM. So executing
export BASEX_JVM=-Dorg.basex.RESTXQPATH=/my/restxq/directory && basexhttp
should use the path provided on the command line. If you want to startup all your projects this way you could write a little script which does this for you.
If you call baexhttp from a subdirectory (e.g. /home/wendell/superawesomeproject), it shouldn't startup the standard BaseX webapp, but instead look for a web.xml in /home/wendell/superawesomeproject/src/main/webapp/WEB-INF/. I am not sure right now how to change this path or if this is even possible using basexhttp.
Another option - which I personally prefer, also because it avoids creating your own scripts and provides easy configuration options - is using Maven. This way, a simple
mvn jetty:run
inside your project directory should be enough. The pom.xml configures the Maven execution. For example, the jetty maven plugin configuration looks something like this:
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jettyVersion}</version> <configuration> <webAppConfig> <contextPath>/</contextPath> <descriptor>WEB-INF/${webXml}</descriptor> <tempDirectory>.tmp</tempDirectory> </webAppConfig> <webAppSourceDirectory>${basedir}/${webapp}/public</webAppSourceDirectory> <jettyXml>WEB-INF/jetty.xml</jettyXml> <stopKey>keyToStopJetty</stopKey> <stopPort>${stopPort}</stopPort> </configuration> </plugin>
Notice, that in this case the web.xml is actually in a variable. This way, you could startup different web applications using the command
mvn jetty:run -Dwebapp=project1-web.xml
and so on. So you can use different web.xml (where you can set the RESTXQ path, see http://docs.basex.org/wiki/Web_Application#Configuration for details) for your different projects. Of yourse, you could also use complete separate pom.xml using mvn -f myotherpom.xml jetty:run
I hope this helps.
Cheers, Dirk
Thanks again for the hints --
Cheers, Wendell
On Sat, Jan 10, 2015 at 3:31 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dirk, thanks!
Cheers, Wendell
On Thu, Jan 8, 2015 at 4:05 AM, Dirk Kirsten dk@basex.org wrote:
Hello Wendell,
your last guess is correct: BaseX can only handle a single RESTXQ directory. So solutions using a colon a separator will not work, simply because we do not support it. It does not depend on the OS (although I personally think you did a wise thing in trying out GNU/Linux ;).
The usual approach would be to have a separate .basex in your webapp directory. So if you start basex from this directory it will use this values instead your default ones. More likely you might want to store the BaseX specific values in your jetty.xml (if using Jetty), so they are used for the application container. This has several advantages:
- Your web application can not access some default functionality, which shouldn't really be available.
- You can use different BaseX version for different projects by including BaseX within the webapp itself
- You can also define different configurations for your different webapps (e.g. all your projects run on a different port, so you can run them simultanously)
Cheers, Dirk
On 01/07/2015 11:32 PM, Wendell Piez wrote:
Hi again,
Correction: of course, under the "composite" path, neither path works.
Perhaps BaseX can only have a single RestXQ directory at a time?
Thanks again for your patience with me. :-)
Cheers, Wendell
On Wed, Jan 7, 2015 at 5:29 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear BaseX people,
I am a hopeless newbie when it comes to Linux. Seriously, my ignorance is astonishing. I am now running Linux Mint. It's a huge amount of fun but I'm left guessing about many simply things.
I am running the current BaseX 7.9. I am using it to provide a pipeline architecture calling lots of XSLT2, producing HTML and SVG. It works well for this.
To my RESTXQPATH I wish to append to - but not override (if possible) - a path.
By editing my .basex configuration I have managed to reset it, but not simply to append to it.
That is,
RESTXQPATH = /home/wendell/basex/webapp:/home/wendell/XQuery-project/restxq
With this, the server skips the basex/webapp directory. If I remove the second segment and restart, it goes live again.
What is the simplest way for me to set up my BaseX so that I can maintain my project xqm files (including a project's RestXQ), in the project, but keep BaseX otherwise (including its data directories) separate? Over the longer term I can see several such directories where I'd like BaseX to look.
On another operating system I used to start up using different shell scripts; is that the best way here (and if so does my shell script have to call Java or can I use the scripts in the basex/bin and pass in a value somehow)?
In general, what recommendations can you offer for no-fuss configuration of RestXQ for separate projects?
Thanks! Wendell
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Dirk thanks! this is immensely helpful. Of course I should always cc: the list. :-)
Cheers, Wendell
On Mon, Jan 12, 2015 at 3:57 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
On 01/10/2015 10:31 PM, Wendell Piez wrote:
Hi Dirk,
I am still looking at this - I hope you'll be patient with another couple of questions. If you don't have the time to instruct me please let me know and accept my apologies. :-)
Sure, no problem. We are happy to help, but please always cc the mailing list, so others can benefit from this questions as well. I am quite sure you are not the only one wondering about stuff like this.
All the projects are local, and they typically rely on other applications in addition to BaseX (they tend to be XML/XSLT applications). So for convenience I want to run a single copy of BaseX with a single data directory, with different databases for the different projects.
It's fine if multiple servers run the different projects on multiple ports, but it's also fine if they all live together on one (8984 is fine). So there could be a single startup script for all the projects (as long as the code supporting each project can be distributed), or each project could have its own server.
I guess that means running something like the basexhttp shell script to run the server from a different directory, setting it up with its own webapp and thus all the advantages (and encapsulation) you cite?
How do I go about doing this? I have tried copying and modifying the basexhttp script, but I can't get the classpaths correct. (It seems to be designed to depend on its location in the file system relative to BaseX.) I am afraid I am missing a simple way to start up BaseX to run restXQ, except keep the latter code in a project directory. -- whether with a completely different webapp, or sharing the "space" among several projects - as long as their restXQ files can be found.
I would also advise against copying the basexhttp script. It is not really a clean solution, involves lots of manually copying if we change the script in the next version (and for the 8.0 snapshots this did happen). Also, copying the binary itself by principle sounds like not the best solution.
So -- I can give the project its own webapp directory, no problem. I can put a jetty.xml file in there. But how do I start BaseX (installed in /home/wendell/basex) to run from this webapp? (If my script calls ~/bin/basexhttp, BaseX starts up with its own webapp and .basex configuration etc.)
So if I understood your setup correctly, all BaseX settings in your different projects are the same except the RESTXQ path? So one option could be to set the RESTXQ path manually before starting basexhttp. Using the latest 8.0 snapshot, this is done using the global variable BASEX_JVM. So executing
export BASEX_JVM=-Dorg.basex.RESTXQPATH=/my/restxq/directory && basexhttp
should use the path provided on the command line. If you want to startup all your projects this way you could write a little script which does this for you.
If you call baexhttp from a subdirectory (e.g. /home/wendell/superawesomeproject), it shouldn't startup the standard BaseX webapp, but instead look for a web.xml in /home/wendell/superawesomeproject/src/main/webapp/WEB-INF/. I am not sure right now how to change this path or if this is even possible using basexhttp.
Another option - which I personally prefer, also because it avoids creating your own scripts and provides easy configuration options - is using Maven. This way, a simple
mvn jetty:run
inside your project directory should be enough. The pom.xml configures the Maven execution. For example, the jetty maven plugin configuration looks something like this:
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jettyVersion}</version> <configuration> <webAppConfig> <contextPath>/</contextPath> <descriptor>WEB-INF/${webXml}</descriptor> <tempDirectory>.tmp</tempDirectory> </webAppConfig> <webAppSourceDirectory>${basedir}/${webapp}/public</webAppSourceDirectory> <jettyXml>WEB-INF/jetty.xml</jettyXml> <stopKey>keyToStopJetty</stopKey> <stopPort>${stopPort}</stopPort> </configuration> </plugin>
Notice, that in this case the web.xml is actually in a variable. This way, you could startup different web applications using the command
mvn jetty:run -Dwebapp=project1-web.xml
and so on. So you can use different web.xml (where you can set the RESTXQ path, see http://docs.basex.org/wiki/Web_Application#Configuration for details) for your different projects. Of yourse, you could also use complete separate pom.xml using mvn -f myotherpom.xml jetty:run
I hope this helps.
Cheers, Dirk
Thanks again for the hints --
Cheers, Wendell
On Sat, Jan 10, 2015 at 3:31 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dirk, thanks!
Cheers, Wendell
On Thu, Jan 8, 2015 at 4:05 AM, Dirk Kirsten dk@basex.org wrote:
Hello Wendell,
your last guess is correct: BaseX can only handle a single RESTXQ directory. So solutions using a colon a separator will not work, simply because we do not support it. It does not depend on the OS (although I personally think you did a wise thing in trying out GNU/Linux ;).
The usual approach would be to have a separate .basex in your webapp directory. So if you start basex from this directory it will use this values instead your default ones. More likely you might want to store the BaseX specific values in your jetty.xml (if using Jetty), so they are used for the application container. This has several advantages:
- Your web application can not access some default functionality, which shouldn't really be available.
- You can use different BaseX version for different projects by including BaseX within the webapp itself
- You can also define different configurations for your different webapps (e.g. all your projects run on a different port, so you can run them simultanously)
Cheers, Dirk
On 01/07/2015 11:32 PM, Wendell Piez wrote:
Hi again,
Correction: of course, under the "composite" path, neither path works.
Perhaps BaseX can only have a single RestXQ directory at a time?
Thanks again for your patience with me. :-)
Cheers, Wendell
On Wed, Jan 7, 2015 at 5:29 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear BaseX people,
I am a hopeless newbie when it comes to Linux. Seriously, my ignorance is astonishing. I am now running Linux Mint. It's a huge amount of fun but I'm left guessing about many simply things.
I am running the current BaseX 7.9. I am using it to provide a pipeline architecture calling lots of XSLT2, producing HTML and SVG. It works well for this.
To my RESTXQPATH I wish to append to - but not override (if possible) - a path.
By editing my .basex configuration I have managed to reset it, but not simply to append to it.
That is,
RESTXQPATH = /home/wendell/basex/webapp:/home/wendell/XQuery-project/restxq
With this, the server skips the basex/webapp directory. If I remove the second segment and restart, it goes live again.
What is the simplest way for me to set up my BaseX so that I can maintain my project xqm files (including a project's RestXQ), in the project, but keep BaseX otherwise (including its data directories) separate? Over the longer term I can see several such directories where I'd like BaseX to look.
On another operating system I used to start up using different shell scripts; is that the best way here (and if so does my shell script have to call Java or can I use the scripts in the basex/bin and pass in a value somehow)?
In general, what recommendations can you offer for no-fuss configuration of RestXQ for separate projects?
Thanks! Wendell
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Dirk and BaseX friends,
On Mon, Jan 12, 2015 at 3:57 AM, Dirk Kirsten dk@basex.org wrote:
So if I understood your setup correctly, all BaseX settings in your different projects are the same except the RESTXQ path? So one option could be to set the RESTXQ path manually before starting basexhttp. Using the latest 8.0 snapshot, this is done using the global variable BASEX_JVM. So executing
export BASEX_JVM=-Dorg.basex.RESTXQPATH=/my/restxq/directory && basexhttp
should use the path provided on the command line. If you want to startup all your projects this way you could write a little script which does this for you.
Perfect. (I am now seeing what to educate myself on. :-)
Will this also work with BaseX 7.9 or what would be an alternative, if $BASEX_JVM is not available?
(Or is it time to switch to 8.0?)
Cheers, Wendell
Hi Wendell,
no, this will not work with anything before BaseX 8.0. Before, we had another syntax (which had some drawbacks, that's why we changed it and now it also more of a standard within Linux). In this syntax -X served as flag that everything that follows will be interpreted as JVM argument.
8.0 is still not a stable release, so switching to it has the usual risk of using beta software. I think it is about to be release align with XML Prague, so it shouldn't be long until it is out.
Cheers, Dirk
On 01/18/2015 10:54 PM, Wendell Piez wrote:
Dirk and BaseX friends,
On Mon, Jan 12, 2015 at 3:57 AM, Dirk Kirsten dk@basex.org wrote:
So if I understood your setup correctly, all BaseX settings in your different projects are the same except the RESTXQ path? So one option could be to set the RESTXQ path manually before starting basexhttp. Using the latest 8.0 snapshot, this is done using the global variable BASEX_JVM. So executing
export BASEX_JVM=-Dorg.basex.RESTXQPATH=/my/restxq/directory && basexhttp
should use the path provided on the command line. If you want to startup all your projects this way you could write a little script which does this for you.
Perfect. (I am now seeing what to educate myself on. :-)
Will this also work with BaseX 7.9 or what would be an alternative, if $BASEX_JVM is not available?
(Or is it time to switch to 8.0?)
Cheers, Wendell
Hi Dirk,
Thanks for the followup. I can see the -X thing in the 7.9 scripts.
XML Prague isn't so far off! Then too, I suppose the usual risk of beta software isn't so bad for me with my beta projects. :-)
Cheers, Wendell
On Sun, Jan 18, 2015 at 5:03 PM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
no, this will not work with anything before BaseX 8.0. Before, we had another syntax (which had some drawbacks, that's why we changed it and now it also more of a standard within Linux). In this syntax -X served as flag that everything that follows will be interpreted as JVM argument.
8.0 is still not a stable release, so switching to it has the usual risk of using beta software. I think it is about to be release align with XML Prague, so it shouldn't be long until it is out.
Cheers, Dirk
On 01/18/2015 10:54 PM, Wendell Piez wrote:
Dirk and BaseX friends,
On Mon, Jan 12, 2015 at 3:57 AM, Dirk Kirsten dk@basex.org wrote:
So if I understood your setup correctly, all BaseX settings in your different projects are the same except the RESTXQ path? So one option could be to set the RESTXQ path manually before starting basexhttp. Using the latest 8.0 snapshot, this is done using the global variable BASEX_JVM. So executing
export BASEX_JVM=-Dorg.basex.RESTXQPATH=/my/restxq/directory && basexhttp
should use the path provided on the command line. If you want to startup all your projects this way you could write a little script which does this for you.
Perfect. (I am now seeing what to educate myself on. :-)
Will this also work with BaseX 7.9 or what would be an alternative, if $BASEX_JVM is not available?
(Or is it time to switch to 8.0?)
Cheers, Wendell
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
basex-talk@mailman.uni-konstanz.de