Skip to content

Commit 51ca806

Browse files
author
Dmitry Berezovsky
committed
Initial
1 parent dd8eb57 commit 51ca806

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM logicify/centos7
2+
MAINTAINER Dmitry Berezovsky <[email protected]>
3+
4+
# java7
5+
RUN cd /opt && \
6+
(curl -L -k -b "oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz | gunzip -c | tar x) \
7+
&& ln -s /opt/jdk1.7.0_79 /opt/jdk7
8+
9+
ENV JAVA_HOME /opt/jdk7
10+
ENV JRE_HOME $JAVA_HOME/jre
11+
ENV PATH $PATH:$JAVA_HOME/bin
12+
13+
USER app
14+
RUN cd /srv \
15+
&& (curl -L http://www.squashtest.org/telechargements/send/13-version-stable/190-sqaushtm-1120-targz | gunzip -c | tar x)
16+
17+
COPY startup.sh /srv/squash-tm/bin/startup.sh
18+
COPY conf /srv/squash-tm/bin/conf
19+
USER root
20+
RUN chmod +x /srv/squash-tm/bin/startup.sh && chown app /srv/squash-tm/bin/conf/log4j.properties
21+
USER app
22+
23+
WORKDIR /srv/squash-tm/bin
24+
EXPOSE 8080
25+
CMD ["./startup.sh"]

conf/log4j.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Set root logger level to DEBUG and its only appender to A1.
2+
log4j.rootLogger=INFO, A1
3+
4+
# A1 is set to be a ConsoleAppender.
5+
log4j.appender.A1=org.apache.log4j.ConsoleAppender
6+
7+
# A1 uses PatternLayout.
8+
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
9+
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

startup.sh

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#! /bin/bash
2+
#
3+
# This file is part of the Squashtest platform.
4+
# Copyright (C) 2010 - 2012 Henix, henix.fr
5+
#
6+
# See the NOTICE file distributed with this work for additional
7+
# information regarding copyright ownership.
8+
#
9+
# This is free software: you can redistribute it and/or modify
10+
# it under the terms of the GNU Lesser General Public License as published by
11+
# the Free Software Foundation, either version 3 of the License, or
12+
# (at your option) any later version.
13+
#
14+
# this software is distributed in the hope that it will be useful,
15+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
# GNU Lesser General Public License for more details.
18+
#
19+
# You should have received a copy of the GNU Lesser General Public License
20+
# along with this software. If not, see <http://www.gnu.org/licenses/>.
21+
#
22+
23+
24+
#That script will :
25+
#- check that the java environnement exists,
26+
#- the version is adequate,
27+
#- will run the application
28+
29+
30+
# Default variables
31+
JAR_NAME="org.apache.felix.main-4.2.1.jar" # Java main library
32+
HTTP_PORT=8080 # Port for HTTP connector (default 8080; disable with -1)
33+
# Directory variables
34+
TMP_DIR=../tmp # Jetty tmp and work directory
35+
BUNDLES_DIR=../bundles # Bundles directory
36+
CACHE_DIR=.. # Cache directory
37+
CONF_DIR=../conf # Configurations directory
38+
LOG_DIR=../logs # Log directory
39+
JETTY_HOME=../jettyhome # Jetty home directory
40+
LUCENE_DIR=../luceneindexes # Lucene indexes directory
41+
PLUGINS_DIR=../plugins # Plugins directory
42+
# DataBase parameters
43+
DB_URL=${DB_URL:-"jdbc:h2:../data/squash-tm"} # DataBase URL
44+
DB_DRIVER=${DB_DRIVER:-"org.h2.Driver"} # DataBase driver
45+
DB_USERNAME=${DB_USERNAME:-"sa"} # DataBase username
46+
DB_PASSWORD=${DB_PASSWORD:-"sa"} # DataBase password
47+
DB_DIALECT=${DB_DIALECT:-"org.hibernate.dialect.H2Dialect"} # DataBase dialect
48+
## Do not configure a third digit here
49+
REQUIRED_VERSION=1.6
50+
# Extra Java args
51+
JAVA_ARGS=${JAVA_ARGS:-"-Xms128m -Xmx512m -XX:MaxPermSize=192m -server"}
52+
53+
54+
# Tests if java exists
55+
echo -n "$0 : checking java environment... ";
56+
57+
java_exists=`java -version 2>&1`;
58+
59+
if [ $? -eq 127 ]
60+
then
61+
echo;
62+
echo "$0 : Error : java not found. Please ensure that \$JAVA_HOME points to the correct directory.";
63+
echo "If \$JAVA_HOME is correctly set, try exporting that variable and run that script again. Eg : ";
64+
echo "\$ export \$JAVA_HOME";
65+
echo "\$ ./$0";
66+
exit -1;
67+
fi
68+
69+
echo "done";
70+
71+
# Create logs and tmp directories if necessary
72+
if [ ! -e "$LOG_DIR" ]; then
73+
mkdir $LOG_DIR
74+
fi
75+
76+
if [ ! -e "$TMP_DIR" ]; then
77+
mkdir $TMP_DIR
78+
fi
79+
80+
# Tests if the version is high enough
81+
echo -n "checking version... ";
82+
83+
NUMERIC_REQUIRED_VERSION=`echo $REQUIRED_VERSION |sed 's/\./0/g'`;
84+
java_version=`echo $java_exists | grep version |cut -d " " -f 3 |sed 's/\"//g' | cut -d "." -f 1,2 | sed 's/\./0/g'`;
85+
86+
if [ $java_version -lt $NUMERIC_REQUIRED_VERSION ]
87+
then
88+
echo;
89+
echo "$0 : Error : your JRE does not meet the requirements. Please install a new JRE, required version ${REQUIRED_VERSION}.";
90+
exit -2;
91+
fi
92+
93+
echo "done";
94+
95+
96+
# Let's go !
97+
echo "$0 : starting Felix... ";
98+
99+
export _JAVA_OPTIONS="-Ddb.driver=${DB_DRIVER} -Ddb.url=${DB_URL} -Ddb.username=${DB_USERNAME} -Ddb.password=${DB_PASSWORD} -Ddb.dialect=${DB_DIALECT} -Duser.language=en"
100+
DAEMON_ARGS="${JAVA_ARGS} -Dbundles.dir=${BUNDLES_DIR} -Dcache.dir=${CACHE_DIR} -Dconf.dir=${CONF_DIR} -Dlog.dir=${LOG_DIR} -Dplugins.dir=${PLUGINS_DIR} -Djetty.logs=${LOG_DIR} -Dbundles.configuration.location=${CONF_DIR} -Dfelix.config.properties=file:${CONF_DIR}/felix.config.properties -Dfelix.system.properties=file:${CONF_DIR}/felix.system.properties -Djetty.port=${HTTP_PORT} -Djetty.home=${JETTY_HOME} -Dlucene.dir=${LUCENE_DIR} -Djava.io.tmpdir=${TMP_DIR} -Dlog4j.configuration=file:./conf/log4j.properties -jar ${JAR_NAME}"
101+
102+
find ${TMP_DIR} -delete > /dev/null 2>&1
103+
104+
exec java ${DAEMON_ARGS}
105+

0 commit comments

Comments
 (0)