Passing environment variables to TIBCO JasperReports® Server container - TIBCOSoftware/js-docker GitHub Wiki

Introduction

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 defaultFailureUrl property from the environment variable
  • js.quartz.properties - where we want TIBCO JasperReports® Server to pick report.scheduler.mail.sender.host property from the environment variable

Configuring TIBCO JasperReports Server® application image

Before building jasperserver-webapp you have to update applicationContext-webapp.xml file which should notify Spring to read properties from env variables.

  1. First, unzip TIBCO JasperReports® Server WAR File installer zip (for example TIB_js-jrs_8.1.0_bin.zip) into /tmp/
  2. In /tmp/jasperreports-server-pro-8.1.0-bin find jasperserver-pro.war file and unzip it into /tmp/warfile
  3. Open /tmp/warfile/WEB-INF/applicationContext-webapp.xml, find bean with id propertyConfigurer, 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>
  1. 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}" />
  1. Open /tmp/warfile/WEB-INF/js.quartz.properties, find report.scheduler.mail.sender.host, and set it as follows:
report.scheduler.mail.sender.host=${MAIL_SENDER_HOST}
  1. These files will be used as JasperReports® Server customization in jasperserver-webapp image, 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
  1. Rebuild jasperserver-webapp:
docker-compose build

Passing environment variables in Docker

  1. 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
  1. start jasperserver-webapp:
docker-compose up -d jasperserver-webapp
  1. verify that env variables were used in application properties
⚠️ **GitHub.com Fallback** ⚠️