Skip to content
Snippets Groups Projects
Commit 5ef4fe28 authored by felmer's avatar felmer
Browse files

LMS-401 bug fixing distribution script and startup script

SVN: 5906
parent 17cadce1
No related branches found
No related tags found
No related merge requests found
...@@ -3,11 +3,12 @@ ...@@ -3,11 +3,12 @@
<project-classpath name="ecp" classes="${classes}" /> <project-classpath name="ecp" classes="${classes}" />
<property name="original.dist" value="dist" /> <property name="original.dist" value="dist" />
<property name="mainfolder" value="download-service" /> <property name="name" value="download-server"/>
<property name="mainfolder" value="${name}" />
<property name="dist.download-service" value="${dist}/${mainfolder}" /> <property name="dist.download-service" value="${dist}/${mainfolder}" />
<property name="dist.download-service.lib" value="${dist.download-service}/lib" /> <property name="dist.download-service.lib" value="${dist.download-service}/lib" />
<property name="jar.file" value="${dist.download-service.lib}/download-service.jar" /> <property name="jar.file" value="${dist.download-service.lib}/${name}.jar" />
<property name="dist.file.prefix" value="${dist}/download-service" /> <property name="dist.file.prefix" value="${dist}/${name}" />
<property name="lib" value="../libraries" /> <property name="lib" value="../libraries" />
<target name="clean"> <target name="clean">
...@@ -32,9 +33,9 @@ ...@@ -32,9 +33,9 @@
<include name="${build.info.filename}" /> <include name="${build.info.filename}" />
</fileset> </fileset>
<manifest> <manifest>
<attribute name="Main-Class" value="ch.systemsx.cisd.datasetdownload.DatasetDownloadService" /> <attribute name="Main-Class" value="ch.systemsx.cisd.openbis.datasetdownload.DatasetDownloadService" />
<attribute name="Class-Path" <attribute name="Class-Path"
value="jetty.jar jetty-util.jar servlet-api-2.5.jar log4j.jar commons-lang.jar commons-io.jar" /> value="${name}.jar jetty.jar jetty-util.jar servlet-api-2.5.jar log4j.jar commons-codec.jar commons-logging.jar commons-httpclient.jar commons-lang.jar commons-io.jar activation.jar mail.jar spring.jar" />
<attribute name="Version" value="${version.number}" /> <attribute name="Version" value="${version.number}" />
<attribute name="Build-Number" value="${version.number} (r${revision.number},${clean.flag})" /> <attribute name="Build-Number" value="${version.number} (r${revision.number},${clean.flag})" />
</manifest> </manifest>
...@@ -42,12 +43,18 @@ ...@@ -42,12 +43,18 @@
</target> </target>
<target name="dist" depends="jar"> <target name="dist" depends="jar">
<copy file="${lib}/activation/activation.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/mail/mail.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/spring/spring.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/log4j/log4j.jar" todir="${dist.download-service.lib}" /> <copy file="${lib}/log4j/log4j.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/jetty/jetty.jar" todir="${dist.download-service.lib}" /> <copy file="${lib}/jetty/jetty.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/jetty/jetty-util.jar" todir="${dist.download-service.lib}" /> <copy file="${lib}/jetty/jetty-util.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/jetty/servlet-api-2.5.jar" todir="${dist.download-service.lib}" /> <copy file="${lib}/jetty/servlet-api-2.5.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/commons-lang/commons-lang.jar" todir="${dist.download-service.lib}" /> <copy file="${lib}/commons-lang/commons-lang.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/commons-io/commons-io.jar" todir="${dist.download-service.lib}" /> <copy file="${lib}/commons-io/commons-io.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/commons-logging/commons-logging.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/commons-httpclient/commons-httpclient.jar" todir="${dist.download-service.lib}" />
<copy file="${lib}/commons-codec/commons-codec.jar" todir="${dist.download-service.lib}" />
<property name="dist.file" value="${dist.file.prefix}-${version.number}-r${revision.number}.zip" /> <property name="dist.file" value="${dist.file.prefix}-${version.number}-r${revision.number}.zip" />
<zip basedir="${dist}" destfile="${dist.file}"> <zip basedir="${dist}" destfile="${dist.file}">
<zipfileset dir="${original.dist}" excludes="**.download-service.sh" prefix="${mainfolder}" /> <zipfileset dir="${original.dist}" excludes="**.download-service.sh" prefix="${mainfolder}" />
......
...@@ -48,11 +48,12 @@ isPIDRunning() ...@@ -48,11 +48,12 @@ isPIDRunning()
# #
PIDFILE=${DOWNLOAD_SERVICE_PID:-DOWNLOAD_SERVICE.pid} PIDFILE=${DOWNLOAD_SERVICE_PID:-DOWNLOAD_SERVICE.pid}
CONFFILE=etc/download-service.conf CONFFILE=etc/dataset_download.conf
LOGFILE=log/download-service_log.txt LOGFILE=log/dataset_download_log.txt
STARTUPLOG=log/startup_log.txt STARTUPLOG=log/startup_log.txt
SUCCESS_MSG="Data set download service ready" SUCCESS_MSG="Data set download server ready"
MAX_LOOPS=10 MAX_LOOPS=10
JAR_FILE=lib/download-server.jar
# #
# change to installation directory # change to installation directory
...@@ -76,18 +77,19 @@ else ...@@ -76,18 +77,19 @@ else
fi fi
command=$1 command=$1
ALL_JAVA_OPTS="-Djavax.net.ssl.trustStore=etc/openBIS.keystore $JAVA_OPTS"
# ensure that we ignore a possible prefix "--" for any command # ensure that we ignore a possible prefix "--" for any command
command="${command#--*}" command="${command#--*}"
case "$command" in case "$command" in
start) start)
echo -n "Starting Data Set Download Service " echo -n "Starting Data Set Download Server "
rm -f $LOGFILE.old rm -f $LOGFILE.old
if [ -f $LOGFILE ]; then if [ -f $LOGFILE ]; then
mv $LOGFILE $LOGFILE.old mv $LOGFILE $LOGFILE.old
fi fi
shift 1 shift 1
${JAVA_BIN} ${JAVA_OPTS} -jar lib/download-service.jar "$@" > $STARTUPLOG 2>&1 & echo $! > $PIDFILE ${JAVA_BIN} ${ALL_JAVA_OPTS} -jar $JAR_FILE "$@" > $STARTUPLOG 2>&1 & echo $! > $PIDFILE
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
# wait for initial self-test to finish # wait for initial self-test to finish
n=0 n=0
...@@ -119,7 +121,7 @@ case "$command" in ...@@ -119,7 +121,7 @@ case "$command" in
fi fi
;; ;;
stop) stop)
echo -n "Stopping Data Set Download Service " echo -n "Stopping Data Set Download Server "
if [ -f $PIDFILE ]; then if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE` PID=`cat $PIDFILE`
isPIDRunning $PID isPIDRunning $PID
...@@ -144,12 +146,12 @@ case "$command" in ...@@ -144,12 +146,12 @@ case "$command" in
PID=`cat $PIDFILE` PID=`cat $PIDFILE`
isPIDRunning $PID isPIDRunning $PID
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Data Set Download Service is running (pid $PID)" echo "Data Set Download Server is running (pid $PID)"
else else
echo "Data Set Download Service is dead (stale pid $PID)" echo "Data Set Download Server is dead (stale pid $PID)"
fi fi
else else
echo "Data Set Download Service is not running" echo "Data Set Download Server is not running"
fi fi
;; ;;
restart) restart)
...@@ -157,10 +159,10 @@ case "$command" in ...@@ -157,10 +159,10 @@ case "$command" in
$SCRIPT start $SCRIPT start
;; ;;
help) help)
${JAVA_BIN} ${JAVA_OPTS} -jar lib/download-service.jar --help ${JAVA_BIN} ${ALL_JAVA_OPTS} -jar $JAR_FILE --help
;; ;;
version) version)
${JAVA_BIN} ${JAVA_OPTS} -jar lib/download-service.jar --version ${JAVA_BIN} ${ALL_JAVA_OPTS} -jar $JAR_FILE --version
;; ;;
*) *)
echo $"Usage: $0 {start|stop|restart|status|help|version}" echo $"Usage: $0 {start|stop|restart|status|help|version}"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<appender name="DEFAULT" class="org.apache.log4j.DailyRollingFileAppender"> <appender name="DEFAULT" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="log/etlserver_log.txt"/> <param name="File" value="log/dataset_download_log.txt"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/> <param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout"> <layout class="org.apache.log4j.PatternLayout">
......
File added
# The root directory of the data store # The root directory of the data store
storeroot-dir = targets/store storeroot-dir = targets/store
# Port
port = <enter port>
# The URL of the openBIS server # The URL of the openBIS server
server-url = http://localhost:8080/openbis server-url = http://localhost:8080/openbis
...@@ -11,10 +14,10 @@ username = <enter user name> ...@@ -11,10 +14,10 @@ username = <enter user name>
password = <enter pass wprd> password = <enter pass wprd>
# Path to the keystore # Path to the keystore
keystore.path = <enter path> keystore.path = etc/jetty-keystore
# Password of the keystore # Password of the keystore
keystore.password = <enter password> keystore.password = OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
# Key password of the keystore # Key password of the keystore
keystore.key-password = <enter key password> keystore.key-password = OBF:1u2u1wml1z7s1z7a1wnl1u2g
\ No newline at end of file
...@@ -14,7 +14,7 @@ username = data set download server ...@@ -14,7 +14,7 @@ username = data set download server
password = doesnotmatter password = doesnotmatter
# Path to the keystore # Path to the keystore
keystore.path = etc/jetty-keystore keystore.path = dist/etc/jetty-keystore
# Password of the keystore # Password of the keystore
keystore.password = OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4 keystore.password = OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
......
...@@ -76,7 +76,7 @@ public class DatasetDownloadService ...@@ -76,7 +76,7 @@ public class DatasetDownloadService
selfTest(applicationContext); selfTest(applicationContext);
if (operationLog.isInfoEnabled()) if (operationLog.isInfoEnabled())
{ {
operationLog.info("Data set download service ready on port " + port); operationLog.info("Data set download server ready on port " + port);
} }
} }
......
...@@ -126,6 +126,9 @@ public class DatasetDownloadServlet extends HttpServlet ...@@ -126,6 +126,9 @@ public class DatasetDownloadServlet extends HttpServlet
{ {
operationLog.error("Request " + request.getRequestURL() + "?" operationLog.error("Request " + request.getRequestURL() + "?"
+ request.getQueryString() + " caused an exception: ", e); + request.getQueryString() + " caused an exception: ", e);
} else if (operationLog.isInfoEnabled())
{
operationLog.info("User failure: " + e.getMessage());
} }
PrintWriter writer = response.getWriter(); PrintWriter writer = response.getWriter();
writer.println("<html><body><h1>Error</h1>"); writer.println("<html><body><h1>Error</h1>");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment