merge sbisbee's work + configurable root dirs #148

Open
wants to merge 23 commits into
from

Projects

None yet

3 participants

@timkuijsten

use configurable root dirs, default to /usr/local

sbisbee and others added some commits Sep 1, 2010
@sbisbee @sbisbee sbisbee First pass at making the init file more system independent (still LSB). 589cb88
@sbisbee sbisbee Rewriting the run binary to deal with its life better. c621d0e
@sbisbee sbisbee fixing typo 5bf88e7
@sbisbee sbisbee Fixing wrong value to pid file c307979
@sbisbee sbisbee Prevent start if the pid file is there. 0b9cf6d
@sbisbee sbisbee Making some LSB codes more explicit with variables a082b15
@sbisbee sbisbee Fixing start code 4100865
@sbisbee sbisbee Fixing var order 08c0150
@sbisbee sbisbee Adding the usage output 97a9e85
@sbisbee sbisbee Adding to thanks file cb00be8
@sbisbee sbisbee Rearranging package format to match the *nix file structure. e4ae3e2
@sbisbee sbisbee Adding the other doc files to the package. dba9760
@sbisbee sbisbee Renaming the binary, and updating the init file accordingly a71a89e
@sbisbee sbisbee Shouldn't overwrite PATH. c9a76e2
@sbisbee sbisbee Fixing the assembly file from the shell script rename. 49a369d
@sbisbee sbisbee Implementing the -p PID file arg and using in the init file. 717db0f
@sbisbee sbisbee Forgot to tell getopts to parse the -p arg. fa35de3
@sbisbee sbisbee Adding the main class to the jar's manifest - we can now call by jar,…
… not class.
05e02dd
@sbisbee sbisbee Changing how we create the CLASSPATH to play friendlier with our new …
…package layout.
3eb06a5
@sbisbee sbisbee Prevent the indexes from being written to the jar or wrapper's cwd. 87395a7
@sbisbee sbisbee Put documentation in usr/share/doc/couchdb-lucene 0a413b9
@timkuijsten timkuijsten Merge remote branch 'sbisbee/master' into ubuntu
Conflicts:
	THANKS.md
	src/main/assembly/dist.xml
	src/main/bin/run
692ecd0
@timkuijsten timkuijsten support for configurable root directories
destRootDir
destVarDir
destVarLibDir
destEtcDir
destBinDir
destDocDir

example: mvn -DdestRootDir="" -DdestDocDir="/usr/local/share"
2988b7a
@timkuijsten

Succesfully built on Ubuntu Server 10.04 amd64 with: mvn -DdestRootDir="" -DdestDocDir="/usr/local/share" -DdestBinDir="/usr/local/bin"

@timkuijsten

but i do see some runtime errors now:
/usr/local/couchdb-lucene-0.8.0-SNAPSHOT$ ./usr/local/bin/couchdb-lucene
Exception in thread "main" java.lang.NoClassDefFoundError: com/github/rnewson/couchdb/lucene/Main
Caused by: java.lang.ClassNotFoundException: com.github.rnewson.couchdb.lucene.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: com.github.rnewson.couchdb.lucene.Main. Program will exit.

Have to investigate..

@rnewson rnewson commented on the diff Dec 21, 2011
THANKS.md
@@ -2,3 +2,4 @@
* Thanks to Adam Lofts for the performance boosting JSONDocumentAdapter et al.
* Thanks to Santiago M. Mola for the termvector option.
* Thanks to Joe Hillenbrand for adding default result limit to config.
+* Thanks to Sam Bisbee.
@rnewson
rnewson Dec 21, 2011 Owner

You should add yourself too :)

@rnewson rnewson commented on the diff Dec 21, 2011
@@ -110,6 +110,13 @@
<tika-version>1.0</tika-version>
<jetty-version>6.1.20</jetty-version>
<http-version>4.0.1</http-version>
+ <env>default</env>
+ <destRootDir>/usr/local</destRootDir>
+ <destVarDir>${destRootDir}/var</destVarDir>
+ <destVarLibDir>${destVarDir}/lib</destVarLibDir>
+ <destEtcDir>${destRootDir}/etc</destEtcDir>
+ <destBinDir>${destRootDir}/bin</destBinDir>
+ <destDocDir>${destRootDir}/share/doc</destDocDir>
@rnewson
rnewson Dec 21, 2011 Owner

I'd keep destRootDir and to do the /var etc thing where it's used. The abstraction here isn't useful as these variables almost never vary. It's only the top-level that is altered and {root}/etc, {root}/bin are assumed.

@rnewson rnewson commented on the diff Dec 21, 2011
src/main/assembly/dist.xml
<fileMode>755</fileMode>
- <outputDirectory>/bin</outputDirectory>
+ <outputDirectory>${destBinDir}</outputDirectory>
@rnewson
rnewson Dec 21, 2011 Owner

i.e, ${destRootDir}/bin

@rnewson rnewson commented on the diff Dec 21, 2011
src/main/bin/couchdb-lucene
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+NAME="couchdb-lucene"
+BACKGROUND=false #whether to run in the background or not
+STDOUT_FILE="" #where to send background stdout to (defaults to &1)
+PID_FILE=/var/run/couchdb-lucene/couchdb-lucene.pid
@rnewson
rnewson Dec 21, 2011 Owner

This is absolute, but should be relative to ${destRootDir} too.

@rnewson rnewson commented on the diff Dec 21, 2011
src/main/resources/couchdb-lucene.ini
@@ -1,6 +1,6 @@
[lucene]
# The output directory for Lucene indexes.
-dir=indexes
+dir=/var/lib/couchdb-lucene/indexes
@rnewson
rnewson Dec 21, 2011 Owner

This is absolute, but should be relative to ${destRootDir} too.

@rnewson rnewson commented on the diff Dec 21, 2011
src/main/tools/etc/init.d/couchdb-lucene
NAME="couchdb-lucene"
-DAEMON=/usr/local/couchdb-lucene-0.5.5/bin/run
-PIDFILE=/var/run/$NAME.pid
-DAEMON_ARGS="$PIDFILE"
-SCRIPTNAME=/etc/init.d/$NAME
+PIDFILE=/var/run/$NAME/$NAME.pid
+DAEMON=$NAME
+DAEMON_ARGS="-o /var/log/couchdb-lucene.log -b -p $PIDFILE"
@rnewson
rnewson Dec 21, 2011 Owner

This is absolute, but should be relative to ${destRootDir} too.

@rnewson rnewson commented on the diff Dec 21, 2011
src/main/tools/etc/init.d/couchdb-lucene
NAME="couchdb-lucene"
-DAEMON=/usr/local/couchdb-lucene-0.5.5/bin/run
-PIDFILE=/var/run/$NAME.pid
-DAEMON_ARGS="$PIDFILE"
-SCRIPTNAME=/etc/init.d/$NAME
+PIDFILE=/var/run/$NAME/$NAME.pid
@rnewson
rnewson Dec 21, 2011 Owner

This is absolute, but should be relative to ${destRootDir} too.

@rnewson rnewson commented on the diff Dec 21, 2011
src/main/tools/etc/init.d/couchdb-lucene
NAME="couchdb-lucene"
-DAEMON=/usr/local/couchdb-lucene-0.5.5/bin/run
-PIDFILE=/var/run/$NAME.pid
-DAEMON_ARGS="$PIDFILE"
-SCRIPTNAME=/etc/init.d/$NAME
@rnewson
rnewson Dec 21, 2011 Owner

This is absolute, but should be relative to ${destRootDir} too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment