Hi Jan,
Thanks for the follow up.
It certainly looks like chrome hanging, but it doesn't provide much output to go on. It seems to be a recent phenomenon, because other customers have been reporting slow report generation lately.
The strange thing is that most of the time it works just fine, and suddenly PDF rendering starts taking way more time.
jsreport and dependencies are installed through npm install, since I list jsreport as dependency of my project (^2.11.0).
However I disable chromium download by npm install and build my docker image on top of an image that has chromium preinstalled (shivjm/node-chromium-alpine:14)
For completeness, this my docker build file:
FROM node:14-alpine AS build
WORKDIR /usr/app-deps
RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh
COPY package.json ./
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
RUN git config --global url.https://github.com/.insteadOf git://github.com/
RUN npm install
COPY . .
RUN npm run build && \
npm prune --quiet --production
FROM shivjm/node-chromium-alpine:14
USER node
WORKDIR /usr/app
COPY --chown=node:node --from=build /usr/app-deps/package.json /usr/app-deps/package-lock.json ./
COPY --chown=node:node --from=build /usr/app-deps/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/app-deps/common ./common
COPY --chown=node:node --from=build /usr/app-deps/data ./data
COPY --chown=node:node --from=build /usr/app-deps/dist ./dist
COPY --chown=node:node --from=build /usr/app-deps/lib ./lib
COPY --chown=node:node --from=build /usr/app-deps/locales ./locales
COPY --chown=node:node --from=build /usr/app-deps/server ./server
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
ENV chrome_launchOptions_args --no-sandbox,--disable-dev-shm-usage
ENTRYPOINT ["npm", "run", "start-docker"]
In my node server process, I initialize the jsreport service as follows:
const reportingApp = express();
app.use('/reporting', reportingApp);
const server = require('http').Server(app);
const storeDir = __dirname + '/../../data';
console.log('jsreport store dir', storeDir);
const jsreport = require('jsreport')({
rootDirectory: __dirname + '/../../node_modules',
extensions: {
express: {
app: reportingApp,
server: server,
},
authentication: {
enabled: false,
},
authorization: {
enabled: false,
},
cli: {
enabled: false,
},
debug: {
enabled: true,
},
freeze: {
enabled: false,
},
'fs-store': {
dataDirectory: storeDir,
'syncModifications': false,
},
'html-to-xlsx': {
enabled: false,
},
'import-export': {
enabled: true,
},
jsrender: {
enabled: false,
},
'public-templates': {
enabled: false,
},
'resources': {
enabled: true,
},
'sample-template': {
enabled: false,
},
scheduling: {
enabled: false,
},
scripts: {
enabled: true,
},
studio: {
enabled: false,
},
'studio-theme-dark': {
enabled: false,
},
text: {
enabled: true,
},
'version-control': {
enabled: false,
},
xlsx: {
enabled: false,
},
},
chrome: {
timeout: 240000,
},
templatingEngines: {
numberOfWorkers: 2,
timeout: 90000,
strategy: 'http-server',
},
logger: {
console: {transport: 'console', level: 'debug'},
},
allowLocalFilesAccess: true,
appPath: '/reporting',
mountOnAppPath: true,
store: {provider: 'fs'},
tempDirectory: 'temp',
});
jsreport.init();