Premium Feature — This feature supports Electronic Lab Notebooks, available in LabKey LIMS, Biologics LIMS, and the Professional Edition of Sample Manager. Learn more or contact LabKey.

Puppeteer is an external web service that can be used to generate PDFs from Notebooks created with LabKey ELN. To use this service, you need to obtain the puppeteer premium module for your LabKey Service, deploy the puppeteer-service in a docker container elsewhere, and configure your LabKey Server to communicate with it.

Puppeteer Service Overview

The puppeteer-service is a standalone docker container web service that allows for generation of assets (e.g. PDFs, screenshots) via Puppeteer. Learn about deploying this service below. Note that the puppeteer-service can be stood up once and shared by several LabKey Server instances (e.g. staging, production, etc.).

The puppeteer module is part of LabKey Server that communicates with this service to generate PDFs from Notebooks. It is run in the remote service mode to communicate with the service using the remote URL where it is deployed.

The puppeteer module also includes an experimental "docker mode" previously in use but no longer recommended. If you were using it, you should switch to using the remote mode. Note that the service always runs in a docker container, regardless of mode set in the puppeteer module.

Deploy the Puppeteer Service

Deployment

The puppeteer-service can be deployed in a Docker container on either a Linux or OSX host. Docker is required to be installed on the host machine. Retrieve the latest Docker image from Docker Hub using the following command:

docker pull labkeyteamcity/lk-puppeteer-service

This image can then be run in a container:

docker run -i --init --rm --cap-add=SYS_ADMIN -p 3031:3031 --name puppeteer-service labkeyteamcity/lk-puppeteer-service

To run the container so that it is persistent (i.e. so that it will survive server instance restarts), use the following:

sudo docker run -di --init --cap-add=SYS_ADMIN -p--restart unless-stopped --name puppeteer-service labkeyteamcity/lk-puppeteer-service

A simple HTML view has been added to allow for interacting with the service. To see this view navigate to http://localhost:3031 to get familiar.

Windows Host Deploying this service on a Windows host is not supported nor tested.

Interface

POST to /pdf:
  • inputURL: The URL of the website to create a PDF or screenshot from.
  • apiKey: (Optional) If visiting a LabKey site that requires credentials you can specify an apiKey.
  • fileName: (Optional) Name of the file that is streamed back in the response. Defaults to generated.pdf.
  • printFormat: (Optional) Currently supports Letter and A4 page sizes. Defaults to Letter.
  • printOrientation: (Optional) Supports Portrait and Landscape orientations. Defaults to Portrait.

Configuration Properties

Docker Port The Docker Port property specifies what host port the service container should be bound to.

Remote URL

The Remote URL where the web service can be found should be provided to whomever will now configure LabKey Server to connect to the puppeteer-service.

Configure Puppeteer Module

  • Select (Admin) > Site > Admin Console.
  • Under Configuration, click Puppeteer Service.
  • Enable the service.
  • Select Service Mode: Remote
  • Provide the Remote URL, including the port.
  • Click Save.

The version of Puppeteer is shown in the lower panel for your reference.

Startup Properties

All of the puppeteer module properties are also available as LabKey Server Startup Properties. An example properties file would look something like:
puppeteer.enabled;startup=true
puppeteer.mode;startup=remote
puppeteer.docker.port;startup=3031
puppeteer.docker.remapLocalhost;startup=true
puppeteer.remote.url;startup=http://localhost:3031

Related Topics

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand allcollapse all