BaseX Server installation.
Monday, 13 December 2010 · 4 messages · last reply 14 Dec 2010
HV
Huib Verweij13 Dec 2010 16:32 #
Hi,
I would like to install BaseX on a server. So far I've installed it on my dev machine and on a test server under my account, but now we are moving to a server where BaseX will just be started by a script or something and run in a folder which is not anyones home folder. The problem I think there will be is that BaseX takes it's configuration information always from ~/.basex, which will not work in our server setup I assume.
Am I correct in assuming this will cause headaches for our sysadmin or am I missing something?
Will 6.5 change this situation where the config file is always read from Util.homeDir()? Ideally we would just like to pass the location of the config file to the server when it starts, I suppose. In the config file we can then specify the location of the data folder etc.
Kind regards,
Huib.
GB
Godmar Back13 Dec 2010 17:45 #
A work-around which we use is to set the user.home property. This can be done via -Duser.home= on the JVM command line when starting the BaseX server.
For the library implementation, it can be done before the first access to any basex class, like shown in this example, which instructs BaseX to use a .basex directory in a Webapp container.
public static void initialize(ServletContext servletContext) {
// trick BaseX into reading its configuration from the WEB-INF directory
// by temporarily redirecting user.home property.
String basexdir = servletContext.getRealPath("WEB-INF");
String oldUserHome = System.getProperty("user.home");
System.setProperty("user.home", basexdir);
if (!org.basex.core.Prop.HOME.startsWith(basexdir))
throw new java.lang.Error("BaseX property initialization failed");
System.setProperty("user.home", oldUserHome);
}Quoted text · Huib Verweij · 17 lines
On Mon, Dec 13, 2010 at 10:32 AM, Huib Verweij <Huib.Verwey at mpi.nl> wrote: > Hi, > > I would like to install BaseX on a server. So far I've installed it on my dev machine and on a test server under my account, but now we are moving to a server where BaseX will just be started by a script or something and run in a folder which is not anyones home folder. The problem I think there will be is that BaseX takes it's configuration information always from ~/.basex, which will not work in our server setup I assume. > > Am I correct in assuming this will cause headaches for our sysadmin or am I missing something? > > Will 6.5 change this situation where the config file is always read from Util.homeDir()? Ideally we would just like to pass the location of the config file to the server when it starts, I suppose. In the config file we can then specify the location of the data folder etc. > > Kind regards, > > Huib. > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
CG
Dear Huib,
as you've probably seen, the current version of BaseX allows up to three potential locations for the config files:
1. System.getProperty("user.dir") will be checked first
2. Next, the application directory will be checked. This is the dir. in which the BaseX JAR/class files are located
3. System.getProperty("user.home") will be checked first
The »perfect home directory« has been subject to regular discussions, and we haven't found an optimal solution yet that satisfies everyone. If Godmar's approach (i.e., setting "user.home" or "user.dir" to a new location) doesn't work out, feel free to give us an idea how your preferable solution would look like.
Christian
2010/12/13 Huib Verweij <Huib.Verwey at mpi.nl>:
Quoted text · Huib Verweij · 16 lines
> Hi, > > I would like to install BaseX on a server. So far I've installed it on my dev machine and on a test server under my account, but now we are moving to a server where BaseX will just be started by a script or something and run in a folder which is not anyones home folder. The problem I think there will be is that BaseX takes it's configuration information always from ~/.basex, which will not work in our server setup I assume. > > Am I correct in assuming this will cause headaches for our sysadmin or am I missing something? > > Will 6.5 change this situation where the config file is always read from Util.homeDir()? Ideally we would just like to pass the location of the config file to the server when it starts, I suppose. In the config file we can then specify the location of the data folder etc. > > Kind regards, > > Huib. > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
HV
Hi Godmar and Christian,
thanks for the fast feedback, we'll try your suggestions. I'm pretty sure it will be OK.
Hartelijke groet,
Huib Verweij.
Op 13 dec 2010, om 16:45 heeft Godmar Back het volgende geschreven:
Quoted text · Godmar Back · 3 lines
> A work-around which we use is to set the user.home property. This can > be done via -Duser.home= on the JVM command line when starting the > BaseX server.
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery