Sign inSign up

ic3software/print

By ic3software

Updated 20 days ago

icCube print server official image.

Image
0

770

ic3software/print repository overview

icCube Print Server v1.3 Released

The icCube print server packaged as a Docker image (requires an icCube server v8.5.0 onwards).

This image is hosting Chrome|Chromium so you will have to run the Docker either with a security profile or using the --no-sandbox option (see this page for more information).

Run w/ Default Configuration

docker run \
  -e ICCUBE_CHROME_NO_SANDBOX=1 \
  -d --name ic3-ps --restart unless-stopped -p 8888:8888 \
  ic3software/print:1.2-chromium

Image Overview

Within the image, the print server is installed in the folder :

/opt/ic3-print-server

and is started using the script :

/opt/ic3-print-server/bin/ic3-print-server.sh

The script is running a Java program under the user ic3 whose home directory is /home/ic3. This program is using the folder /tmp/ic3 for temporary files (e.g., Chrome user data directory, downloaded files, logs, etc...) and is listening on the HTTP port : 8888. Depending on the actual tag of the image, either Chrome or Chromium headless is being used for generating the PDF of a dashboard or exporting the data of a dashboard's widget.

Configuration

The Java program run by the script ic3-print-server.sh is configured with the following Java system properties :

java.io.tmpdir          : The temporary folder (e.g., log files, Chrome temporary data, etc...)
                          default : /tmp/ic3

ic3.exec                : The executable to run Chrome | Chromium.
                          default : google-chrome or chromium
                          
ic3.exec.options        : Additional options of Chrome | Chromium.

ic3.maxActiveCount      : Maximum number of concurrent printing jobs.
                          default : 5
      
ic3.maxQueuedCount      : Maximum number of printing jobs being queued before an active slot become active.
                          Once the limit ( ic3.maxActiveCount + ic3.maxQueueCount ) has been reached, 
                          a HTTP 429 (Too many requests) error is returned. 
                          default : 5

ic3.readingTimeout      : Timeout (second) when connecting to Chrome | Chromium using the Dev. Tools protocol.
                          default : 120

ic3.logging.active      : true|false
                          default : true
                          
ic3.logging.file.limit  : The maximum size of a log file.
                          default : 1048576
                          
ic3.logging.file.count  : The maximum number log files.
                          default : 10

ic3.logging.level.x.y.z : Define the (Java util logging) level of the logger named 'x.y.z'. 

Passing the Java system properties is done using the environment variable IC3_PS_JAVA_OPTS as following :

docker run ... \
  -e IC3_PS_JAVA_OPTS="-Xmx256m -Dic3.maxActiveCount=10" \
  ...

When using it, do not forget to define the maximum amount of RAM used by the Java heap as this variable is overriding the value setup in the script ic3-print-server.sh : e.g., -Xmx256m.

icCube Configuration (icCube.xml)

Update your icCube.xml content to use this Docker instead of a local Chrome|Chromium executable :


<printComponentConfiguration active="true">

    <!--
        Assert the connections from Chrome are from this address.

        Values:

            ignore     : no assert
            localhost  : assert from localhost
            ip-address : assert connections are from the specified address

        Default behavior: assert connections from localhost.
    -->
    <filterParam>
        <name>assertFromLocalhost</name>
        <value>192.168.1.6</value>
    </filterParam>

    <!--
        Chrome|Chromium Docker

        Connecting to an icCube print Docker use :

                exec        : ic3-print-server
                execOptions : e.g., http://192.168.1.8:8888
    -->
    <exec>ic3-print-server</exec>
    <execOptions>http://192.168.1.8:8888</execOptions>

    <!--
        Chrome|Chromium Docker 

        The address of icCube used by Chrome|Chromium when opening a report for printing :

                    http://icCube-address:xxx/icCube/print/
    -->
    <printUrl>http://192.168.1.6:8282/icCube/print/</printUrl>

</printComponentConfiguration>

REST API

The print server is accessed via a REST API. Unless mentioned otherwise, both the request parameters and the response are defined as a JSON object.

Status

Gives access to the Chrome|Chromium version, count of both active and queued jobs, etc...

/admin/status

Example :

curl -X POST http://localhost:8888/admin/status

replying :

{
  "chromeRunning": true,
  "chromeProduct": "Chrome/128.0.6613.113",
  "chromeRevision": "@9597ae93a15d4d03089b4e9997b1072228baa9ad",
  "chromeUserAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/128.0.0.0 Safari/537.36",
  "chromeProtocolVersion": "1.3",
  "chromeJsVersion": "12.8.374.24",
  "psActiveJobs": 5,
  "psMaxActiveJobs": 5,
  "psQueuedJobs": 0,
  "psMaxQueuedJobs": 5,
  "psTotalJobs": 0
}

Stop

Stop the Java process. Depending on the Docker run configuration, this might trigger a restart of the image.

/admin/stop

Example :

curl -X POST http://localhost:8888/admin/stop

Set Log Level

Set the (Java util logging) level of a given logger. The special console and file logger names are used to set respectively the level of the ConsoleHandler and of the rolling FileHandler.

/admin/logger/setLevel

parameters :

{
  "logger": "..."
}

Example :

curl -X POST  http://localhost:8888/admin/logs/setLevel \
    -H "Content-Type: application/json" \
    -d '{ "logger":"com.sun.net.httpserver", "level":"FINE" }'

Logs

Retrieve as a zip file all the log files located in the /tmp folder,

`/admin/logs`

Example :

curl -X POST http://localhost:8888/admin/logs --output ic3-logs.gz

Jobs

Retrieve the list of active printing/exporting jobs.

`/admin/jobs`

Example :

curl -X POST http://localhost:8888/admin/jobs

replying :

[
  {
    "uuid": "451bf001-479d-4dd9-b212-496069fce45c",
    "type": "PDF",
    "timeoutS": 30,
    "startTimeMS": 1725000107426,
    "elapsedTimeMS": 1701
  }
]

Cancel a Job

Cancel an active printing/exporting job.

`/admin/job/cancel`

parameters :

{
  "uuid": "..."
}

Example :

curl -X POST  http://localhost:8888/admin/job/cancel \
  -H 'Content-Type: application/json' \
  -d '{ "uuid" : "605a4d7b-ac7b-4dab-857d-6d6165eb744e" }'

Generate a PDF

Used by icCube for generating the PDF of a dashboard.

`/pdf`

Export Widget Data

Used by icCube for exporting the data (XLSX,CSV) of a dashboard's widget.

`/widget`

_

Tag summary

Content type

Image

Digest

sha256:8d67c75e0

Size

488.3 MB

Last updated

20 days ago

docker pull ic3software/print:1.3-chromium