agois-inc / docker-jasperserver-ce

Docker image for JasperServer Community Edition
BSD 3-Clause "New" or "Revised" License
9 stars 10 forks source link

Introduction

This repository is a fork of the Robinyo/js-docker repository and has been updated to include support for building, configuring, and running PostgreSQL and TIBCO JasperReports Server Community Edition 7.8 in containers.

Docker image for JasperServer Community Edition. Please see Jaspersoft Community for more information.

Support

No warranty, explicit or implied, with usage of this repository. As such, we don't offer any support for this project.

Please refer to the Jaspersoft Forums for support.

Important!!

Robinyo/js-docker Way:

scripts/wait-for-container-to-exit.sh:

    INSPECT_CONTAINER=`curl --silent --unix-socket /var/run/docker.sock ${API_SERVER}/containers/${WAITFORIT_CONTAINER}/json`

docker-compose.yml:

  jasperreports-server:
    command: ["/wait-for-container-to-exit.sh", "jasperreports-server-cmdline", "-t" , "30", "--", "/entrypoint-ce.sh", "run"]
  jasperreports-server-cmdline:
    container_name: jasperreports-server-cmdline

This Project's Way:

scripts/wait-for-container-to-exit.sh:

    INSPECT_CONTAINER=`curl --silent --unix-socket /var/run/docker.sock ${API_SERVER}/v1.40/containers/json?filters=%7B%22ancestor%22%3A%5B%22${WAITFORIT_CONTAINER}%22%5D%7D`

docker-compose.yml:

  jasperreports-server:
    command: ["/wait-for-container-to-exit.sh", "jasperserver-ce-init%3A7.8.0", "-t" , "30", "--", "/entrypoint-ce.sh", "run"]
  jasperserver-init:
    image: jasperserver-ce-init:7.8.0

In reality, though, because scripts/wait-for-container-to-exit.sh changes are untested, the docker-compose.yml looks like such:

  jasperreports-server:
    command: ["/entrypoint-ce.sh", "run"]
#     command: ["/wait-for-container-to-exit.sh", "jasperserver-ce-init%3A7.8.0", "-t" , "30", "--", "/entrypoint-ce.sh", "run"]

Pre-built Docker image

Prebuilt docker images are available at agois/jasperserver-ce:7.8 and agois/jasperserver-ce-init:7.8.

Building your own image

Download the latest JasperServer (tested with 7.8) and put in ./resources: JasperServer CE Releases

Unpack and correct JasperServer:

cd scripts
chmod +x unpackWARInstaller-ce.sh 
./unpackWARInstaller-ce.sh 

Build a new Docker image and store it in local Docker (run from root of this project);

docker build -t jasperserver-ce:7.8.0 -f Dockerfile . 
docker build -t jasperserver-ce-init:7.8.0 -f Dockerfile-cmdline .

Tag the local Docker image with the Docker Hub username/repo:version

docker tag jasperserver-ce:7.8.0 agois/jasperserver-ce:7.8.0

Push new Docker image to Docker Hub

docker push agois/jasperserver-ce:7.8.0

Adding fonts to Jasper Server

In docker-compose.yml, add the fonts jars in the section jasperserver/volumes:

    volumes:
      - ./jasper-fonts-1.0.0.jar:/usr/local/tomcat/webapps/jasperserver/WEB-INF/lib/jasper-fonts-1.0.0.jar

Using with Docker Compose

You can use our agois/jasperserver-ce/agois/jasperserver-ce-init or your custom images.

Deploy local services using your docker-compose.yml.

docker stack deploy -c docker-compose.yml jasperserver-ce

Here is a sample docker-compose.yml:

version: '3.8'

services:

  postgres:    
    image: postgres:9.5.22
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    networks:
      - reportsnet
    env_file: jasper.env

  jasperserver:
    image: jasperserver-ce:7.8.0
    ports:
      - "11001:8080"
      - "11443:8443"
    depends_on:
      - jasperserver-init      
    env_file: jasper.env
    environment:
      - DB_HOST=postgres
    volumes:
      - jasper_webapp:/usr/local/tomcat/webapps/jasperserver
      - jasper_home:/usr/local/share/jasperserver
      - jasper_license:/usr/local/share/jasperserver/license 
      - jasper_keystore:/usr/local/share/jasperserver/keystore
      - jasper_customization:/usr/local/share/jasperserver/customization
    networks:
      - reportsnet
    command: ["/entrypoint-ce.sh", "run"]
#     command: ["/wait-for-container-to-exit.sh", "jasperserver-ce-init", "-t" , "30", "--", "/entrypoint-ce.sh", "run"]

  jasperserver-init:
    image: jasperserver-ce-init:7.8.0
    deploy:
      restart_policy:
        condition: none
    env_file: jasper.env
    volumes:
      - jasper_init_home:/usr/local/share/jasperserver
      - jasper_keystore:/usr/local/share/jasperserver/keystore
    environment:
      - DB_HOST=postgres
      - JRS_DBCONFIG_REGEN=true
    depends_on:
      - postgres
    command: ["/wait-for-it.sh", "postgres:5432", "-t" , "30", "--", "/entrypoint-cmdline-ce.sh", "init"]
    networks:
      - reportsnet

networks:
  reportsnet:

volumes:
  pgdata:
  jasper_home:
  jasper_webapp:
  jasper_license:
  jasper_keystore:
  jasper_customization:
  jasper_init_home:

jasper.env

DB_USER=postgres
DB_PASSWORD=postgres
DB_PORT=5432
DB_NAME=jasperserver
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres