Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

merge sbisbee's work + configurable root dirs #148

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
589cb88
First pass at making the init file more system independent (still LSB).
sbisbee Sep 1, 2010
c621d0e
Rewriting the run binary to deal with its life better.
sbisbee Sep 1, 2010
5bf88e7
fixing typo
sbisbee Sep 1, 2010
c307979
Fixing wrong value to pid file
sbisbee Sep 1, 2010
0b9cf6d
Prevent start if the pid file is there.
sbisbee Sep 1, 2010
a082b15
Making some LSB codes more explicit with variables
sbisbee Sep 1, 2010
4100865
Fixing start code
sbisbee Sep 1, 2010
08c0150
Fixing var order
sbisbee Sep 1, 2010
97a9e85
Adding the usage output
sbisbee Sep 1, 2010
cb00be8
Adding to thanks file
sbisbee Sep 22, 2010
e4ae3e2
Rearranging package format to match the *nix file structure.
sbisbee Sep 22, 2010
dba9760
Adding the other doc files to the package.
sbisbee Sep 22, 2010
a71a89e
Renaming the binary, and updating the init file accordingly
sbisbee Sep 22, 2010
c9a76e2
Shouldn't overwrite PATH.
sbisbee Sep 22, 2010
49a369d
Fixing the assembly file from the shell script rename.
sbisbee Sep 22, 2010
717db0f
Implementing the -p PID file arg and using in the init file.
sbisbee Sep 22, 2010
fa35de3
Forgot to tell getopts to parse the -p arg.
sbisbee Sep 27, 2010
05e02dd
Adding the main class to the jar's manifest - we can now call by jar,…
sbisbee Sep 28, 2010
3eb06a5
Changing how we create the CLASSPATH to play friendlier with our new …
sbisbee Sep 28, 2010
87395a7
Prevent the indexes from being written to the jar or wrapper's cwd.
sbisbee Sep 28, 2010
0a413b9
Put documentation in usr/share/doc/couchdb-lucene
sbisbee Sep 28, 2010
692ecd0
Merge remote branch 'sbisbee/master' into ubuntu
Dec 21, 2011
2988b7a
support for configurable root directories
Dec 21, 2011
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions THANKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add yourself too :)

8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

</properties>
<issueManagement>
<system>github</system>
Expand Down Expand Up @@ -179,6 +186,7 @@
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<mainClass>com.github.rnewson.couchdb.lucene.Main</mainClass>
</manifest>
</archive>
</configuration>
Expand Down
30 changes: 17 additions & 13 deletions src/main/assembly/dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,54 @@
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>${destDocDir}/couchdb-lucene</outputDirectory>
<includes>
<include>${project.basedir}/README*</include>
<include>${project.basedir}/LICENSE*</include>
<include>${project.basedir}/NOTICE*</include>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
<include>BREAKING_CHANGES*</include>
<include>TODO*</include>
<include>THANKS*</include>
</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.basedir}/src/main/bin/run</source>
<source>${project.basedir}/src/main/bin/couchdb-lucene</source>
<fileMode>755</fileMode>
<outputDirectory>/bin</outputDirectory>
<outputDirectory>${destBinDir}</outputDirectory>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e, ${destRootDir}/bin

</file>
<file>
<source>${project.basedir}/src/main/bin/kill_ppid</source>
<fileMode>755</fileMode>
<outputDirectory>/bin</outputDirectory>
<outputDirectory>${destVarLibDir}/couchdb-lucene</outputDirectory>
</file>
<file>
<source>${project.basedir}/src/main/resources/couchdb-lucene.ini</source>
<fileMode>644</fileMode>
<outputDirectory>/conf</outputDirectory>
<outputDirectory>${destEtcDir}/couchdb-lucene</outputDirectory>
</file>
<file>
<source>${project.basedir}/src/main/resources/log4j.xml</source>
<fileMode>644</fileMode>
<outputDirectory>/conf</outputDirectory>
<outputDirectory>${destEtcDir}/couchdb-lucene</outputDirectory>
</file>
<file>
<source>${project.basedir}/couchdb-external-hook.py</source>
<fileMode>777</fileMode>
<outputDirectory>/tools</outputDirectory>
<fileMode>755</fileMode>
<outputDirectory>${destBinDir}</outputDirectory>
</file>
<file>
<source>${project.basedir}/src/main/tools/etc/init.d/couchdb-lucene</source>
<fileMode>755</fileMode>
<outputDirectory>/tools/etc/init.d/couchdb-lucene</outputDirectory>
<outputDirectory>${destEtcDir}/init.d</outputDirectory>
</file>
</files>
<dependencySets>
<dependencySet>
<scope>runtime</scope>
<outputDirectory>/lib</outputDirectory>
<outputDirectory>${destVarLibDir}/couchdb-lucene</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>
90 changes: 90 additions & 0 deletions src/main/bin/couchdb-lucene
Original file line number Diff line number Diff line change
@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


SCRIPT_OK=0
SCRIPT_ERROR=1

printUsage()
{
cat << EOF
Usage: `$basename $0` [OPTIONS]

Starts the couchdb-lucene server component.

Options:

-h displays this short help message and exits

-b spawn as a background process
-o FILE redirect background process's stdout to FILE (defaults to none)
-p FILE set the background process's PID FILE
EOF
}

getPid()
{
[ -f $PID_FILE ] && PID=`cat $PID_FILE`
echo $PID
}

start()
{
CLASSPATH="$CL_BASEDIR/etc/couchdb-lucene:$CL_BASEDIR/lib/couchdb-lucene/*"
JAVA_OPTS="-server -Xmx1g -cp $CLASSPATH"

command="java $JAVA_OPTS $JAR com.github.rnewson.couchdb.lucene.Main"

if [ "$BACKGROUND" != "true" ]
then
eval $command
else
PID=`getPid`

if [ -z "$PID" ]
then
[ -n $STDOUT_FILE ] && command="$command >> $STDOUT_FILE"

eval "$command &"
echo $! > $PID_FILE
else
echo "$NAME is already running ($PID_FILE)."
fi
fi
}

checkEnvironment()
{
prepend="couchdb-lucene needs write access to"
[ ! -w $STDOUT_FILE ] && echo "$prepend output file $STDOUT_FILE" && exit $SCRIPT_ERROR
unset prepend
}

parseOptions()
{
opts=`getopt o:hbp: $@`
set -- $opts
while [ $# -gt 0 ]
do
case "$1" in
-h) shift; printUsage; exit $SCRIPT_OK;;
-o) shift; STDOUT_FILE="$1"; shift;;
-b) shift; BACKGROUND=true;;
-p) shift; PID_FILE="$1"; shift;;
--) shift; break;;
*) echo "Unknown option: $1" >&2; exit $SCRIPT_ERROR;;
esac
done
}

parseOptions $@
checkEnvironment

[ -z $CL_BASEDIR ] && CL_BASEDIR=`dirname "$0"`"/.."
cd $CL_BASEDIR

start

2 changes: 1 addition & 1 deletion src/main/resources/couchdb-lucene.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[lucene]
# The output directory for Lucene indexes.
dir=indexes
dir=/var/lib/couchdb-lucene/indexes
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


# The local host name that couchdb-lucene binds to
host=localhost
Expand Down
Loading