Passing environment variables to TIBCO JasperReports® Server container - TIBCOSoftware/js-docker GitHub Wiki
TIBCO JasperReports® Server supports application configuration by passing environment variables to containers. ENV variables can be used in Spring Beans XML and Spring Properties files. For example, our goal is to customize TIBCO JasperReports® Server containers with the following:
- applicationContext-security-web.xml - where we want TIBCO JasperReports® Server to pick
defaultFailureUrlproperty from the environment variable - js.quartz.properties - where we want TIBCO JasperReports® Server to pick
report.scheduler.mail.sender.hostproperty from the environment variable
Before building jasperserver-webapp you have to update applicationContext-webapp.xml file which should notify Spring to read properties from env variables.
- First, unzip TIBCO JasperReports® Server WAR File installer zip (for example TIB_js-jrs_8.1.0_bin.zip) into
/tmp/ - In
/tmp/jasperreports-server-pro-8.1.0-binfindjasperserver-pro.warfile and unzip it into/tmp/warfile - Open
/tmp/warfile/WEB-INF/applicationContext-webapp.xml, find bean with idpropertyConfigurer, and add three new properties into it, so it will look like:
<bean id="propertyConfigurer" class="com.jaspersoft.jasperserver.api.common.properties.DecryptingPropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
<property name="searchSystemEnvironment" value="true"/>
<property name="ignoreResourceNotFound" value="true" />
...
</bean>
- Open
/tmp/warfile/WEB-INF/applicationContext-security-web.xml, find a property that we want to parameterize,defaultFailureUrl, and set it as follows:
<property name="defaultFailureUrl" value="${DEFAULT_FAILURE_URL}" />
- Open
/tmp/warfile/WEB-INF/js.quartz.properties, findreport.scheduler.mail.sender.host, and set it as follows:
report.scheduler.mail.sender.host=${MAIL_SENDER_HOST}
- These files will be used as JasperReports® Server customization in
jasperserver-webappimage, so an appropriate folder structure has to be created in the customizations directory. Create folder structure like:
<CONTAINER_PATH>/jaspersoft-containers/Docker/jrs/resources/jasperserver-customization/webapps/jasperserver-pro/WEB-INF
where CONTAINER_PATH=<YOUR_SYSTEM_DIR>/js-docker, and YOUR_SYSTEM_DIR is a location where you cloned js-docker repository
7. Copy three updated files into customization folder:
cd <CONTAINER_PATH>/jaspersoft-containers/Docker/jrs
cp /tmp/warfile/WEB-INF/applicationContext-webapp.xml ./resources/jasperserver-customization/webapps/jasperserver-pro/WEB-INF
cp /tmp/warfile/WEB-INF/applicationContext-security-web.xml ./resources/jasperserver-customization/webapps/jasperserver-pro/WEB-INF
cp /tmp/warfile/WEB-INF/js.quartz.properties ./resources/jasperserver-customization/webapps/jasperserver-pro/WEB-INF
- Rebuild
jasperserver-webapp:
docker-compose build
- edit
<CONTAINER_PATH>/jaspersoft-containers/Docker/jrs/.env, and add variables
DEFAULT_FAILURE_URL="/login.html?error=TEST"
MAIL_SENDER_HOST=mail.my.new.host.com
- start
jasperserver-webapp:
docker-compose up -d jasperserver-webapp
- verify that env variables were used in application properties