/
entrypoint.sh
59 lines (44 loc) · 2.34 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
set -e
# wait upto 30 seconds for the database to start before connecting
/wait-for-it.sh $DB_HOST:$DB_PORT -t 30
# required to skip interactive prompt when creating keystore in 7.5.0+
# see https://community.jaspersoft.com/questions/1155841/docker-install-75-failing-create-ks-interactive-prompt.
export BUILDOMATIC_MODE=script
# check if we need to bootstrap the JasperServer
if [ -f "/.do_deploy_jasperserver" ]; then
pushd /usr/src/jasperreports-server/buildomatic
# Use provided configuration templates
# Note: only works for Postgres or MySQL
cp sample_conf/${DB_TYPE}_master.properties default_master.properties
# tell the bootstrap script where to deploy the war file to
sed -i -e "s|^appServerDir.*$|appServerDir = $CATALINA_HOME|g" default_master.properties
# set all the database settings
sed -i -e "s|^dbHost.*$|dbHost=$DB_HOST|g; s|^dbPort.*$|dbPort=$DB_PORT|g; s|^dbUsername.*$|dbUsername=$DB_USER|g; s|^dbPassword.*$|dbPassword=$DB_PASSWORD|g" default_master.properties
# rename the application war so that it can be served as the default tomcat web application
sed -i -e "s|^# webAppNameCE.*$|webAppNameCE = ROOT|g" default_master.properties
# run the minimum bootstrap script to initial the JasperServer
./js-ant create-js-db || true #create database and skip it if database already exists
./js-ant init-js-db-ce
./js-ant import-minimal-ce
./js-ant deploy-webapp-ce
# bootstrap was successful, delete file so we don't bootstrap on subsequent restarts
rm /.do_deploy_jasperserver
# Add WebServiceDataSource plugin
wget https://community.jaspersoft.com/sites/default/files/releases/jaspersoft_webserviceds_v1.5.zip -O /tmp/jasper.zip && \
unzip /tmp/jasper.zip -d /tmp/ && \
cp -rfv /tmp/JRS/WEB-INF/* /usr/local/tomcat/webapps/ROOT/WEB-INF/ && \
sed -i 's/queryLanguagesPro/queryLanguagesCe/g' /usr/local/tomcat/webapps/ROOT/WEB-INF/applicationContext-WebServiceDataSource.xml && \
rm -rf /tmp/*
# import any export zip files from another JasperServer
shopt -s nullglob # handle case if no zip files found
IMPORT_FILES=/jasperserver-import/*.zip
for f in $IMPORT_FILES
do
echo "Importing $f..."
./js-import.sh --input-zip $f
done
popd
fi
# run Tomcat to start JasperServer webapp
catalina.sh run